/* ============================================
   SOFIA - CSS RESPONSIVO ADMIN
   Dashboard Mobile-First
   ============================================ */

/* --- BOTÃO MENU HAMBURGUER --- */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: white;
    margin: 4px 0;
    transition: 0.3s;
    border-radius: 2px;
}

/* Animação hamburguer -> X */
.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* --- OVERLAY ESCURO --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ============================================
   RESPONSIVIDADE MOBILE (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
    
    /* --- MOSTRAR BOTÃO HAMBURGUER --- */
    .mobile-menu-toggle {
        display: block !important;
    }
    
    /* --- SIDEBAR ESCONDIDA POR PADRÃO --- */
    .sidebar {
        position: fixed !important;
        left: -280px !important;
        top: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        z-index: 999 !important;
        transition: left 0.3s ease !important;
        overflow-y: auto !important;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
    }
    
    /* --- SIDEBAR VISÍVEL --- */
    .sidebar.active {
        left: 0 !important;
    }
    
    /* --- CONTEÚDO PRINCIPAL SEM MARGEM --- */
    .main-content {
        margin-left: 0 !important;
        padding: 70px 10px 20px 10px !important;
        width: 100% !important;
    }
    
    /* --- HEADER COMPACTO --- */
    .header {
        padding: 20px 15px !important;
        margin-bottom: 20px !important;
        border-radius: 8px !important;
    }
    
    .header h1 {
        font-size: 20px !important;
        margin-bottom: 5px !important;
    }
    
    .header p {
        font-size: 12px !important;
    }
    
    /* --- CARDS EM COLUNA ÚNICA --- */
    .metrics-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        margin-bottom: 20px !important;
    }
    
    .metric-card {
        padding: 18px !important;
    }
    
    .metric-card h3 {
        font-size: 13px !important;
        margin-bottom: 8px !important;
    }
    
    .metric-card .value {
        font-size: 26px !important;
        margin-bottom: 5px !important;
    }
    
    .metric-card .change {
        font-size: 11px !important;
    }
    
    /* --- SEÇÕES --- */
    .section {
        padding: 15px !important;
        margin-bottom: 15px !important;
        border-radius: 8px !important;
    }
    
    .section h2 {
        font-size: 16px !important;
        margin-bottom: 12px !important;
    }
    
    /* --- TABELAS RESPONSIVAS --- */
    .table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin: 0 -10px !important;
        padding: 0 10px !important;
    }
    
    table {
        min-width: 700px !important;
        font-size: 12px !important;
    }
    
    table th {
        padding: 10px 8px !important;
        font-size: 11px !important;
        white-space: nowrap !important;
    }
    
    table td {
        padding: 10px 8px !important;
        font-size: 12px !important;
    }
    
    /* --- BOTÕES MAIORES (TOUCH-FRIENDLY) --- */
    .btn, button, .action-btn {
        padding: 10px 14px !important;
        font-size: 12px !important;
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Botões de ação na tabela */
    table .action-btn {
        margin: 3px !important;
        padding: 8px 10px !important;
        min-height: 36px !important;
    }
    
    /* --- FORMULÁRIOS --- */
    input, select, textarea {
        font-size: 16px !important; /* Evita zoom no iOS */
        padding: 12px !important;
        width: 100% !important;
    }
    
    label {
        font-size: 13px !important;
        margin-bottom: 6px !important;
    }
    
    /* --- BADGES E STATUS --- */
    .badge, .status {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }
}

/* ============================================
   TABLET (768px - 1024px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    
    .main-content {
        margin-left: 220px !important;
        padding: 15px !important;
    }
    
    .sidebar {
        width: 220px !important;
    }
    
    .sidebar h2 {
        font-size: 16px !important;
    }
    
    .sidebar a {
        padding: 10px 15px !important;
        font-size: 13px !important;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    
    .header h1 {
        font-size: 24px !important;
    }
    
    table {
        font-size: 13px !important;
    }
    
    .btn {
        padding: 10px 16px !important;
        font-size: 13px !important;
    }
}

/* ============================================
   MELHORIAS GERAIS
   ============================================ */

/* Imagens responsivas */
img {
    max-width: 100%;
    height: auto;
}

/* Evitar overflow horizontal */
* {
    max-width: 100%;
}

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* Touch feedback */
@media (hover: none) and (pointer: coarse) {
    button, a, .btn {
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
    }
}




/* ===================================
   BOTÕES DE EXPORTAÇÃO - RELATÓRIOS
   =================================== */

@media (max-width: 768px) {
    /* Container dos botões exportar */
    div[style*="margin-left: auto"][style*="display: flex"] {
        margin-left: 0 !important;
        width: 100% !important;
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    /* Botões de exportar PDF e Excel */
    button[onclick*="exportar/pdf"],
    button[onclick*="exportar/excel"] {
        width: 100% !important;
        margin: 0 !important;
        padding: 12px 20px !important;
        font-size: 14px !important;
    }
    
    /* Filters bar responsivo */
    .filters-bar {
        flex-direction: column !important;
        align-items: stretch !important;
    }
}


/* ===================================


/* FILTER-SECTION RESPONSIVO - APENAS RELATÓRIOS */
@media (max-width: 768px) {
    .filter-section {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px !important;
    }
    
    .filter-section .filter-btn {
        width: 100% !important;
        margin: 5px 0 !important;
    }
    
    .filter-section > div[style*="margin-left"] {
        margin-left: 0 !important;
        width: 100% !important;
        flex-direction: column !important;
    }
    
    .filter-section button[onclick*="exportar"] {
        width: 100% !important;
        margin: 5px 0 !important;
    }
}
