/* ==============================================================================
   AISIGNATURAS - SISTEMA DE DISEÑO ULTRA-PREMIUM (DARK GLASSMORPHISM)
   ============================================================================== */

:root {
    --bg-dark: #070b14;
    --bg-surface: #0e1526;
    --bg-card: rgba(18, 26, 47, 0.72);
    --bg-card-hover: rgba(26, 38, 68, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.03);
    
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(99, 102, 241, 0.35);
    
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-gradient: linear-gradient(135deg, #3b82f6, #6366f1);
    --survival-gradient: linear-gradient(135deg, #f59e0b, #ec4899);
    --success-gradient: linear-gradient(135deg, #10b981, #059669);
    
    --accent-blue: #38bdf8;
    --accent-green: #34d399;
    --accent-amber: #fbbf24;
    --accent-rose: #f43f5e;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
    --shadow-glow-survival: 0 0 25px rgba(245, 158, 11, 0.3);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(99, 102, 241, 0.06) 0%, transparent 40%);
    background-attachment: fixed;
}

/* ==============================================================================
   PANTALLA DE AUTENTICACIÓN
   ============================================================================== */

.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    animation: fadeIn 0.4s ease-out;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo {
    width: 60px;
    height: 60px;
    line-height: 60px;
    border-radius: 16px;
    background: var(--primary-gradient);
    font-size: 30px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 14px;
    box-shadow: var(--shadow-glow);
}

.auth-header h2 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #fff;
}

.auth-header p {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

.auth-alert-box {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 20px;
    display: none;
}
.auth-alert-box.error {
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fda4af;
}

.auth-form {
    display: none;
}
.auth-form.active {
    display: block;
}
.auth-form h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #f1f5f9;
}

.input-group {
    margin-bottom: 18px;
}
.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-wrapper i {
    position: absolute;
    left: 14px;
    font-size: 18px;
    color: var(--text-dim);
}
.input-wrapper input,
.input-wrapper select,
.custom-input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: rgba(11, 16, 32, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 14.5px;
    outline: none;
    transition: var(--transition-fast);
}
.custom-input.no-icon {
    padding-left: 14px;
}
.input-wrapper input:focus,
.custom-input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.auth-switch {
    text-align: center;
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: 20px;
}
.auth-switch a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
}
.auth-switch a:hover {
    text-decoration: underline;
}

/* ==============================================================================
   CONTENEDOR PRINCIPAL Y NAVBAR
   ============================================================================== */

.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 32px;
    background: rgba(7, 11, 20, 0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
}

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

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-glow);
}

.brand-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #fff;
}
.brand-title span {
    color: var(--accent-blue);
}

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

.user-email-chip {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    padding: 6px 14px;
    border-radius: var(--radius-full);
}

/* ==============================================================================
   BOTONES Y ELEMENTOS DE ACCIÓN
   ============================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition-fast);
    text-decoration: none;
}
.btn:active {
    transform: scale(0.98);
}
.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35);
}
.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
    filter: brightness(1.05);
}
.btn-survival {
    background: var(--survival-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
}
.btn-survival:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
    filter: brightness(1.08);
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.07);
    color: #f1f5f9;
    border: 1px solid var(--border-subtle);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
}
.btn-danger-outline {
    background: transparent;
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.35);
}
.btn-danger-outline:hover {
    background: rgba(244, 63, 94, 0.12);
}
.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}
.btn-xs {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 6px;
}
.btn-icon-ghost {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.btn-icon-ghost:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* ==============================================================================
   FILTROS Y BARRA DE CONTROL DEL DASHBOARD
   ============================================================================== */

.main-content {
    max-width: 1360px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 24px 80px 24px;
}

.dashboard-toolbar {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px 22px;
    margin-bottom: 28px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 240px;
    max-width: 380px;
}
.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--text-dim);
}
.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background: rgba(7, 11, 20, 0.7);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: #fff;
    font-size: 13.5px;
    outline: none;
}
.search-box input:focus {
    border-color: var(--primary-light);
}

.filter-pills-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.filter-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 7px 14px;
    border-radius: var(--radius-full);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-fast);
}
.filter-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.filter-pill.active {
    background: var(--primary);
    border-color: var(--primary-light);
    color: #fff;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

/* ==============================================================================
   TARJETAS DE ASIGNATURAS (GRID)
   ============================================================================== */

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 22px;
}

.subject-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}
.subject-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
    background: var(--bg-card-hover);
}
.subject-card.is-hidden-card {
    opacity: 0.65;
    border-style: dashed;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.card-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pill-badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.pill-course {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}
.pill-sem {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.25);
}
.pill-year {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
}

.subject-title {
    font-size: 18.5px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 14px;
    cursor: pointer;
    transition: var(--transition-fast);
}
.subject-title:hover {
    color: var(--accent-blue);
}

.score-banner {
    background: rgba(11, 16, 32, 0.65);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.score-label {
    font-size: 11.5px;
    color: var(--text-dim);
    text-transform: uppercase;
    font-weight: 600;
}
.score-value-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
}
.score-number {
    font-size: 26px;
    font-weight: 800;
}
.score-number.badge-score-good {
    color: var(--accent-green);
}
.score-number.badge-score-mid {
    color: var(--accent-amber);
}
.score-number.badge-score-bad {
    color: var(--accent-rose);
}
.score-max {
    font-size: 13px;
    color: var(--text-dim);
}

.eval-progress-container {
    text-align: right;
    min-width: 100px;
}
.eval-progress-label {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
}
.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.blocks-mini-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}
.block-mini-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    padding: 4px 8px;
    border-radius: 6px;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    display: inline-block;
}
.status-dot.dot-complete { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.status-dot.dot-pending { background: var(--accent-amber); }
.status-dot.dot-danger { background: var(--accent-rose); }

.no-blocks-hint {
    font-size: 12.5px;
    color: var(--text-dim);
    font-style: italic;
    padding: 6px 0;
}

.card-footer {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
}
.card-footer .btn {
    flex: 1;
}

/* ==============================================================================
   MODALES (ESTRUCTURA GENERAL)
   ============================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 7, 18, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    position: relative;
    animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card.modal-lg {
    max-width: 860px;
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}
.modal-close-btn:hover {
    background: rgba(244, 63, 94, 0.2);
    color: var(--accent-rose);
}

/* ==============================================================================
   DETALLE DE ASIGNATURA Y BLOQUES
   ============================================================================== */

.modal-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}
.modal-detail-sub {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

.convocatorias-tabs-bar {
    display: flex;
    gap: 8px;
    background: rgba(11, 16, 32, 0.8);
    padding: 6px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}
.conv-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-fast);
}
.conv-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.weight-warning-alert {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fde68a;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}
.weight-ok-badge {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.blocks-container-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.blocks-container-header h3 {
    font-size: 17px;
    font-weight: 600;
}

.block-card {
    background: rgba(11, 16, 32, 0.7);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 16px;
}
.block-card.block-card-danger {
    border-color: rgba(244, 63, 94, 0.4);
    background: rgba(244, 63, 94, 0.04);
}

.block-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.block-title-group h4 {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}
.block-meta-chips {
    display: flex;
    gap: 6px;
}
.badge-chip {
    font-size: 12px;
    background: rgba(255, 255, 255, 0.06);
    padding: 3px 8px;
    border-radius: 6px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.block-score-stats {
    display: flex;
    gap: 14px;
    font-size: 13px;
    margin-bottom: 14px;
    background: rgba(255, 255, 255, 0.02);
    padding: 8px 12px;
    border-radius: 6px;
}
.stat-pill strong {
    margin-left: 4px;
}
.stat-pill-warning {
    color: var(--accent-amber);
    margin-left: auto;
    font-weight: 500;
}

.block-grades-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.block-grades-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.grade-chip {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border-subtle);
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.grade-chip-value {
    color: var(--accent-blue);
}
.grade-chip-del {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    cursor: pointer;
}
.grade-chip-del:hover {
    color: var(--accent-rose);
}
.no-grades-text {
    font-size: 13px;
    color: var(--text-dim);
    font-style: italic;
}

/* ==============================================================================
   MODAL SUPERVIVENCIA
   ============================================================================== */

.survival-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.survival-status-banner {
    padding: 18px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.survival-status-banner i {
    font-size: 28px;
}
.survival-status-banner.status-banner-success {
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #a7f3d0;
}
.survival-status-banner.status-banner-danger {
    background: rgba(244, 63, 94, 0.14);
    border: 1px solid rgba(244, 63, 94, 0.35);
    color: #fecdd3;
}
.survival-status-banner.status-banner-warning {
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fef08a;
}
.survival-status-banner.status-banner-info {
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #bae6fd;
}
.banner-msg {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 8px;
}
.banner-fixed-score {
    font-size: 13.5px;
    opacity: 0.9;
}

.survival-options-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.survival-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.survival-option-card {
    background: rgba(11, 16, 32, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.survival-option-card:hover {
    border-color: var(--accent-amber);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
}
.option-number {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-amber);
}
.option-header h5 {
    font-size: 14.5px;
    font-weight: 600;
    color: #fff;
    margin: 2px 0 8px 0;
}
.option-desc {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 12px;
}
.option-breakdown {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 6px;
}
.option-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin-bottom: 4px;
}
.required-grade {
    color: #67e8f9;
    font-size: 14px;
}

/* ==============================================================================
   ASISTENTE IA FLOTANTE (COPILOT)
   ============================================================================== */

.chat-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-gradient);
    border: none;
    color: #fff;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.45);
    cursor: pointer;
    z-index: 90;
    transition: var(--transition-normal);
    animation: pulseFab 2.5s infinite;
}
.chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.6);
}

.chat-drawer {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 400px;
    height: 580px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: none;
    flex-direction: column;
    z-index: 95;
    overflow: hidden;
    animation: drawerUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.chat-drawer.open {
    display: flex;
}

.chat-header {
    padding: 16px 20px;
    background: rgba(11, 16, 32, 0.95);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-title-group h4 {
    font-size: 15px;
    font-weight: 700;
}
.chat-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    display: flex;
}
.chat-msg.msg-user {
    justify-content: flex-end;
}
.chat-msg.msg-bot {
    justify-content: flex-start;
}

.msg-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
}
.msg-user .msg-bubble {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.msg-bot .msg-bubble {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: #e2e8f0;
    border-bottom-left-radius: 4px;
}
.bot-avatar-icon {
    margin-right: 6px;
    color: var(--accent-blue);
    font-size: 16px;
}

.chat-welcome {
    text-align: center;
    padding: 24px 12px;
}
.chat-welcome i {
    font-size: 40px;
    color: var(--primary-light);
    margin-bottom: 10px;
}
.chat-welcome h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}
.chat-welcome p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.chat-chips {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.chip-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    color: var(--accent-blue);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    text-align: left;
    cursor: pointer;
    transition: var(--transition-fast);
}
.chip-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.chat-input-bar {
    padding: 12px 16px;
    background: rgba(11, 16, 32, 0.95);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 8px;
}
.chat-input-bar input {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 10px 16px;
    color: #fff;
    font-size: 13.5px;
    outline: none;
}
.chat-input-bar input:focus {
    border-color: var(--primary-light);
}

/* ==============================================================================
   NOTIFICACIONES TOAST
   ============================================================================== */

.toast-notification {
    position: fixed;
    top: 24px;
    right: 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transform: translateY(-15px);
    transition: var(--transition-normal);
}
.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}
.toast-notification.success { border-color: rgba(16, 185, 129, 0.5); }
.toast-notification.success i { color: var(--accent-green); }
.toast-notification.error { border-color: rgba(244, 63, 94, 0.5); }
.toast-notification.error i { color: var(--accent-rose); }
.toast-notification.info i { color: var(--accent-blue); }

/* ==============================================================================
   ANIMACIONES
   ============================================================================== */

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

@keyframes modalScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

@keyframes pulseFab {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
    70% { box-shadow: 0 0 0 15px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* ==============================================================================
   RESPONSIVE DESIGN (MÓVIL Y TABLET)
   ============================================================================== */

@media (max-width: 768px) {
    .navbar {
        padding: 12px 16px;
    }
    .user-email-chip {
        display: none;
    }
    .main-content {
        padding: 16px 14px 90px 14px;
    }
    .dashboard-toolbar {
        padding: 14px;
    }
    .subjects-grid {
        grid-template-columns: 1fr;
    }
    .chat-drawer {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 96px;
        height: 70vh;
    }
}

/* ==============================================================================
   BANNER FLOTANTE DE ACTUALIZACIÓN DE APK NATIVA
   ============================================================================== */

.app-update-banner {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #0f172a, #1e1b4b);
    border-bottom: 2px solid var(--primary-light);
    color: #fff;
    padding: 10px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.3s ease-out;
}

.update-banner-content {
    max-width: 1360px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.update-banner-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
}
.update-banner-info i {
    font-size: 22px;
    color: var(--accent-blue);
}

.update-banner-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-update-apk {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: #fff;
    border: none;
    padding: 6px 18px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(6, 182, 212, 0.4);
    transition: var(--transition-fast);
}
.btn-update-apk:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.close-banner-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}
.close-banner-btn:hover {
    color: #fff;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

