@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --azul-marca: #1b4b82; --dourado-marca: #b5904d;
    --sidebar-bg: #0f172a; --sidebar-hover: #1e293b; --sidebar-text: #94a3b8;
    --bg-app: #f1f5f9; --card-bg: #ffffff; --text-dark: #0f172a; --text-muted: #64748b;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    --radius-lg: 16px; --radius-md: 10px;
}

body { font-family: 'Inter', sans-serif; background-color: var(--bg-app); color: var(--text-dark); overflow-x: hidden; }

/* ==========================================================
   Menu Lateral Dark Premium (Com Correção para Mobile)
   ========================================================== */
#sidebar {
    width: 280px; 
    position: fixed; left: 0; top: 0; bottom: 0; /* Troca de 100vh por top/bottom 0 para suportar Mobile Safaris/Chrome */
    background: var(--sidebar-bg); z-index: 1040; transition: transform 0.3s ease; display: flex; flex-direction: column;
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
}
.sidebar-logo { padding: 30px 20px 25px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.05); }

.sidebar-menu { 
    flex: 1; 
    overflow-y: auto; 
    padding: 20px 15px 80px 15px; /* O padding de 80px no final garante que o último item não fica escondido no telemóvel */
}
.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.menu-category { color: #64748b; font-size: 0.75rem; text-transform: uppercase; font-weight: 700; letter-spacing: 1px; padding: 0 15px; margin-bottom: 10px; }

.nav-link {
    color: var(--sidebar-text); padding: 10px 15px; font-weight: 500; font-size: 0.95rem; display: flex; align-items: center;
    gap: 12px; border-radius: var(--radius-md); margin-bottom: 2px; transition: all 0.2s ease;
}
.nav-link i { font-size: 1.2rem; transition: all 0.2s ease; color: #64748b; }
.nav-link:hover { background-color: var(--sidebar-hover); color: #ffffff; }
.nav-link:hover i { color: var(--dourado-marca); }
.nav-link.active { background: linear-gradient(135deg, var(--azul-marca) 0%, #2a65a3 100%); color: #ffffff; box-shadow: 0 4px 12px rgba(27, 75, 130, 0.4); }
.nav-link.active i { color: #ffffff; }

/* Conteúdo Principal */
#main-content { margin-left: 280px; padding: 30px 40px; transition: margin-left 0.3s ease; }
.topbar { background: transparent; display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }

/* Cartões e Tabelas */
.card-custom { background: var(--card-bg); border-radius: var(--radius-lg); border: 1px solid rgba(0,0,0,0.03); box-shadow: var(--shadow-sm); transition: 0.3s ease; }
.card-custom:hover { box-shadow: var(--shadow-md); }

.table-custom { border-collapse: separate; border-spacing: 0 8px; }
.table-custom thead th { border: none; color: var(--text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; padding: 0 20px 10px 20px; }
.table-custom tbody tr { background: var(--card-bg); box-shadow: 0 2px 4px rgba(0,0,0,0.02); border-radius: 12px; transition: 0.2s; }
.table-custom tbody tr:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.table-custom tbody td { border: none; padding: 15px 20px; vertical-align: middle; }
.table-custom tbody td:first-child { border-top-left-radius: 12px; border-bottom-left-radius: 12px; }
.table-custom tbody td:last-child { border-top-right-radius: 12px; border-bottom-right-radius: 12px; }

/* Botões */
.btn-brand { background: var(--azul-marca); color: white; border: none; border-radius: 8px; padding: 10px 20px; font-weight: 500; transition: 0.2s; }
.btn-brand:hover { background: var(--azul-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(27, 75, 130, 0.2); color: white; }

/* Mobile Overlay */
#sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(2px); z-index: 1030; }

@media (max-width: 992px) {
    #sidebar { transform: translateX(-100%); } 
    #sidebar.show { transform: translateX(0); }
    #main-content { margin-left: 0; padding: 20px; } 
    #sidebar-overlay.show { display: block; }
    .topbar { flex-direction: column; align-items: flex-start; gap: 15px; } 
    .camara-select-form { width: 100%; }
}