/* Dashboard Cards Estilo Personalizado */
.card {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important;
    border: 1px solid #e3e6f0 !important;
    border-radius: 0.35rem !important;
}

.border-left-primary {
    border-left: 0.25rem solid #4e73df !important;
}

.border-left-success {
    border-left: 0.25rem solid #1cc88a !important;
}

.border-left-info {
    border-left: 0.25rem solid #36b9cc !important;
}

.border-left-warning {
    border-left: 0.25rem solid #f6c23e !important;
}

.border-left-danger {
    border-left: 0.25rem solid #e74a3b !important;
}

.border-left-secondary {
    border-left: 0.25rem solid #858796 !important;
}

.icon-circle {
    height: 3rem;
    width: 3rem;
    border-radius: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-xs {
    font-size: 0.75rem;
}

.font-weight-bold {
    font-weight: 700 !important;
}

.text-gray-800 {
    color: #5a5c69 !important;
}

.text-uppercase {
    text-transform: uppercase !important;
}

.h-100 {
    height: 100% !important;
}

/* Cores dos ícones */
.bg-primary {
    background-color: #4e73df !important;
}

.bg-success {
    background-color: #1cc88a !important;
}

.bg-info {
    background-color: #36b9cc !important;
}

.bg-warning {
    background-color: #f6c23e !important;
}

.bg-danger {
    background-color: #e74a3b !important;
}

.bg-secondary {
    background-color: #858796 !important;
}

/* Hover effects */
.card:hover {
    box-shadow: 0 0.25rem 2rem 0 rgba(58, 59, 69, 0.2) !important;
    transform: translateY(-2px);
    transition: all 0.3s ease-in-out;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

/* Responsividade aprimorada */
@media (max-width: 768px) {
    .col-xl-3 {
        margin-bottom: 1rem;
    }
    
    .icon-circle {
        height: 2.5rem;
        width: 2.5rem;
    }
}

/* Prevenir cliques indevidos nos cards */
.card {
    cursor: default !important;
    pointer-events: none;
}

.card .btn, .card a, .card button {
    pointer-events: auto;
    cursor: pointer !important;
}

/* Remover qualquer cursor pointer dos cards de produtos */
.border-left-success * {
    cursor: default !important;
}

/* ============================================
   ESTILOS GLOBAIS DO SISTEMA
   ============================================ */

/* Garantir que inputs md-form-control sejam sempre funcionais */
input.md-form-control {
    pointer-events: auto !important;
    user-select: auto !important;
    -webkit-user-select: auto !important;
    -moz-user-select: auto !important;
    background: transparent !important;
    outline: none !important;
    z-index: 2 !important;
    position: relative !important;
    cursor: text !important;
}

/* Garantir que o wrapper não interfira */
.md-input-wrapper {
    position: relative !important;
    pointer-events: auto !important;
}

/* Labels devem ficar atrás dos inputs */
.md-input-wrapper > label {
    pointer-events: none !important;
    z-index: 1 !important;
}

/* Específico para DataTables */
#footer-search tfoot .md-input-wrapper input.md-form-control {
    pointer-events: auto !important;
    cursor: text !important;
}

/* Garantir que o highlighting funcione em TODOS os DataTables */
table.dataTable mark,
.dataTables_wrapper mark,
.table mark,
#footer-search mark {
    background-color: rgba(255, 255, 0, 0.3) !important;
    color: #000 !important;
    padding: 1px 2px !important;
    font-weight: 600 !important;
    border-radius: 2px !important;
}

/* Scroll horizontal SIMPLES - forçar no wrapper */
#footer-search_wrapper {
    overflow-x: scroll !important;
    overflow-y: visible !important;
    max-width: 100% !important;
    width: 100% !important;
    position: relative !important;
    z-index: 10 !important;
    pointer-events: auto !important;
}

/* Container externo COM largura limitada */
.dt-responsive.table-responsive {
    overflow: visible !important;
    max-width: 100vw !important;
    width: 100% !important;
    position: relative !important;
    z-index: 1 !important;
}

.card-body {
    max-width: 100% !important;
    overflow: visible !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Tabela com largura automática - ajustada ao conteúdo */
#footer-search {
    width: auto !important;
    min-width: 100% !important;
    max-width: none !important;
    position: relative !important;
    z-index: 5 !important;
}

/* FORÇAR todos os elementos filhos a não bloquearem o scroll */
#footer-search_wrapper > * {
    pointer-events: auto !important;
}

/* Remover qualquer overlay que possa estar bloqueando */
.dataTables_wrapper::before,
.dataTables_wrapper::after,
#footer-search_wrapper::before,
#footer-search_wrapper::after {
    display: none !important;
}

/* Scrollbar padrão e fina */
#footer-search_wrapper::-webkit-scrollbar {
    height: 8px !important;
}

#footer-search_wrapper::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
}

#footer-search_wrapper::-webkit-scrollbar-thumb {
    background: #888 !important;
    cursor: grab !important;
}

#footer-search_wrapper::-webkit-scrollbar-thumb:hover {
    background: #555 !important;
}

#footer-search_wrapper::-webkit-scrollbar-thumb:active {
    background: #333 !important;
    cursor: grabbing !important;
}

/* ============================================
   REGRAS GENÉRICAS PARA TODOS OS DATATABLES
   ============================================ */

/* Scroll horizontal em QUALQUER wrapper de DataTable */
.dataTables_wrapper,
[id$="_wrapper"] {
    overflow-x: scroll !important;
    overflow-y: visible !important;
    max-width: 100% !important;
    width: 100% !important;
    position: relative !important;
    z-index: 10 !important;
    pointer-events: auto !important;
}

/* Container externo da tabela */
.table-responsive {
    overflow: visible !important;
    max-width: 100% !important;
    width: 100% !important;
    position: relative !important;
    z-index: 1 !important;
    display: block;
}

/* subtle highlight for DataTables search results using mark.js */
mark.dt-mark, mark {
        background-color: rgba(255, 235, 59, 0.35); /* soft yellow */
        color: inherit; /* keep original text color */
        padding: 0 2px;
        border-radius: 3px;
}

.dt-mark {
        background-color: rgba(255, 235, 59, 0.35);
}

/* cursor on reorderable tables */
table.dt-reorderable thead th{ cursor: move !important; }
.card-body {
    max-width: 100% !important;
    overflow: visible !important;
}

/* Tabelas DataTable com largura automática */
.dataTable {
    width: auto !important;
    min-width: 100% !important;
    max-width: none !important;
}

/* FORÇAR todos os elementos filhos a não bloquearem o scroll */
.dataTables_wrapper > *,
[id$="_wrapper"] > * {
    pointer-events: auto !important;
}

/* Scrollbar customizada e arrastável para TODOS os wrappers */
.dataTables_wrapper::-webkit-scrollbar,
[id$="_wrapper"]::-webkit-scrollbar {
    height: 8px !important;
}

.dataTables_wrapper::-webkit-scrollbar-track,
[id$="_wrapper"]::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
}

.dataTables_wrapper::-webkit-scrollbar-thumb,
[id$="_wrapper"]::-webkit-scrollbar-thumb {
    background: #888 !important;
    cursor: grab !important;
}

.dataTables_wrapper::-webkit-scrollbar-thumb:hover,
[id$="_wrapper"]::-webkit-scrollbar-thumb:hover {
    background: #555 !important;
}

.dataTables_wrapper::-webkit-scrollbar-thumb:active,
[id$="_wrapper"]::-webkit-scrollbar-thumb:active {
    background: #333 !important;
    cursor: grabbing !important;
}

/* Ajustes responsivos para TODAS as tabelas */
@media (max-width: 768px) {
    .dataTable th,
    .dataTable td {
        white-space: nowrap;
        padding: 0.5rem !important;
        font-size: 0.875rem !important;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 576px) {
    .dataTable th,
    .dataTable td {
        padding: 0.35rem !important;
        font-size: 0.75rem !important;
    }
}

/* ============================================
   FORMULÁRIOS E CONTROLES
   ============================================ */

/* Limit scope to admin content area to avoid affecting front-end pages */
.pc-content input.form-control,
.pc-content select.form-select,
.pc-content textarea.form-control,
.pc-content .form-check-input,
.pc-content [contenteditable] {
    pointer-events: auto !important;
    user-select: text !important;
    cursor: text !important;
}

.border-left-success * {
    cursor: default !important;
}