/* ==========================================================================
   CODEACADEMY LMS - SISTEMA DE DISEÑO PREMIUM (DARK MODE & GLASSMORPHISM)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bg-main: #090d16;
    --bg-surface: #0f172a;
    --bg-card: rgba(17, 24, 39, 0.75);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(99, 102, 241, 0.5);

    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.25);
    
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #64748b;

    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(15, 23, 42, 0.6) 0px, transparent 100%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* Tipografía y Enlaces */
a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: #a5b4fc;
}

/* NAVBAR HEADER */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(9, 13, 22, 0.8);
    border-bottom: 1px solid var(--border-subtle);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.25rem;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav-link {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent-emerald));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

/* CONTENEDOR GENERAL */
.main-wrapper {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

/* BOTONES */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.35rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #ffffff;
    box-shadow: 0 4px 18px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
    color: #ffffff;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-main);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-emerald), #059669);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
    color: #ffffff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-rose), #e11d48);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.25);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.35);
    color: #ffffff;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.85rem 2rem;
    font-size: 1.05rem;
    border-radius: var(--radius-md);
}

/* TARJETAS Y CONTENEDORES GLASS */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* HERO SECTION (LANDING) */
.hero {
    text-align: center;
    padding: 4.5rem 1rem 3rem;
    max-width: 860px;
    margin: 0 auto;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-light);
    border: 1px solid rgba(99, 102, 241, 0.25);
    margin-bottom: 1.5rem;
}

.hero-title {
    font-size: 3.25rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
}

.hero-title .gradient-text {
    background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 50%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2.25rem;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 3.5rem;
}

/* CURSO TEMARIO EN CARDS */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.week-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform var(--transition-smooth), border-color var(--transition-smooth);
}

.week-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-focus);
}

.week-badge {
    align-self: flex-start;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-full);
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
    margin-bottom: 1rem;
}

.week-card.completed .week-badge {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
}

.week-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: var(--text-main);
}

.week-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    flex: 1;
}

/* FORMULARIOS DE LOGIN / REGISTRO */
.auth-box {
    max-width: 440px;
    margin: 3rem auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.form-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(15, 23, 42, 0.9);
}

/* ALERTAS Y MENSAJES */
.alert {
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-error {
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fda4af;
}

.alert-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

/* PROGRESS BAR */
.progress-container {
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-full);
    height: 10px;
    overflow: hidden;
    margin: 1rem 0;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
    border-radius: var(--radius-full);
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* LECCIÓN Y CONTENIDO MARKDOWN */
.lesson-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

.lesson-sidebar {
    position: sticky;
    top: 5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.lesson-nav-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.lesson-nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.lesson-nav-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.lesson-nav-item.active a {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
    font-weight: 600;
}

.lesson-nav-item a:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
}

/* RENDER MARKDOWN ESTILOS */
.markdown-body {
    color: #e2e8f0;
    font-size: 1.05rem;
    line-height: 1.8;
}

.markdown-body .md-h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 1.5rem;
    line-height: 1.25;
}

.markdown-body .md-h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.5rem;
}

.markdown-body .md-h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #e2e8f0;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.markdown-body .md-p {
    margin-bottom: 1.25rem;
}

.markdown-body .md-list, .markdown-body .md-ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.markdown-body .md-list-item, .markdown-body .md-ol-item {
    margin-bottom: 0.5rem;
}

.markdown-body .md-blockquote {
    border-left: 4px solid var(--primary);
    padding: 0.75rem 1.25rem;
    background: rgba(99, 102, 241, 0.06);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 1.5rem;
    font-style: italic;
    color: var(--text-muted);
}

.markdown-body .inline-code {
    background: rgba(255, 255, 255, 0.08);
    color: #a5b4fc;
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 0.2em 0.45em;
    border-radius: 4px;
}

/* BLOQUE DE CÓDIGO */
.code-block-wrapper {
    margin: 1.5rem 0;
    background: #060911;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.75rem;
    color: var(--text-dark);
}

.code-lang {
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-weight: 600;
    color: var(--primary-light);
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.copy-btn:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

.code-container {
    padding: 1.25rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.92rem;
    line-height: 1.6;
    color: #f1f5f9;
}

/* TABLAS MARKDOWN */
.table-responsive {
    overflow-x: auto;
    margin: 1.5rem 0;
}

.markdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.markdown-table th, .markdown-table td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-subtle);
    text-align: left;
}

.markdown-table th {
    background: rgba(255, 255, 255, 0.04);
    font-weight: 700;
    color: #ffffff;
}

.markdown-table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}

/* CONSOLA INTERACTIVA SQL */
.sql-console {
    background: #090e1a;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 1.5rem;
}

.sql-header {
    background: #0c1424;
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
}

.sql-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-cyan);
}

.sql-editor {
    width: 100%;
    min-height: 120px;
    background: #090e1a;
    border: none;
    padding: 1rem 1.25rem;
    color: #f8fafc;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
}

.sql-editor:focus {
    outline: none;
}

.sql-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: #0c1424;
    border-top: 1px solid var(--border-subtle);
}

.sql-results-box {
    margin-top: 1rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    background: #090e1a;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

.results-table th {
    background: #0f1c30;
    color: var(--text-main);
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
}

.results-table td {
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
}

/* PREGUNTAS DE OPCIÓN MÚLTIPLE */
.quiz-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.quiz-question {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.quiz-option-label {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.quiz-option-label:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.2);
}

.quiz-option-label input[type="radio"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
}

/* FOOTER */
.footer {
    border-top: 1px solid var(--border-subtle);
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-dark);
    margin-top: 4rem;
}

/* ==========================================================================
   OPTIMIZACIONES MÓVILES (MOBILE-FIRST UX/UI ENHANCEMENTS)
   ========================================================================== */

/* Barra de Chips Rápidos de SQL para Móviles */
.sql-chips-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    overflow-x: auto;
    white-space: nowrap;
    padding: 0.5rem 0.75rem;
    background: #080d19;
    border-bottom: 1px solid var(--border-subtle);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}
.sql-chips-bar::-webkit-scrollbar {
    display: none; /* Safari/Chrome */
}

.sql-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 600;
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.sql-chip:active {
    transform: scale(0.95);
    background: rgba(99, 102, 241, 0.25);
    color: #ffffff;
}

/* Tabla con Desplazamiento Táctil Fluido */
.table-scroll-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
}

.table-scroll-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.75rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid var(--border-subtle);
}

/* Media Queries Responsivas */
@media (max-width: 768px) {
    .navbar {
        padding: 0.75rem 1rem;
    }
    .main-wrapper {
        padding: 1.25rem 0.75rem;
    }
    .auth-box {
        margin: 1.25rem auto;
        padding: 1.75rem 1.25rem;
        border-radius: var(--radius-md);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    }
    .hero {
        padding: 2.5rem 0.5rem 2rem;
    }
    .hero-title {
        font-size: 2.15rem;
        line-height: 1.18;
    }
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.75rem;
    }
    .glass-card {
        padding: 1.25rem;
        border-radius: 14px;
    }
    .quiz-card {
        padding: 1.25rem;
    }
    .quiz-option-label {
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
        min-height: 48px; /* Tap target óptimo para dedos */
    }
    /* Prevenir zoom automático en Safari iOS en inputs y textareas */
    .form-input, .sql-editor, textarea, input[type="text"], input[type="email"], input[type="password"] {
        font-size: 16px !important;
    }
    .btn {
        min-height: 44px; /* Touch friendly */
    }
    .lesson-layout {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    .lesson-sidebar {
        position: static;
        margin-bottom: 1.5rem;
    }
}

@media (min-width: 769px) {
    .navbar {
        padding: 1rem 2rem;
    }
    .main-wrapper {
        padding: 2.5rem 1.5rem;
    }
}

