/* Variáveis Globais (Tema Claro Premium) */
:root {
    /* Cores principais */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    
    /* Backgrounds e superfícies */
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    
    /* Textos */
    --text-main: #0f172a;
    --text-muted: #64748b;
    
    /* Status e Feedback */
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --info: #3b82f6;
    
    /* Sombras e Bordas */
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    
    /* Outros */
    --border-radius: 12px;
    --sidebar-width: 260px;
    --font-premium: 'Inter', sans-serif;
}

/* Reset Básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Layout Principal */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 24px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px 32px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.sidebar-brand h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.nav-list {
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
    padding: 16px 8px 8px;
    letter-spacing: 0.05em;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link i {
    font-size: 1.25rem;
}

.nav-link:hover {
    background-color: var(--bg-body);
    color: var(--primary);
}

.nav-link.active {
    background-color: var(--primary);
    color: white;
}

/* Conteúdo Principal */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 40px;
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.topbar h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-surface);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    font-weight: 500;
}

/* Cards de Resumo */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.card {
    background-color: var(--bg-surface);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-card small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Utilitários de Texto */
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }

/* Badges Globais */
.badge { 
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; 
    text-transform: uppercase; letter-spacing: 0.02em; border: 1px solid transparent;
}
.badge-success { background-color: var(--success-bg); color: var(--success); border-color: rgba(16, 185, 129, 0.1); }
.badge-danger { background-color: var(--danger-bg); color: var(--danger); border-color: rgba(239, 68, 68, 0.1); }
.badge-warning { background-color: var(--warning-bg); color: var(--warning); border-color: rgba(245, 158, 11, 0.1); }
.badge-info { background-color: #eff6ff; color: #2563eb; border-color: rgba(59, 130, 246, 0.1); }
.badge-neutral { background-color: #f1f5f9; color: #475569; border-color: #e2e8f0; }

.btn-icon { background: none; border: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s; border-radius: 8px; }
.btn-icon:hover { background-color: #f1f5f9; transform: translateY(-1px); }

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.dashboard-grid .card h3 {
    margin-bottom: 20px;
    font-size: 1.125rem;
    color: var(--text-main);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* Lista de Atividades (ex: próximos pagamentos) */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-list li {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--bg-body);
}

.activity-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.activity-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-body);
    font-size: 1.25rem;
}

.activity-icon.text-danger { background-color: var(--danger-bg); }
.activity-icon.text-success { background-color: var(--success-bg); }

.activity-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.activity-details strong {
    font-size: 0.875rem;
    font-weight: 600;
}

.activity-details small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.activity-amount {
    font-weight: 600;
    font-size: 0.875rem;
}

/* Novo Estudo de Formulários Premium (Filtros) */
.filter-bar {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
    box-shadow: var(--shadow-sm);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-control, .form-control-premium {
    height: 42px;
    padding: 0 16px;
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-main);
    transition: all 0.2s ease;
    outline: none;
    width: 100%;
}

.form-control:hover, .form-control-premium:hover {
    background: #e2e8f0;
}

.form-control:focus, .form-control-premium:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

select.form-control, select.form-control-premium {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

textarea.form-control, textarea.form-control-premium {
    height: auto;
    padding: 12px 16px;
}

input[type="date"].form-control, 
input[type="date"].form-control-premium, 
input[type="month"].form-control, 
input[type="month"].form-control-premium {
    position: relative;
    min-width: 150px;
    cursor: pointer;
}

/* Global Custom Dropdown Status */
.custom-dropdown { position: relative; width: 100%; user-select: none; }
.dropdown-trigger { 
    display: flex; align-items: center; justify-content: space-between; gap: 4px;
    padding: 6px 14px; border-radius: 20px; font-size: 0.8125rem; font-weight: 600; 
    cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.05); transition: all 0.2s; border: 1px solid rgba(0,0,0,0.05);
}
.dropdown-trigger.status-grey { background-color: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.dropdown-trigger.status-green { background-color: #10b981; color: white; }
.dropdown-trigger.status-orange { background-color: #f59e0b; color: white; }
.dropdown-trigger.status-red { background-color: #ef4444; color: white; }

.dropdown-trigger:hover { filter: brightness(0.95); transform: translateY(-1px); }

.dropdown-menu { 
    position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); width: 160px; z-index: 1000;
    background: white; border-radius: 12px; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1); 
    border: 1px solid var(--border-color); padding: 6px; display: none; flex-direction: column; gap: 4px;
}
.dropdown-menu.show { display: flex; animation: fadeInDownPremium 0.2s ease-out forwards; }
@keyframes fadeInDownPremium { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.dropdown-item { 
    padding: 10px 14px; border-radius: 8px; font-size: 0.8125rem; font-weight: 600; cursor: pointer; transition: 0.2s; text-align: left;
    background: transparent; color: var(--text-main);
}
.dropdown-item:hover { background-color: #f1f5f9; }
.dropdown-item.status-grey:hover { background-color: #f1f5f9; color: #475569; }
.dropdown-item.status-green:hover { background-color: #d1fae5; color: #065f46; }
.dropdown-item.status-orange:hover { background-color: #fef3c7; color: #92400e; }
.dropdown-item.status-red:hover { background-color: #fee2e2; color: #991b1b; }

/* Global Data Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-surface);
    font-size: 0.875rem;
}

.data-table th, .data-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tr:hover {
    background-color: #f1f5f9;
}

.data-table tfoot {
    background-color: #f8fafc;
    font-weight: 600;
}

/* Specific alignments */
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }

/* ---------- Responsividade (Mobile & Tablet) ---------- */

/* Header Mobile (Oculto por padrão no Desktop) */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 999;
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.125rem;
}

.mobile-toggle {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* Overlay para quando o menu está aberto */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
    backdrop-filter: blur(2px);
}

@media (max-width: 992px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 20px 0 50px rgba(0,0,0,0.1);
        z-index: 1001; /* Garante que fique acima de tudo */
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 20px;
        width: 100%;
        flex: none;
    }
    
    .mobile-header {
        display: flex;
        width: 100%;
    }
    
    /* Esconder o perfil da topbar original para não duplicar */
    .topbar .user-profile {
        display: none;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-cards {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .topbar h1 {
        font-size: 1.25rem;
    }
    
    .data-table th, .data-table td {
        padding: 12px 10px;
        font-size: 0.8125rem;
    }
    
    /* Ajuste para tabelas em telas muito pequenas */
    .data-table {
        min-width: 600px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}



