/**
 * Templo Digital — Portal de Revistas Digitales
 * Estética: Premium Editorial Minimalista
 * Inspirado en Apple · Linear · Vercel · Notion
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,600;0,700;0,800;1,700&family=Outfit:wght@400;500;600;700&display=swap');

/* =================================================
   MODO OSCURO (por defecto)
   Fondo negro profundo + Oro premium
================================================= */
:root {
    /* Colores principales */
    --bg-dark:      #0A0A0B;   /* Negro profundo */
    --bg-panel:     #121214;   /* Antracita superficies */
    --bg-header:    rgba(10,10,11,0.95);
    --bg-dropdown:  #121214;
    --bg-input:     #1A1A1C;
    --border-color: #27272A;   /* Bordes sutiles */

    /* Tipografía */
    --text-main:    #FAFAF9;   /* Blanco casi puro */
    --text-muted:   #D4D4D8;   /* Gris claro */
    --text-subtle:  #71717A;   /* Gris muy sutil */

    /* Acento dorado premium */
    --gold:         #C2A46A;
    --gold-light:   #D4B97E;
    --gold-dark:    #A08850;
    --gold-muted:   rgba(194,164,106,0.12);

    /* Compatibilidad con código anterior */
    --primary:      #C2A46A;
    --secondary:    #FAFAF9;
    --secondary-light: #ffffff;

    /* Estados */
    --success: #22c55e;
    --error:   #ef4444;

    /* Sombras elegantes */
    --shadow-sm:   0 1px 2px rgba(0,0,0,0.4);
    --shadow-md:   0 4px 12px rgba(0,0,0,0.35);
    --shadow-lg:   0 8px 30px rgba(0,0,0,0.45);
    --shadow-glow: var(--shadow-md);

    /* Tipografía */
    --font-titles: 'Playfair Display', Georgia, serif;
    --font-body:   'Inter', system-ui, -apple-system, sans-serif;
    --font-ui:     'Outfit', system-ui, sans-serif;

    /* Radios */
    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --radius-xl:  20px;
}

/* =================================================
   MODO CLARO
   Marfil cálido + Carbón + Oro mate
   WCAG AA:
   --text-main  #18181B sobre #F7F6F3  → ratio 16.2:1 ✅
   --text-muted #52525B sobre #F7F6F3  → ratio  6.8:1 ✅
   --gold       #B89A5B sobre #ffffff  → ratio  3.1:1 (decorativo)
================================================= */
:root[data-theme="light"] {
    --bg-dark:      #F7F6F3;   /* Marfil cálido */
    --bg-panel:     #FFFFFF;   /* Blanco puro superficies */
    --bg-header:    rgba(247,246,243,0.97);
    --bg-dropdown:  #FFFFFF;
    --bg-input:     #FFFFFF;
    --border-color: #E6E2DA;   /* Borde suave cálido */

    --text-main:    #18181B;   /* Negro carbón */
    --text-muted:   #52525B;   /* Gris oscuro */
    --text-subtle:  #A1A1AA;   /* Gris claro */

    --gold:         #B89A5B;   /* Oro mate claro */
    --gold-light:   #C8AC72;
    --gold-dark:    #8A7240;
    --gold-muted:   rgba(184,154,91,0.10);

    --primary:      #18181B;
    --secondary:    #B89A5B;
    --secondary-light: #C8AC72;

    --success: #16a34a;
    --error:   #b91c1c;

    --shadow-sm:   0 1px 2px rgba(0,0,0,0.06);
    --shadow-md:   0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg:   0 8px 24px rgba(0,0,0,0.08);
    --shadow-glow: var(--shadow-md);
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-dark);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar premium */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

a { color: inherit; text-decoration: none; transition: all 0.2s ease; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-titles);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

/* --- UTILIDADES --- */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Texto con acento dorado */
.text-gradient {
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Panel de superficie elevada */
.glass-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.glass-panel:hover {
    box-shadow: var(--shadow-md);
}
/* Sin blur exagerado — solo sutil en header */

/* ============================================
   SISTEMA DE BOTONES — Premium Minimalista
============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 20px;
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    letter-spacing: 0.1px;
    white-space: nowrap;
}

/* Btn Primary DARK: Dorado sólido, texto oscuro */
.btn-primary {
    background: var(--gold);
    color: #0A0A0B;
    border-color: transparent;
    font-weight: 600;
}
.btn-primary:hover {
    background: var(--gold-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(194,164,106,0.35);
}

/* Btn Primary LIGHT: Negro carbón, texto blanco */
:root[data-theme="light"] .btn-primary {
    background: #18181B;
    color: #FFFFFF;
    border-color: transparent;
}
:root[data-theme="light"] .btn-primary:hover {
    background: #27272A;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

/* Btn Secondary: Contorno discreto */
.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-secondary:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-muted);
}
:root[data-theme="light"] .btn-secondary:hover {
    border-color: #18181B;
    color: #18181B;
    background: rgba(0,0,0,0.03);
}

/* Btn Glow: Contorno dorado sutil */
.btn-glow {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
}
.btn-glow:hover {
    background: var(--gold);
    color: #0A0A0B;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(194,164,106,0.3);
}
:root[data-theme="light"] .btn-glow {
    border-color: #18181B;
    color: #18181B;
}
:root[data-theme="light"] .btn-glow:hover {
    background: #18181B;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Alertas Flash */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
    animation: slideIn 0.3s ease;
}
.alert-success {
    background: rgba(34,197,94,0.08);
    border-color: rgba(34,197,94,0.2);
    color: var(--success);
}
.alert-error {
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.2);
    color: var(--error);
}
:root[data-theme="light"] .alert-success { color: #15803d; }
:root[data-theme="light"] .alert-error   { color: #b91c1c; }

@keyframes slideIn {
    from { transform: translateY(-10px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* --- HEADER & NAVEGACIÓN --- */
header {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-header);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.navbar {
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
    opacity: 0.9;
}
.logo-text {
    font-family: var(--font-ui);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-main);
}
/* "Digital" en el logo con acento dorado */
.logo-text .logo-accent {
    color: var(--gold);
}

.nav-menu {
    display: flex;
    gap: 6px;
    list-style: none;
}
.nav-link {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}
.nav-link:hover, .nav-link.active {
    color: var(--text-main);
    background: var(--gold-muted, rgba(194,164,106,0.1));
}

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

/* Menú de Usuario Logueado (Dropdown) */
.user-menu {
    position: relative;
    cursor: pointer;
}
.user-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
}
.avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid var(--primary);
    object-fit: cover;
    background: #1f242c;
}
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);  /* gap generoso para evitar cierre accidental */
    right: 0;
    min-width: 210px;
    padding: 6px;
    background: var(--bg-dropdown);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 12px);
    box-shadow: var(--shadow-lg, 0 8px 30px rgba(0,0,0,0.45));
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    pointer-events: none;
    z-index: 200;
}
.user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}
.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    font-size: 0.88rem;
    border-radius: var(--radius-sm, 8px);
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}
.user-dropdown a:hover {
    background: var(--gold-muted, rgba(194,164,106,0.1));
    color: var(--text-main);
}
/* Eliminado: .user-menu:hover .user-dropdown — reemplazado por JS */

.burger-menu {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
}
.burger-bar {
    width: 25px;
    height: 3px;
    background-color: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s ease;
}
.burger-menu.active .burger-bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.burger-menu.active .burger-bar:nth-child(2) {
    opacity: 0;
}
.burger-menu.active .burger-bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}
.burger-only {
    display: none;
}

/* --- HERO & CARRUSEL DE BANNERS --- */
.hero-section {
    padding: 40px 0;
}
.carousel-container {
    position: relative;
    width: 100%;
    height: 420px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 40px;
}
.carousel-track {
    width: 100%;
    height: 100%;
    display: flex;
    position: relative;
}
.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    display: flex;
    align-items: center;
    background-size: cover;
    background-position: center;
}
.carousel-slide.active {
    opacity: 1;
    z-index: 10;
}
.carousel-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(13,17,23,0.95) 35%, rgba(13,17,23,0.3) 100%);
}
.carousel-content {
    position: relative;
    z-index: 20;
    width: 55%;
    padding-left: 60px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.carousel-title {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.15;
}
.carousel-description {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.5;
}

/* Navegación carrusel */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(22, 27, 34, 0.7);
    border: 1px solid var(--border-color);
    color: #fff;
    cursor: pointer;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}
.carousel-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
}
.carousel-btn-prev { left: 20px; }
.carousel-btn-next { right: 20px; }

.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 30;
}
.indicator-dot {
    width: 24px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.2);
    cursor: pointer;
    transition: 0.3s;
}
.indicator-dot.active {
    background: var(--secondary);
    width: 32px;
}

/* --- SECCIONES DESTACADAS --- */
.section-title-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 25px;
}
.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    position: relative;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 2px;
}

/* Grid de Revistas */
.magazines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.magazine-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}
.magazine-card:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 240, 255, 0.2);
    box-shadow: 0 12px 40px 0 rgba(0, 240, 255, 0.08);
}

.card-image-wrapper {
    position: relative;
    width: 100%;
    height: 320px;
    overflow: hidden;
    border-radius: 11px 11px 0 0;
}
.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.magazine-card:hover .card-image {
    transform: scale(1.06);
}
.card-category-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(13, 17, 23, 0.85);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
}
.card-actions-overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 17, 23, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.card-image-wrapper:hover .card-actions-overlay {
    opacity: 1;
}

.card-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 8px;
}
.card-edition {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}
.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
}
.card-author {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.card-stats {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
}
.card-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* --- CATEGORÍAS SHELF --- */
.categories-shelf {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}
.category-card {
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: 0.3s;
}
.category-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}
.category-icon {
    width: 50px;
    height: 50px;
    color: var(--secondary);
}
.category-title {
    font-size: 1.15rem;
    font-weight: 700;
}
.category-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- ESTADÍSTICAS PORTAL --- */
.portal-stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 40px 0 60px;
    padding: 30px;
}
.stat-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: var(--font-titles);
}
.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* --- SECCIÓN NOTICIAS --- */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}
.news-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}
.news-image-wrapper {
    height: 180px;
    width: 100%;
}
.news-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.news-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}
.news-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.news-title {
    font-size: 1.25rem;
    font-weight: 700;
}
.news-excerpt {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.news-link {
    margin-top: auto;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.news-link:hover {
    color: var(--primary);
}

/* --- BUSCADOR INTERACTIVO --- */
.search-bar-container {
    margin: 20px 0 40px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}
.search-input-wrapper {
    position: relative;
    flex-grow: 1;
    min-width: 280px;
}
.search-input {
    width: 100%;
    padding: 14px 20px 14px 45px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.search-icon-svg {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}
.filter-select {
    padding: 0 15px;
    height: 49px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 160px;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.filter-select option {
    background: var(--bg-dropdown);
    color: var(--text-main);
}
.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* --- PÁGINA DETALLE REVISTA --- */
.detail-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 50px;
    margin: 40px 0;
}
.detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.detail-cover {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
}
.detail-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.detail-title {
    font-size: 2.5rem;
    font-weight: 800;
}
.detail-subtitle {
    font-size: 1.3rem;
    color: var(--text-muted);
    font-weight: 500;
}
.detail-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    padding: 20px;
    margin: 10px 0;
}
.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.meta-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}
.meta-value {
    font-size: 0.95rem;
    font-weight: 500;
}
.detail-actions {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.tag-badge {
    background: rgba(124, 58, 237, 0.12);
    border: 1px solid rgba(124, 58, 237, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-main);
    font-weight: 500;
}

/* --- SECCIÓN COMENTARIOS --- */
.comments-section {
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
    padding-top: 40px;
}
.rating-stars {
    display: flex;
    gap: 4px;
    color: #e3b341;
}
.comment-form {
    margin: 30px 0;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.comment-textarea {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.comment-textarea:focus {
    outline: none;
    border-color: var(--secondary);
}
.star-rating-selector {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 8px;
}
.star-rating-selector input {
    display: none;
}
.star-rating-selector label {
    font-size: 1.8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
}
.star-rating-selector label:hover,
.star-rating-selector label:hover ~ label,
.star-rating-selector input:checked ~ label {
    color: #e3b341;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
}
.comment-item {
    padding: 20px;
    display: flex;
    gap: 15px;
}
.comment-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}
.comment-item-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}
.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.comment-user-name {
    font-weight: 600;
}
.comment-body {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* --- VISOR FLIPBOOK 3D --- */
.visor-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px);
    background: #090c10;
}
.visor-toolbar {
    height: 60px;
    background: rgba(22, 27, 34, 0.95);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
}
.visor-title {
    font-size: 1.1rem;
    font-weight: 600;
}
.visor-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}
.visor-page-indicator {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.visor-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    padding: 20px;
}

/* El Flipbook 3D */
.book {
    width: 700px;
    height: 500px;
    position: relative;
    transition: transform 0.5s;
    perspective: 1500px;
}
.page {
    width: 50%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 50%;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1;
}
.page-front, .page-back {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow: inset 3px 0 20px rgba(0,0,0,0.2), 0 5px 15px rgba(0,0,0,0.3);
    background: #fff;
    overflow: hidden;
}
.page-front {
    z-index: 2;
}
.page-back {
    transform: rotateY(180deg);
    z-index: 1;
}
.page.flipped {
    transform: rotateY(-180deg);
}

/* Contenido ficticio de página */
.page-content {
    padding: 30px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    color: #1f242c;
    justify-content: space-between;
}
.page-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    margin-bottom: 15px;
    border-radius: 4px;
}
.page-num {
    text-align: right;
    font-size: 0.8rem;
    color: #8b949e;
}
.page-back .page-num {
    text-align: left;
}

/* --- PERFIL DE USUARIO --- */
.profile-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    margin: 40px 0;
}
.profile-card {
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 15px;
}
.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--secondary);
    object-fit: cover;
    margin-bottom: 10px;
}
.profile-email {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.profile-tabs {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 5px;
    margin-top: 15px;
}
.profile-tab-btn {
    text-align: left;
    padding: 10px 15px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 6px;
    transition: 0.3s;
}
.profile-tab-btn:hover, .profile-tab-btn.active {
    background: rgba(255,255,255,0.05);
    color: var(--secondary);
}

.profile-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}
.profile-panel.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}
.form-control {
    padding: 12px 15px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

/* --- REGISTRO Y LOGIN (AUTH) --- */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    padding: 60px 0;
}
.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
}
.auth-header {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.auth-title {
    font-size: 1.8rem;
    font-weight: 800;
}
.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.auth-footer {
    text-align: center;
    margin-top: 25px;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.auth-footer a {
    color: var(--secondary);
    font-weight: 600;
}

/* --- FOOTER --- */
footer {
    margin-top: auto;
    background: #0A0A0B;                   /* dark mode: negro profundo */
    border-top: 1px solid var(--border-color);
    padding: 64px 0 32px;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
:root[data-theme="light"] footer {
    background: #EDE9E0;                   /* marfil oscuro cálido */
    border-top-color: #D6D1C7;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}
.footer-col {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 800;
}
.footer-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.footer-title {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-subtle, #71717A);
    position: relative;
    padding-bottom: 10px;
    margin-bottom: 4px;
}
.footer-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 24px;
    height: 1.5px;
    background: var(--gold, #C2A46A);
    border-radius: 1px;
}
:root[data-theme="light"] .footer-title {
    color: #6B7280;
}
.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text-muted);
}
.footer-links a {
    color: var(--text-muted);
    transition: color 0.15s, padding-left 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.footer-links a:hover,
.footer-links a:focus {
    color: var(--gold, #C2A46A);
    padding-left: 4px;
}
:root[data-theme="light"] .footer-links {
    color: #52525B;
}
:root[data-theme="light"] .footer-links a {
    color: #52525B;
}
:root[data-theme="light"] .footer-links a:hover {
    color: #18181B;
}
.social-links {
    display: flex;
    gap: 10px;
}
.social-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-ui);
    letter-spacing: 0.05em;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.social-icon:hover {
    background: var(--gold, #C2A46A);
    color: #0A0A0B;
    border-color: var(--gold, #C2A46A);
}
:root[data-theme="light"] .social-icon {
    border-color: #D6D1C7;
    color: #52525B;
}
:root[data-theme="light"] .social-icon:hover {
    background: #18181B;
    color: #ffffff;
    border-color: #18181B;
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 0.83rem;
    color: var(--text-muted);
}
:root[data-theme="light"] .footer-bottom {
    border-top-color: #D6D1C7;
    color: #6B7280;
}

.footer-dev-credit {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}
.footer-dev-credit:hover {
    color: var(--gold, #C2A46A);
}
.dev-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}

/* --- RESPONSIBIILIDAD MÓVIL --- */
@media (max-width: 992px) {
    .detail-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .detail-sidebar {
        align-items: center;
        max-width: 320px;
        margin: 0 auto;
    }
    .carousel-content {
        width: 75%;
    }
    .profile-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .nav-actions {
        display: none;
    }
    .burger-only {
        display: block;
    }
    .navbar {
        height: 60px;
    }
    .burger-menu {
        display: flex;
    }
    .nav-menu {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 60px);
        background: var(--bg-header);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        flex-direction: column;
        padding: 40px;
        gap: 30px;
        transition: 0.4s ease;
        z-index: 999;
    }
    .nav-menu.active {
        left: 0;
    }
    .carousel-container {
        height: 350px;
    }
    .carousel-content {
        width: 90%;
        padding-left: 30px;
    }
    .carousel-title {
        font-size: 2rem;
    }
    .carousel-btn {
        width: 36px;
        height: 36px;
    }
    .book {
        width: 100%;
        max-width: 340px;
        height: 440px;
    }
    .page {
        width: 100%;
        left: 0;
        transform-origin: left center;
    }
    .page-back {
        transform: rotateY(0deg);
    }
    /* Para móvil se hace scroll vertical de las páginas o visor simple */
}
