/* Base Reset & Variables */
:root {
    --bg-dark: #07090f;
    --bg-surface: rgba(20, 24, 38, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    
    --accent-primary: #3b82f6;
    --accent-primary-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.5);
    
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.4);
    --success: #10b981;
    --warning: #f59e0b;
    
    --font-main: 'Inter', sans-serif;
    --radius-md: 12px;
    --radius-lg: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Ambient Background (Blobs) */
.ambient-bg {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out alternate;
}

.blob-1 {
    top: -10%; left: -10%;
    width: 50vw; height: 50vw;
    background: radial-gradient(circle, #3b82f644 0%, transparent 70%);
}

.blob-2 {
    bottom: -20%; right: -10%;
    width: 60vw; height: 60vw;
    background: radial-gradient(circle, #8b5cf633 0%, transparent 70%);
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5%, 10%) scale(1.1); }
}

/* Utils */
.hidden { display: none !important; }
.screen {
    min-height: 100vh;
    transition: opacity 0.5s ease;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* --- AUTH SCREEN --- */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 3rem 2rem;
    text-align: center;
}

.auth-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2.5rem;
}

.input-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    box-shadow: 0 0 15px var(--accent-glow);
}

.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.75rem;
    border-radius: 8px;
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

.spinner.large {
    width: 40px; height: 40px;
    border-width: 3px;
    border-top-color: var(--accent-primary);
}

@keyframes spin { 
    to { transform: rotate(360deg); } 
}

/* --- DASHBOARD SCREEN --- */
.glass-header {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-brand h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.badge {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.avatar {
    width: 32px; height: 32px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 600;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--glass-highlight);
}

.dashboard-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.dash-loader {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    height: 400px; gap: 1rem;
    color: var(--text-secondary);
}

.hidden {
    display: none !important;
}

/* Sections */
.filters-section {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.premium-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    outline: none;
    min-width: 200px;
}

.premium-select:focus {
    border-color: var(--accent-primary);
}

.premium-select option {
    background: var(--bg-dark);
}

.kpis-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    padding: 1.5rem;
    display: flex; flex-direction: column; gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute; top: 0; left: 0; width: 4px; height: 100%;
    background: var(--glass-highlight);
}

.kpi-card.accent::before { background: var(--accent-primary); }
.kpi-card.warning::before { background: var(--warning); }
.kpi-card.success::before { background: var(--success); }

.kpi-title {
    color: var(--text-secondary);
    font-size: 0.9rem; font-weight: 500;
}

.kpi-value {
    font-size: 2.5rem; font-weight: 700;
}

/* Table */
.table-section {
    padding: 1.5rem;
    border-radius: var(--radius-md);
}

.table-header h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

th {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.active { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.status-badge.inactive { background: rgba(148, 163, 184, 0.15); color: var(--text-secondary); }

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(0,0,0,0.3);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}
.progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.progress-bar.blue { background: var(--accent-primary); }
.progress-bar.green { background: var(--success); box-shadow: 0 0 10px rgba(16, 185, 129, 0.5); }
.progress-bar.orange { background: var(--warning); box-shadow: 0 0 10px rgba(245, 158, 11, 0.5); }
.progress-bar.red { background: var(--danger); box-shadow: 0 0 10px rgba(239, 68, 68, 0.5); }

/* Responsividade */
@media (max-width: 768px) {
    .glass-header { padding: 1rem; flex-direction: column; gap: 1rem; }
    .header-actions { width: 100%; justify-content: space-between; }
    .dashboard-content { padding: 1rem; }
    .auth-container { padding: 2rem 1.5rem; }
}

/* --- CLICKABLE NAME --- */
.clickable-name {
    cursor: pointer;
    color: #60a5fa;
    transition: color 0.2s ease, text-decoration 0.2s ease;
    display: inline-block;
}

.clickable-name:hover {
    color: #93c5fd;
    text-decoration: underline;
}

/* --- MODAL DETALHES DO ALUNO --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 10, 18, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

.modal-content {
    width: 90%;
    max-width: 480px;
    background: rgba(18, 22, 35, 0.85);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 0.25rem;
    line-height: 0.8;
}

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

.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 0.75rem;
}

.info-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.info-value {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: right;
}

.info-value.highlighted {
    color: #38bdf8;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.modal-note {
    background: rgba(56, 189, 248, 0.05);
    border: 1px solid rgba(56, 189, 248, 0.1);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: #93c5fd;
    line-height: 1.4;
    margin-top: 0.5rem;
}

.btn-evo-ficha {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--accent-primary), #0d9488);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 15px rgba(20, 184, 166, 0.25);
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    width: 80%;
    margin: 0 auto;
}

.btn-evo-ficha:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(20, 184, 166, 0.45);
    background: linear-gradient(135deg, #0d9488, var(--accent-primary));
}

.btn-evo-ficha svg {
    transition: transform 0.3s ease;
}

.btn-evo-ficha:hover svg {
    transform: translate(2px, -2px);
}

.animate-fade-in {
    animation: fadeInModal 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Animação para rotação do ícone de atualização manual */
.spinning {
    animation: spin 0.8s linear infinite !important;
}
