/* ============================================================
   CAT STUDY QUIZ — css/desktop.css (FIXED v3.0)
   Diseño de escritorio corregido: ocupa toda la pantalla, sin errores
   en modo claro, sin elementos fuera de lugar.
   ============================================================ */

/* ── TABLET (600px en adelante) ─────────────────────────────────────── */
@media (min-width: 600px) {
    #app-container {
        max-width: 600px;
    }

    #themes-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        align-content: start;
    }

    #quiz-themes-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .theme-card, .quiz-theme-card {
        margin-bottom: 0;
    }

    .card {
        padding: 18px 20px;
    }

    header {
        padding: 0 20px;
    }

    .bottom-nav {
        padding: 10px 0 12px;
    }
}

/* ── DESKTOP / LAPTOP (1024px en adelante) ──────────────────────────── */
@media (min-width: 1024px) {
    /* 
       FIX: Ahora ocupa toda la pantalla disponible
       ANTES: Contenedor centrado con max-width fijo
       AHORA: Contenedor que ocupa todo el espacio después del menú
    */
    body {
        display: flex;
        background: var(--paper2);
        min-height: 100vh;
        margin: 0;
        padding: 0;
    }

    /* 
       FIX: Asegurar compatibilidad con modo claro
       Las variables CSS ya están definidas en mobile.css para ambos modos
    */
    [data-theme="light"] body {
        background: var(--paper2);
    }

    #app-container {
        flex: 1;
        margin-left: 100px;
        margin-right: 0;
        max-width: none;
        min-height: 100vh;
        background: var(--surface);
        border: none;
        box-shadow: none;
        animation: fadeIn 0.3s ease-out;
    }

    [data-theme="light"] #app-container {
        background: var(--surface);
    }

    /* 
       FIX: Menú lateral más compacto y funcional
       ANTES: Menú con efectos excesivos que causaban problemas
       AHORA: Menú limpio con glass effect moderado
    */
    .bottom-nav {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 100px;
        height: 100vh;
        transform: none;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        gap: 24px;
        padding-top: 40px;
        border-top: none;
        border-right: 1px solid var(--border);
        background: var(--glass-strong-nav);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 1000;
    }

    .nav-item {
        flex-direction: column;
        padding: 12px 16px;
        border-radius: var(--r-lg);
        transition: all 0.2s ease;
        position: relative;
    }

    .nav-item:hover {
        background: var(--surface2);
        transform: translateY(-2px);
    }

    .nav-item.active {
        background: var(--green-dim);
        color: var(--green);
    }

    .nav-item svg {
        width: 24px;
        height: 24px;
    }

    .nav-item::after {
        display: none;
    }

    /* 
       FIX: Header simple sin efectos excesivos
    */
    header {
        padding: 0 24px;
        height: 64px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
    }

    .logo {
        font-size: 1.1rem;
        color: var(--text);
    }

    /* 
       FIX: Tarjetas con glass effect moderado
       ANTES: Efectos excesivos causaban problemas de layout
       AHORA: Glass effect sutil y funcional
    */
    .card {
        padding: 20px 24px;
        margin-bottom: 16px;
        background: var(--surface2);
        border: 1px solid var(--border);
        border-radius: var(--r-xl);
        box-shadow: var(--shadow-md);
        transition: all 0.2s ease;
    }

    .card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }

    /* 
       FIX: Theme cards sin efectos excesivos
    */
    .theme-card, .quiz-theme-card {
        background: var(--surface2);
        border: 1px solid var(--border);
        transition: all 0.2s ease;
    }

    .theme-card:hover,
    .quiz-theme-card:hover {
        transform: translateY(-2px);
        border-color: var(--green);
        box-shadow: var(--shadow-md);
    }

    /* 
       FIX: Grid que aprovecha el espacio disponible
       ANTES: Grid fijo de 2 columnas
       AHORA: Grid adaptable con más columnas en pantallas grandes
    */
    #themes-list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
    }

    #quiz-themes-list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
    }

    /* 
       FIX: Quiz card sin efectos excesivos
    */
    #quiz-question-card {
        padding: 24px;
        background: var(--surface2);
        border: 1px solid var(--border);
        border-radius: var(--r-xl);
        box-shadow: var(--shadow-md);
    }

    .canvas-container {
        max-height: 420px;
        aspect-ratio: 4 / 3;
        border: 1px solid var(--border);
        border-radius: var(--r-xl);
        overflow: hidden;
    }

    /* 
       FIX: Stats boxes simples
    */
    .stats-grid {
        gap: 12px;
    }

    .stat-box {
        padding: 14px 12px;
        background: var(--surface2);
        border: 1px solid var(--border);
        border-radius: var(--r-lg);
        transition: all 0.2s ease;
    }

    .stat-box:hover {
        background: var(--surface3);
    }

    .stat-box span {
        font-size: 1.4rem;
    }

    /* 
       FIX: Botones de comodines
    */
    .comodin-grid {
        gap: 10px;
    }

    .btn-comodin {
        padding: 12px 8px;
        min-height: 70px;
        font-size: 0.7rem;
        background: var(--surface2);
        border: 1px solid var(--border);
        border-radius: var(--r-lg);
        transition: all 0.2s ease;
    }

    .btn-comodin:hover:not(:disabled) {
        background: var(--surface3);
        border-color: var(--blue);
    }

    .btn-comodin:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

    /* 
       FIX: Panel de settings sin max-width restrictivo
       FIX: Margen mínimo en lugar de padding excesivo
       FIX: Rediseñar contenedor de pestañas para desktop
       FIX: Rediseñar vista Añadir para desktop
    */
    #view-settings {
        padding-bottom: 3px !important;
    }

    #view-upload {
        padding-bottom: 3px !important;
    }

    #view-home {
        padding-bottom: 3px !important;
    }

    #view-quiz {
        padding-bottom: 3px !important;
    }

    #view-topic {
        padding-bottom: 3px !important;
    }

    /* Botón Volver al Inicio en vista quiz */
    #quiz-select-topic button {
        margin-bottom: 3px !important;
    }

    /* Sobrescribir padding-bottom de quiz-select-topic en desktop */
    #quiz-select-topic {
        padding-bottom: 0 !important;
    }

    #view-settings .panel-scroll > div {
        max-width: 900px;
        margin: 0 auto;
        padding: 0 24px;
    }

    /* 
       FIX: Contenedor de vista Añadir más ancho para desktop
       ANTES: max-width: 500px como móvil
       AHORA: Ocupa más espacio aprovechando el ancho disponible
    */
    #view-upload .panel-scroll > div[style*="max-width: 500px"] {
        max-width: 900px !important;
    }

    /* 
       FIX: Contenedor de pestañas más ancho para desktop
       ANTES: max-width: 500px como móvil
       AHORA: Ocupa más espacio aprovechando el ancho disponible
    */
    #view-settings .panel-scroll > div[style*="max-width: 500px"] {
        max-width: 900px !important;
    }

    /* 
       FIX: Pestañas más grandes y espaciadas en desktop
    */
    #view-settings .tab-btn {
        padding: 16px 24px !important;
        font-size: 1rem !important;
    }

    /* 
       FIX: Reducir padding inferior en vista Quiz
    */
    #quiz-game-container {
        padding-bottom: 3px !important;
    }

    /* 
       FIX: Modales con glass effect moderado
       FIX: z-index: confirm-modal debe estar debajo de custom-modal (anuncio)
    */
    .modal-overlay {
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 10000;
    }

    #confirm-modal {
        z-index: 10001;
    }

    #custom-modal {
        z-index: 10002;
    }

    .modal-box {
        max-width: 500px;
        padding: 32px 28px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--r-2xl);
        box-shadow: var(--shadow-lg);
    }

    .modal-box h2 {
        color: var(--blue);
    }

    /* 
       FIX: Toast simple
    */
    #toast-container {
        max-width: 500px;
    }

    .toast-msg {
        background: var(--surface2);
        border: 1px solid var(--border);
        box-shadow: var(--shadow-md);
    }

    /* 
       FIX: Inputs sin glass effect problemático
    */
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="file"],
    select,
    textarea {
        padding: 12px 16px;
        font-size: 0.95rem;
        background: var(--surface2);
        border: 1px solid var(--border);
        border-radius: var(--r-lg);
        transition: all 0.2s ease;
    }

    input:focus,
    select:focus,
    textarea:focus {
        border-color: var(--green);
        box-shadow: 0 0 0 3px var(--green-dim);
    }

    /* 
       FIX: Botones simples y funcionales
    */
    .btn-primary {
        background: var(--green);
        border: none;
        transition: all 0.2s ease;
    }

    .btn-primary:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
    }

    .btn-secondary {
        background: var(--surface2);
        border: 1px solid var(--border);
        transition: all 0.2s ease;
    }

    .btn-secondary:hover {
        background: var(--surface3);
        border-color: var(--blue);
    }

    /* 
       FIX: Drop zone simple
    */
    .drop-zone {
        padding: 40px 30px;
        background: var(--surface2);
        border: 2px dashed var(--border);
        border-radius: var(--r-xl);
        transition: all 0.2s ease;
    }

    .drop-zone:hover {
        border-color: var(--green);
        background: var(--surface3);
    }

    /* 
       FIX: Lista de preguntas simple
    */
    .question-item {
        margin-bottom: 10px;
    }

    .q-clickable-area {
        padding: 16px 18px;
        background: var(--surface2);
        border: 1px solid var(--border);
        border-radius: var(--r-lg);
        transition: all 0.2s ease;
    }

    .q-clickable-area:hover {
        background: var(--surface3);
        border-color: var(--green);
    }

    /* 
       FIX: Admin table simple
    */
    #contenido-admin table {
        font-size: 0.85rem;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--r-lg);
        overflow: hidden;
    }

    #contenido-admin th {
        background: var(--surface2);
        border-bottom: 2px solid var(--green);
    }

    #contenido-admin td {
        border-bottom: 1px solid var(--border-soft);
        padding: 12px 10px;
    }

    #contenido-admin tbody tr:hover {
        background: var(--surface2);
    }

    /* 
       FIX: Toggle switch simple
    */
    .toggle-slider {
        background: var(--surface3);
    }

    input:checked + .toggle-slider {
        background: var(--green);
    }

    /* 
       FIX: Ocultar navegación inferior en desktop (ya tenemos menú lateral)
    */
    .bottom-nav {
        display: flex !important;
    }

    /* Animación simple */
    @keyframes fadeIn {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }
}

/* ── PANTALLAS MUY GRANDES (1440px+) ──────────────────────────────────── */
@media (min-width: 1440px) {
    .bottom-nav {
        width: 110px;
    }

    #app-container {
        margin-left: 110px;
    }

    #themes-list,
    #quiz-themes-list {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 20px;
    }

    .canvas-container {
        max-height: 320px;
    }

    .card {
        padding: 24px 28px;
    }

    .modal-box {
        max-width: 550px;
        padding: 36px 32px;
    }
}

/* ── ULTRA WIDE (1920px+) ─────────────────────────────────────────────── */
@media (min-width: 1920px) {
    #themes-list,
    #quiz-themes-list {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}
