/* ==========================================================================
   1. VARIABLES GLOBALES Y DISEÑO DE SISTEMA (UX/UI)
   ========================================================================== */
:root {
    --brand-dark: #0f172a;       /* Slate 900 - Fondos oscuros y cabeceras */
    --brand-main: #1e293b;       /* Slate 800 - Elementos secundarios */
    --accent: #0ea5e9;           /* Sky 500 - Identidad y botones principales */
    --accent-hover: #0284c7;     /* Sky 600 - Estados interactivos */
    --text-main: #334155;        /* Slate 700 - Texto de lectura principal */
    --text-muted: #64748b;       /* Slate 500 - Textos secundarios o pequeños */
    --bg-app: #f8fafc;           /* Slate 50 - Fondo general de la plataforma */
    --card-bg: #ffffff;          /* Blanco puro - Tarjetas de ejercicios */
    --card-border: #e2e8f0;      /* Slate 200 - Bordes sutiles */
    
    /* Estados de validación matemática */
    --color-exito: #10b981;      /* Esmeralda 500 */
    --bg-exito: #ecfdf5;
    --color-fallo: #ef4444;      /* Rojo 500 */
    --bg-fallo: #fef2f2;
}

/* Reset y configuraciones base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   2. CABECERA PREMIUM (APP BAR)
   ========================================================================== */
.app-bar {
    background-color: var(--brand-dark);
    color: #ffffff;
    height: 70px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.brand {
    font-size: 1.4rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.5px;
}

.brand span {
    color: var(--accent);
}

.animate-logo {
    color: var(--accent);
    animation: pulse 3s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.curso-info-tag {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.header-right-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.score-pill {
    background: linear-gradient(135deg, #f59e0b, #d97706); /* Oro */
    color: #ffffff;
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(217, 119, 6, 0.3);
}

/* ==========================================================================
   3. ARQUITECTURA DE CONTENEDORES (LAYOUT)
   ========================================================================== */
.layout-main {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    flex: 1;
}

/* Barra Lateral (Sidebar) */
.sidebar-wrapper {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 95px;
}

.sidebar-wrapper h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

#menu-temas-lateral {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.sidebar-btn {
    width: 100%;
    background: none;
    border: none;
    padding: 0.85rem 1rem;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
}

.sidebar-btn i {
    width: 20px;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.sidebar-btn:hover {
    background-color: var(--bg-app);
    color: var(--accent);
}

.sidebar-btn:hover i {
    color: var(--accent);
}

.sidebar-btn.active {
    background-color: #e0f2fe; /* Light sky blue */
    color: var(--accent-hover);
}

.sidebar-btn.active i {
    color: var(--accent-hover);
}

.btn-volver-home {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.8rem;
    background-color: #f1f5f9;
    color: var(--brand-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 10px;
    margin-top: 1rem;
    border: 1px solid var(--card-border);
    transition: background 0.2s;
}

.btn-volver-home:hover {
    background-color: #e2e8f0;
}

/* Workspace Central */
.workspace-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ==========================================================================
   4. BLOQUES DIDÁCTICOS Y TARJETAS DE EJERCICIOS
   ========================================================================== */
/* Panel de Guía / Ejemplo */
.panel-guia-didactica {
    background-color: #fafafa;
    border-left: 4px solid var(--accent);
    border-radius: 4px 12px 12px 4px;
    padding: 1.5rem;
    border: 1px solid var(--card-border);
    border-left-width: 5px;
}

.header-panel {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--brand-dark);
    margin-bottom: 0.75rem;
}

.text-accent {
    color: var(--accent);
}

.badge-resolucion {
    display: inline-block;
    background-color: #e2e8f0;
    color: var(--brand-main);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    text-transform: uppercase;
}

/* Contenedor de Ejercicios */
.contenedor-ejercicios-dinamicos {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.card-problema-nueva {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1.75rem;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.card-problema-nueva:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

.numero-indicador {
    position: absolute;
    top: 1.25rem;
    left: -12px;
    background-color: var(--brand-main);
    color: #ffffff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.texto-pregunta {
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--brand-dark);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.texto-pregunta b {
    color: #000000;
    font-size: 1.25rem;
    background-color: #f8fafc;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    border: 1px dashed #cbd5e1;
}

.input-respuesta-nueva {
    width: 100%;
    max-width: 300px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--card-border);
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    outline: none;
    transition: all 0.2s ease;
}

.input-respuesta-nueva:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

/* Clases dinámicas de corrección (Éxito y Fallo) */
.card-problema-nueva.exito {
    border-color: var(--color-exito);
    background-color: var(--bg-exito);
}

.card-problema-nueva.fallo {
    border-color: var(--color-fallo);
    background-color: var(--bg-fallo);
}

.explicacion-error-oculta {
    display: none;
    margin-top: 1.25rem;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.explicacion-error-oculta.visible-exito {
    display: block;
    background-color: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.explicacion-error-oculta.visible-fallo {
    display: block;
    background-color: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ==========================================================================
   5. BOTONERAS DE ACCIÓN Y FEEDBACK GLOBAL
   ========================================================================== */
.panel-resultado-global {
    background-color: var(--brand-dark);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 14px;
    margin-top: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    animation: slideUp 0.3s ease-out;
}

.panel-resultado-global h3 {
    color: var(--accent);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

@keyframes slideUp {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.action-footer-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding-bottom: 3rem;
}

.btn-core {
    border: none;
    padding: 1rem 1.75rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-core.primary {
    background-color: var(--accent);
    color: #ffffff;
    box-shadow: 0 4px 6px rgba(14, 165, 233, 0.25);
}

.btn-core.primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-core.secondary {
    background-color: #ffffff;
    color: var(--brand-main);
    border: 2px solid var(--card-border);
}

.btn-core.secondary:hover {
    background-color: var(--bg-app);
    border-color: #cbd5e1;
}

/* ==========================================================================
   6. MONETIZACIÓN INTEGRADA (ESPACIOS ADSENSE)
   ========================================================================== */
.adsense-holder {
    background: #f1f5f9;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.ad-label {
    position: absolute;
    top: 2px;
    left: 5px;
    font-size: 0.65rem;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.ad-placeholder {
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Bloque Horizontal Superior */
.banner-top {
    max-width: 1400px;
    width: calc(100% - 4rem);
    height: 90px;
    margin: 1.5rem auto 0 auto;
}

/* Bloque Vertical Lateral */
.banner-sidebar {
    width: 100%;
    height: 250px;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   7. PIE DE PÁGINA REQUERIDO (FOOTER LEGAL)
   ========================================================================== */
.main-footer {
    background-color: var(--brand-dark);
    color: #94a3b8;
    padding: 2.5rem 2rem;
    text-align: center;
    margin-top: auto;
    border-top: 1px solid #1e293b;
    font-size: 0.9rem;
}

.footer-links {
    margin-top: 0.75rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.footer-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ==========================================================================
   8. RESPONSIVIDAD (DISEÑO MÓVIL ADAPTATIVO)
   ========================================================================== */
@media (max-width: 968px) {
    .layout-main {
        grid-template-columns: 1fr; /* Una sola columna en tablets y móviles */
        padding: 1rem;
        gap: 1.5rem;
    }

    .sidebar-wrapper {
        position: static;
        width: 100%;
    }

    .banner-top {
        width: calc(100% - 2rem);
        margin-top: 1rem;
    }
}

@media (max-width: 480px) {
    .app-bar {
        padding: 0 1rem;
    }
    
    .brand {
        font-size: 1.2rem;
    }

    .curso-info-tag {
        display: none; /* Se oculta en pantallas mini para evitar colapsos */
    }

    .action-footer-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-core {
        justify-content: center;
    }
    
    .input-respuesta-nueva {
        max-width: 100%;
    }
.navbar-plataforma {
    display: flex; /* Esto pone el logo y el botón en la misma línea */
    justify-content: space-between; /* Esto empuja el logo a la izquierda y el botón a la derecha */
    align-items: center; /* Esto los centra verticalmente */
    padding: 10px 20px;
}

#clerk-container {
    margin-left: auto; /* Esto garantiza que el botón se pegue a la derecha */
}
:root { --bg-tarjeta: #131c2e; --color-premium: #f59e0b; }

.dashboard-resumen {
    background: var(--bg-tarjeta);
    border: 1px solid var(--color-premium);
    border-radius: 16px;
    padding: 20px;
    margin: 20px auto;
    max-width: 800px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.tarjeta-material {
    background: var(--bg-tarjeta);
    padding: 20px;
    border-radius: 12px;
    margin: 10px;
    display: inline-block;
    width: 300px;
    color: white;
}

.btn-check {
    background: transparent;
    border: 1px solid #94a3b8;
    color: #94a3b8;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    margin-top: 10px;
}

.btn-check:hover { background: var(--color-premium); color: #000; }