/* --- DESIGN SYSTEM & VARIÁVEIS --- */
:root {
    /* Fontes */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;

    /* Tema Escuro (Padrão) */
    --bg-primary: #0b0a12;
    --bg-secondary: #121020;
    --bg-tertiary: #19172e;
    --border-color: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    
    /* Textos */
    --text-main: #f3f1fd;
    --text-muted: #9691b8;
    --text-inverse: #0b0a12;

    /* Cores de Marca & Acentos (HSL base para controle de opacidade) */
    --primary-h: 265;
    --primary-s: 85%;
    --primary-l: 65%;
    --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --primary-glow: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.15);
    
    --secondary-h: 215;
    --secondary-s: 90%;
    --secondary-l: 60%;
    --secondary: hsl(var(--secondary-h), var(--secondary-s), var(--secondary-l));
    
    --accent-h: 40;
    --accent-s: 90%;
    --accent-l: 60%;
    --accent: hsl(var(--accent-h), var(--accent-s), var(--accent-l));

    /* Status */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);

    /* Efeitos */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
    --glass-bg: rgba(18, 16, 32, 0.6);
    --glass-blur: blur(12px);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- TEMA CLARO (Alternável) --- */
body.light-theme {
    --bg-primary: #f6f5fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0edf7;
    --border-color: rgba(0, 0, 0, 0.07);
    --border-hover: rgba(0, 0, 0, 0.12);
    
    --text-main: #181625;
    --text-muted: #6e6b8a;
    --text-inverse: #ffffff;
    
    --glass-bg: rgba(255, 255, 255, 0.7);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.12);
}

/* --- RESET & LAYOUT GLOBAL --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
}

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

/* --- BARRA LATERAL (SIDEBAR) --- */
.sidebar {
    width: 280px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
    overflow-y: auto;
}

.sidebar-header {
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 24px;
}

.logo h2 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo h2 span {
    color: var(--primary);
}

/* Gradiente de Marca */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Menu de Navegação */
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.menu-item i {
    font-size: 18px;
    transition: transform var(--transition-fast);
}

.menu-item:hover {
    color: var(--text-main);
    background-color: var(--bg-tertiary);
}

.menu-item:hover i {
    transform: scale(1.1);
}

.menu-item.active {
    color: var(--text-inverse);
    background: linear-gradient(135deg, var(--primary), hsl(var(--primary-h), var(--primary-s), 55%));
    box-shadow: 0 4px 15px rgba(138, 75, 255, 0.35);
}

.menu-item.active i {
    color: var(--text-inverse);
}

/* Sidebar Rodapé */
.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.theme-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition-fast);
    justify-content: center;
}

.theme-btn:hover {
    border-color: var(--primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.user-info h4 {
    font-size: 14px;
    font-weight: 600;
}

.user-info p {
    font-size: 12px;
    color: var(--text-muted);
}

.main-content {
    margin-left: 280px;
    flex-grow: 1;
    padding: 40px;
    min-height: 100vh;
    overflow-x: auto;
    max-width: 100%;
}

/* Cabeçalho */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
}

.header-title h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.text-muted {
    color: var(--text-muted);
    font-size: 14px;
}

/* --- BOTÕES --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), hsl(var(--primary-h), var(--primary-s), 55%));
    color: white;
    box-shadow: 0 4px 15px rgba(138, 75, 255, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(138, 75, 255, 0.35);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-hover);
    transform: translateY(-2px);
}

/* --- ESTRUTURA DE ABAS --- */
.tab-content {
    display: none;
    animation: fadeIn var(--transition-normal);
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- GRID DE MÉTRICAS (DASHBOARD) --- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.metric-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-hover);
}

.clickable-card {
    cursor: pointer;
}

.clickable-card:hover {
    box-shadow: 0 4px 20px var(--primary-glow);
    border-color: var(--primary);
}

.metric-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.bg-purple { background-color: rgba(138, 75, 255, 0.12); color: var(--primary); }
.bg-blue { background-color: rgba(59, 130, 246, 0.12); color: var(--secondary); }
.bg-amber { background-color: rgba(245, 158, 11, 0.12); color: var(--accent); }
.bg-green { background-color: rgba(16, 185, 129, 0.12); color: var(--success); }

.metric-details {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.metric-details h3 {
    font-size: 26px;
    font-weight: 700;
    margin: 4px 0;
}

.metric-trend {
    font-size: 11px;
    font-weight: 600;
}

.metric-trend.positive { color: var(--success); }
.metric-trend.neutral { color: var(--text-muted); }

/* Layout Dashboard (Duas Colunas) */
.dashboard-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.dashboard-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.card-header h3 {
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- TABELAS DATA TABLE --- */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 14px;
    font-weight: 500;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Badges de Status */
.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-purple { background-color: rgba(138, 75, 255, 0.15); color: var(--primary); }
.badge-success { background-color: var(--success-bg); color: var(--success); }
.badge-warning { background-color: var(--warning-bg); color: var(--warning); }
.badge-info { background-color: var(--info-bg); color: var(--info); }
.badge-danger { background-color: var(--danger-bg); color: var(--danger); }

/* Ações nas Tabelas */
.actions-cell {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-main);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-icon.delete:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* --- LINHA DO TEMPO (TODAY TIMELINE) --- */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline-item {
    position: relative;
    padding-left: 24px;
    border-left: 2px solid var(--primary);
    padding-bottom: 8px;
}

.timeline-time {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.timeline-title {
    font-size: 15px;
    font-weight: 600;
}

.timeline-desc {
    font-size: 13px;
    color: var(--text-muted);
}

.timeline-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 30px 0;
    font-size: 14px;
}

/* --- ALERTAS E ALERTA LISTA --- */
.alerts-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
}

.alert-item.warning { background-color: var(--warning-bg); color: var(--warning); }
.alert-item.info { background-color: var(--info-bg); color: var(--info); }

.alert-item i {
    font-size: 18px;
    margin-top: 2px;
}

.alert-item strong {
    display: block;
    margin-bottom: 2px;
}

/* --- AÇÕES DA SEÇÃO (SEARCH & FILTERS) --- */
.section-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 20px;
}

.search-box {
    position: relative;
    flex-grow: 1;
    max-width: 400px;
}

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 46px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Sub-Navegação (Abas de Nível 2) */
.tab-sub-nav {
    display: flex;
    gap: 8px;
    background-color: var(--bg-secondary);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.sub-nav-btn {
    border: none;
    background: none;
    padding: 8px 16px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.sub-nav-btn.active {
    background-color: var(--bg-tertiary);
    color: var(--primary);
}

.subtab-content {
    display: none;
}

.subtab-content.active {
    display: block;
}

/* --- PROFESSORES GRID --- */
.teachers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.teacher-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    position: relative;
    transition: all var(--transition-fast);
}

.teacher-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.teacher-avatar {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    border-radius: 50%;
    margin: 0 auto 16px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.teacher-card h4 {
    font-size: 18px;
    margin-bottom: 4px;
}

.teacher-card .specialty {
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 14px;
}

.teacher-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    border-top: 1px solid var(--border-color);
    padding-top: 14px;
    margin-top: 14px;
}

.teacher-stat-box {
    display: flex;
    flex-direction: column;
}

.teacher-stat-num {
    font-size: 18px;
    font-weight: 700;
}

.teacher-stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* --- MODAIS DE CADASTRO --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform var(--transition-fast);
}

.modal-card.large {
    max-width: 900px;
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
}

/* Custom scrollbar for modal body */
.modal-body::-webkit-scrollbar {
    width: 6px;
}
.modal-body::-webkit-scrollbar-track {
    background: transparent;
}
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Estilos de Formulário */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 14px;
    transition: border-color var(--transition-fast);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    outline: none;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
}

/* --- TOAST SYSTEM --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 300;
}

.toast {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-md);
    transform: translateX(100%);
    animation: slideIn var(--transition-normal) forwards;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }

@keyframes slideIn {
    to { transform: translateX(0); }
}

/* Helpers */
.hidden { display: none !important; }

/* --- ESTILOS MOBILE DE ALTA FIDELIDADE --- */
.mobile-header-bar {
    display: none;
}
.mobile-bottom-nav {
    display: none;
}
.more-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    box-sizing: border-box;
    padding-top: max(20px, env(safe-area-inset-top, 0px));
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.more-sheet-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.more-sheet-card {
    width: 100%;
    max-height: calc(100% - 4px);
    max-height: min(82vh, calc(100% - 4px));
    max-height: min(82dvh, calc(100% - 4px));
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%);
    transition: transform var(--transition-normal);
    padding: 16px 20px;
    padding-top: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}
.more-sheet-overlay.active .more-sheet-card {
    transform: translateY(0);
}
.more-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding: 4px 0 14px;
    flex-shrink: 0;
    min-height: 48px;
    overflow: visible;
}
.more-sheet-header h3 {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.45;
    margin: 0;
    padding: 0;
    flex: 1;
    overflow: visible;
}
.more-sheet-handle {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-color);
    margin: 0 auto 14px;
    flex-shrink: 0;
}
.more-sheet-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    padding-right: 2px;
}
.more-sheet-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}
.more-options-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.more-option-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 15px;
    font-weight: 500;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.more-option-item i {
    font-size: 18px;
    color: var(--primary);
    width: 24px;
    text-align: center;
}
.more-option-item:active {
    background: var(--border-hover);
    border-color: var(--primary);
}
.more-sheet-separator {
    height: 1px;
    background-color: var(--border-color);
    margin: 20px 0;
}
.mobile-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}
.mobile-avatar {
    width: 40px;
    height: 40px;
    font-size: 14px;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .dashboard-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    /* Ocultar barra lateral desktop */
    .sidebar {
        display: none !important;
    }
    
    .app-container {
        flex-direction: column;
    }
    
    /* Compensar altura da barra superior e inferior */
    .main-content {
        margin-left: 0 !important;
        padding: 85px 16px 95px 16px !important;
    }
    
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 25px;
    }
    .main-header .header-title {
        width: 100%;
        flex-wrap: wrap;
    }
    .main-header .header-actions {
        width: 100%;
    }
    .main-header .header-actions .btn,
    .main-header .header-actions #quick-add-btn {
        width: 100% !important;
        justify-content: center;
    }
    
    .header-title h1 {
        font-size: 26px;
    }
    
    #toggle-sidebar-btn {
        display: none !important;
    }
    
    /* Exibir cabeçalho mobile */
    .mobile-header-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 65px;
        background: var(--glass-bg);
        backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur);
        border-bottom: 1px solid var(--border-color);
        padding: 0 16px;
        z-index: 999;
    }
    
    .mobile-header-bar .logo h2 {
        font-size: 22px;
    }
    
    .mobile-header-actions {
        display: flex;
        gap: 8px;
    }
    
    .mobile-action-btn {
        width: 38px;
        height: 38px;
        border-radius: var(--radius-sm);
        border: 1px solid var(--border-color);
        background: var(--bg-tertiary);
        color: var(--text-main);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 15px;
        cursor: pointer;
        transition: all var(--transition-fast);
    }
    
    .mobile-action-btn:active {
        transform: scale(0.92);
        border-color: var(--primary);
    }
    
    /* Exibir barra inferior mobile */
    .mobile-bottom-nav {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: var(--glass-bg);
        backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur);
        border-top: 1px solid var(--border-color);
        z-index: 999;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    
    .mobile-menu-wrapper {
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 65px;
    }
    
    .mobile-menu-wrapper .menu-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 8px 0;
        color: var(--text-muted);
        font-size: 10px;
        font-weight: 600;
        border-radius: 0;
        height: 100%;
    }
    
    .mobile-menu-wrapper .menu-item i {
        font-size: 18px;
        margin: 0;
    }
    
    .mobile-menu-wrapper .menu-item.active {
        color: var(--primary);
    }
    
    .mobile-menu-wrapper .menu-item.active i {
        color: var(--primary);
        transform: scale(1.1);
    }
    
    /* Grid de Métricas Compacto */
    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
        gap: 12px !important;
        margin-bottom: 24px;
    }
    
    .metric-card {
        padding: 16px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
        border-radius: var(--radius-md) !important;
    }
    
    .metric-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 16px !important;
        border-radius: var(--radius-sm) !important;
    }
    
    .metric-details h3 {
        font-size: 20px !important;
        margin: 2px 0 !important;
    }
    
    /* Ações de Seção (Filtros e Busca) */
    .section-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .search-box {
        max-width: none;
    }
    
    .tab-sub-nav {
        overflow-x: auto;
        white-space: nowrap;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        padding: 4px;
    }
    
    .sub-nav-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .action-buttons {
        display: flex;
        gap: 8px;
        width: 100%;
    }
    
    .action-buttons button {
        flex: 1;
        justify-content: center;
    }
    
    /* Tabelas com Scroll suave */
    .table-responsive {
        border-radius: var(--radius-md);
        border: 1px solid var(--border-color);
        background: var(--bg-secondary);
    }
    
    /* Ajustes de Modais */
    .modal-card {
        width: 95%;
        margin: 10px;
    }
}


/* --- TELA DE LOGIN PREMIUM --- */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 50%, var(--bg-tertiary) 0%, var(--bg-primary) 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, transform 0.5s ease;
    opacity: 1;
    pointer-events: all;
}

.login-overlay.fade-out {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

.login-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 420px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: loginCardIntro 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes loginCardIntro {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-brand {
    margin-bottom: 30px;
}

.login-logo {
    font-size: 42px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
    display: inline-block;
    filter: drop-shadow(0 4px 10px rgba(138, 75, 255, 0.25));
}

.login-brand h2 {
    font-size: 30px;
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.login-brand h2 span {
    color: var(--primary);
}

.login-brand p {
    font-size: 13px;
    color: var(--text-muted);
}

.login-btn {
    width: 100%;
    padding: 14px;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    margin-top: 10px;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(138, 75, 255, 0.25);
    transition: all var(--transition-fast);
}

.login-btn:hover {
    box-shadow: 0 6px 20px rgba(138, 75, 255, 0.4);
    transform: translateY(-2px);
}

/* Tab buttons inside login card */
.login-tab-btn {
    transition: all var(--transition-fast);
}
.login-tab-btn.active {
    color: var(--primary) !important;
    border-bottom: 2px solid var(--primary) !important;
    background-color: rgba(138, 75, 255, 0.05) !important;
}
.login-tab-btn:hover {
    color: var(--text-main);
}

/* --- CALENDAR DAY CELLS STYLING & RESPONSIVENESS --- */
.calendar-day-cell {
    padding: 8px;
    min-height: 120px;
    height: auto;
    max-height: 180px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    font-size: 11px;
    transition: transform 0.2s, border-color 0.2s;
    overflow-y: auto;
}

.calendar-day-cell > div {
    flex-shrink: 0;
}

.calendar-day-cell.today {
    border-color: var(--primary);
    box-shadow: 0 0 5px var(--primary-glow);
}

/* Scrollbar styling for calendar day cells */
.calendar-day-cell::-webkit-scrollbar {
    width: 3px;
}
.calendar-day-cell::-webkit-scrollbar-track {
    background: transparent;
}
.calendar-day-cell::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}
.calendar-day-cell::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .calendar-day-cell {
        padding: 4px;
        min-height: 75px;
        height: 75px;
        max-height: 75px;
        font-size: 9px;
    }
    input, select, textarea, .form-group input, .form-group select, .form-group textarea, .search-box input {
        font-size: 16px !important;
    }
}

/* Hide duplicate tab action buttons on desktop since the header has them */
@media (min-width: 769px) {
    #add-student-btn,
    #admin-add-teacher-btn,
    #add-lesson-btn,
    #add-instrument-btn,
    #admin-add-course-btn {
        display: none !important;
    }
}

/* --- ANNOUNCEMENTS BOARD STYLES --- */
.announcement-item {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    text-align: left;
}

.announcement-item:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.announcement-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
}

.announcement-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.announcement-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
}

.announcement-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
}

.announcement-content {
    font-size: 13px;
    color: var(--text-main);
    line-height: 1.4;
    white-space: pre-wrap;
    opacity: 0.95;
}

.announcement-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 8px;
}

.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.reaction-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.reaction-btn.reacted {
    background-color: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 700;
    box-shadow: 0 0 8px rgba(138, 75, 255, 0.2);
}

.reaction-btn.reacted i {
    animation: scalePop 0.3s ease-out;
}

@keyframes scalePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.announcement-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    transition: color var(--transition-fast);
    padding: 4px;
}

.announcement-delete-btn:hover {
    color: var(--danger);
}

/* --- RESPONSIVE STUDENT REGISTRATION ROWS --- */
.student-course-row {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}
.student-course-row select,
.student-course-row input {
    width: 100%;
    min-width: 0;
}

@media (max-width: 500px) {
    .student-course-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 12px;
    }
    .student-course-row .course-instrument {
        grid-column: span 2;
    }
    .student-course-row .course-teacher {
        grid-column: span 2;
    }
    .student-course-row .course-fee {
        grid-column: span 1;
        width: 100% !important;
    }
    .student-course-row .delete {
        grid-column: span 1;
        justify-self: end;
        width: 38px;
        height: 38px;
    }
}

/* --- MOBILE TABS SUB NAVIGATION IMPROVEMENT --- */
@media (max-width: 768px) {
    .tab-sub-nav {
        display: flex !important;
        width: 100% !important;
        overflow-x: unset !important;
        white-space: normal !important;
        background: var(--bg-tertiary);
        padding: 4px;
        border-radius: var(--radius-md);
        border: 1px solid var(--border-color);
    }
    .sub-nav-btn {
        flex: 1;
        text-align: center;
        padding: 8px 6px;
        font-size: 11px;
    }
}

/* --- ESTILO MENU SIDEBAR COMPACTO / RECOLHIDO --- */
.sidebar {
    transition: width var(--transition-normal), padding var(--transition-normal);
}
.main-content {
    transition: margin-left var(--transition-normal);
}

.sidebar.collapsed {
    width: 70px;
    padding: 24px 10px;
}
.sidebar.collapsed .logo h2,
.sidebar.collapsed .menu-item span,
.sidebar.collapsed .sidebar-footer .theme-btn span,
.sidebar.collapsed .sidebar-footer .user-profile .user-info,
.sidebar.collapsed .sidebar-footer #db-status-label {
    display: none !important;
}
.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 14px 0;
}
.sidebar.collapsed .menu-item i {
    font-size: 20px;
    margin: 0;
}
.sidebar.collapsed .sidebar-footer .theme-btn {
    padding: 12px 0;
    border: none;
    background: transparent;
}
.sidebar.collapsed .sidebar-footer .user-profile {
    justify-content: center;
}
.sidebar.collapsed .logo {
    justify-content: center;
}

/* --- RESPONSIVIDADE E AJUSTES DE TELA MOBILE EXTRA --- */
@media (max-width: 480px) {
    .login-card {
        padding: 30px 16px;
    }
    .main-content {
        padding: 80px 12px 90px 12px !important;
    }
    .metrics-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    .metric-card {
        padding: 12px !important;
    }
    .metric-card .metric-label {
        font-size: 11px !important;
    }
    .metric-card h3 {
        font-size: 18px !important;
        margin: 2px 0 !important;
    }
    .metric-card .metric-trend {
        font-size: 9px !important;
    }
    .metric-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }
    .dashboard-card {
        padding: 15px !important;
    }
    .modal-card {
        width: 96% !important;
        margin: 5px !important;
    }
    .modal-body {
        padding: 16px !important;
    }
}

/* --- FILTROS DE GRÁFICOS FINANCEIROS --- */
.btn-chart-filter {
    transition: all var(--transition-fast) !important;
}
.btn-chart-filter.active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
    font-weight: 600 !important;
}



