        /* 1. VARIABLES GLOBALES Y RESET (El cerebro del diseño) */
        :root {
            --primary: #2c3e50;
            --secondary: #3498db;
            --accent: #e74c3c;
            --light: #ecf0f1;
            --dark: #2c3e50;
            --gray: #95a5a6;
            
            /* NUEVAS VARIABLES PARA DECORACIONES */
            --deco-opacity: 1;        
            --deco-size-normal: 55px;    
            --deco-size-top: 65px;      
            --deco-size-side: 50px;      
            --deco-size-bottom: 65px;    
            --deco-size-special: 85px;   
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        
        /* 2. MODAL DE OFERTAS (EL CUADRO NEGRO)*/
                /* 2. MODAL DE OFERTAS (EL CUADRO NEGRO) - VERSIÓN CORREGIDA */
        .modal-negro {
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: rgba(0, 0, 0, 0.95);
                z-index: 100000;
                display: flex;
                align-items: center;
                justify-content: center;
                padding: 20px;
                box-sizing: border-box;
                overflow: hidden;
        }

        .modal-contenido {
                background: #1a1a1a;
                border: 3px solid var(--secondary);
                border-radius: 20px;
                max-width: 900px;
                width: 95%;
                height: 85vh;
                position: relative;
                text-align: center;
                color: white;
                box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
                display: flex;
                flex-direction: column;
                padding: 0;
                overflow: hidden;
        }

        /* CONTENEDOR DEL TÍTULO Y LA X */
        .modal-header {
                padding: 20px 40px;
                background: rgba(0, 0, 0, 0.7);
                border-radius: 20px 20px 0 0;
                position: relative;
                flex-shrink: 0;
        }

        .cerrar-modal {
                position: absolute;
                top: 15px;
                right: 25px;
                font-size: 40px;
                color: white;
                cursor: pointer;
                transition: all 0.3s;
                background: rgba(255, 0, 0, 0.7);
                width: 50px;
                height: 50px;
                border-radius: 50%;
                display: flex;
                align-items: center;
                justify-content: center;
                line-height: 1;
        }

        .cerrar-modal:hover {
                color: white;
                background: rgba(255, 0, 0, 0.9);
                transform: scale(1.1);
        }

        .titulo-oferta {
                color: var(--secondary);
                font-size: 1.8em;
                margin: 0;
                padding-right: 60px;
                font-weight: 800;
                text-transform: uppercase;
        }

        /* ÁREA DE COMBOS CON SCROLL */
        .combos-container {
                flex: 1;
                overflow-y: auto;
                padding: 20px;
        }

        .combos-grid {
                display: flex;
                gap: 20px;
                justify-content: center;
                flex-wrap: wrap;
                min-height: min-content;
        }

        /* PIE DEL MODAL (botón fijo) */
        .modal-footer {
                padding: 20px;
                background: rgba(0, 0, 0, 0.7);
                border-radius: 0 0 20px 20px;
                flex-shrink: 0;
        }

        .btn-continuar {
                background: var(--secondary);
                color: white;
                border: 2px solid var(--secondary);
                padding: 12px 30px;
                border-radius: 8px;
                cursor: pointer;
                font-weight: bold;
                font-size: 1.1em;
                min-width: 250px;
                transition: all 0.3s;
        }

        .btn-continuar:hover {
                background: var(--accent);
                border-color: var(--accent);
                color: white;
                transform: scale(1.05);
        }

        /* Responsive */
        @media (max-width: 768px) {
                .modal-contenido {
                        width: 98%;
                        height: 90vh;
                }
                
                .titulo-oferta {
                        font-size: 1.4em;
                }
                
                .cerrar-modal {
                        font-size: 30px;
                        width: 40px;
                        height: 40px;
                        right: 15px;
                }
                
                .btn-continuar {
                        min-width: 200px;
                        padding: 10px 20px;
                }
        }

        @media (max-width: 480px) {
                .modal-contenido {
                        height: 95vh;
                        border-radius: 10px;
                }
                
                .modal-header {
                        padding: 15px 20px;
                }
                
                .combos-container {
                        padding: 10px;
                }
                
                .combos-grid {
                        gap: 15px;
                }
        }
        
        /* 3. HEADER SUPERIOR - Teléfono, redes sociales */
        .top-bar {
            background: var(--primary);
            color: white;
            padding: 10px 0;
            font-size: 0.9em;
            width: 100%;
            margin: 0;
        }
        
        .top-container {
            max-width: 100%;
            margin: 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 40px;          
            box-sizing: border-box;
        }
        
        .contact-info {
            display: flex;
            gap: 20px;
        }
        
        .contact-info span {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .social-icons {
            display: flex;
            gap: 15px;
        }
        
        .social-icons a {
            color: white;
            background: rgba(255,255,255,0.1);
            width: 30px;
            height: 30px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s;
        }
        
        .social-icons a:hover {
            background: var(--secondary);
            transform: translateY(-3px);
        }
        
        /* 4. HEADER PRINCIPAL - (Logo, Menú y Buscador) */
        .main-header {
            background: white;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
            position: sticky;
            top: 0;
            z-index: 100;
        }
        
        .header-container {
            max-width: 100%;            
            margin: 0;                  
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 40px 15px 15px; 
        }

        .header-top-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
        }

        .header-bottom-row {
            display: flex;
            justify-content: center;
            width: 100%;
            margin-top: 8px;
            padding-bottom: 5px;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-left: -10px;  
        }
        
        .logo-img {
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .logo-img img {
            width: 80px;
            height: auto;
            max-height: 90px;
            object-fit: contain;
        }
        
        .logo-img img:hover {
            transform: scale(1.05);
        }
        
        .logo-text h1 {
            font-size: 1.5em;  
            color: var(--primary);
            font-weight: 700;
        }
        
        .logo-text .subtitle {
            font-size: 1em;
            color: var(--secondary);
            font-weight: 600;
            letter-spacing: 1px;
            text-align: center;
        }
        
        .logo-text p {
            font-size: 0.9em;
            color: var(--gray);
        }
        
        .main-nav ul {
            display: flex;
            list-style: none;
            gap: 30px;
        }
        
        .main-nav a {
            text-decoration: none;
            color: var(--dark);
            font-weight: 600;
            padding: 8px 0;
            position: relative;
            transition: color 0.3s;
        }
        
        .main-nav a:hover {
            color: var(--secondary);
        }
        
        .main-nav a::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 0;
            height: 3px;
            background: var(--secondary);
            transition: width 0.3s;
        }
        
        .main-nav a:hover::after {
            width: 100%;
        }
        
        .search-box {
            display: flex;
            align-items: center;
            background: var(--light);
            border-radius: 30px;
            padding: 8px 15px;
        }
        
        .search-box input {
            border: none;
            background: transparent;
            padding: 5px;
            width: 180px;
            outline: none;
        }
        
        .search-box button {
            background: none;
            border: none;
            color: var(--gray);
            cursor: pointer;
        }

        /* 5. COMPONENTES DEL HEADER (Buscador, Switcher y Columnas) */
        .header-right-column {
            display: flex;
            flex-direction: column;
            gap: 15px;
            align-items: flex-end;
        }

        .header-right-column .search-box {
            margin: 0;
        }

        .theme-switcher-center {
            text-align: center;
            margin-top: 5px;
        }

        .header-right-column .theme-switcher {
            display: flex;
            justify-content: flex-end;
        }
        
        #change-theme-btn {
            background: linear-gradient(135deg, var(--secondary), var(--primary));
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 25px;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.9em;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all 0.3s;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }

        #change-theme-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(0,0,0,0.15);
        }
               
        /* 6. HERO SECTION - Imagen con degradado */
        .hero {
            height: 500px;
            position: relative;
            overflow: hidden;
        }
        
        .hero-bg {
            width: 100%;
            height: 100%;
            background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.4)), 
                url('../assets/backgrounds/fondo_imprenta.jpg') center/cover no-repeat;
        }
        
        .hero-bg::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(to right, 
                rgba(44, 62, 80, 0.7) 0%, 
                rgba(44, 62, 80, 0.4) 50%, 
                rgba(44, 62, 80, 0.1) 100%);
        }
        
        .hero-content {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            color: white;
            z-index: 2;
            width: 90%;
            max-width: 800px;
        }
        
        .hero-content h2 {
            font-size: 3em;
            margin-bottom: 20px;
            text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
        }
        
        .hero-content p {
            font-size: 1.3em;
            margin-bottom: 30px;
        }
        
        .hero-buttons {
            display: flex;
            justify-content: center;
            gap: 20px;
            flex-wrap: wrap;
        }
        
        .btn-hero {
            background: linear-gradient(145deg, var(--secondary), #2980b9);
            color: white;
            padding: 15px 30px;
            border: none;
            border-radius: 30px;
            font-size: 1.1em;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 10px 20px rgba(0,0,0,0.2);
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .btn-hero:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 25px rgba(0,0,0,0.3);
            background: linear-gradient(145deg, #3498db, var(--secondary));
        }
        
        .btn-hero.secondary {
            background: rgba(255,255,255,0.2);
            backdrop-filter: blur(10px);
            border: 2px solid rgba(255,255,255,0.3);
        }
        
        .btn-hero.secondary:hover {
            background: rgba(255,255,255,0.3);
        }
        
        /* 7. CARDS Y CONTENIDOS */
        .cards-container {
            max-width: 1200px;
            margin: -100px auto 50px;
            padding: 0 20px;
            position: relative;
            z-index: 10;
            display: flex;
            justify-content: center;
            gap: 30px;
            flex-wrap: wrap;
        }
        
        .service-card {
            flex: 1;
            min-width: 300px;
            max-width: 350px;
            background: white;
            border-radius: 15px;
            overflow: hidden;
            box-shadow: 0 10px 30px rgba(0,0,0,0.08);
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            position: relative;
            display: flex;
            flex-direction: column; 
        }

        .card-content {
            padding: 25px;
            flex-grow: 1; 
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }
        
        .service-card:hover {
            transform: translateY(-15px) scale(1.02) !important;
            box-shadow: 0 25px 50px rgba(0,0,0,0.15) !important;
        }
        
        .card-img {
            height: 200px;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            position: relative;   /* CLAVE */
            overflow: hidden;     /* CLAVE */
        }

        .card-label {
            background: #2C3E50 !important; /* Color base uniforme para adultos */
            color: white;
            padding: 12px 20px;
            text-align: center;
            font-weight: 600;
            font-size: 1.1em;
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
        }
        
        .card-content h3 {
            color: var(--primary);
            margin-bottom: 15px;
            font-size: 1.4em;
        }
        
        .card-content p {
            color: var(--gray);
            margin-bottom: 20px;
            font-size: 0.95em;
        }
        
        .card-link {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            color: var(--secondary);
            text-decoration: none;
            font-weight: 600;
            transition: gap 0.3s;
        }
        
        .card-link:hover {
            gap: 12px;
        }
        
        /* 8. SECCIÓN INFORMACIÓN */
        .info-section {
            max-width: 1200px;
            margin: 80px auto;
            padding: 0 20px;
        }
        
        .section-title {
            text-align: center;
            margin-bottom: 50px;
        }
        
        .section-title h2 {
            font-size: 2.5em;
            color: var(--primary);
            margin-bottom: 15px;
        }
        
        .section-title p {
            color: var(--gray);
            max-width: 700px;
            margin: 0 auto;
        }
        
        .info-cards {
            display: flex;
            gap: 30px;
            flex-wrap: wrap;
            justify-content: center;
        }
        
        .info-card {
            flex: 1;
            min-width: 300px;
            background: white;
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.08);
            transition: transform 0.3s ease;
            will-change: transform;
            backface-visibility: hidden;
            -webkit-font-smoothing: antialiased;
        }
        
        .info-card:hover {
            transform: translateY(-10px);
        }
        
        .info-card h3 {
            color: var(--primary);
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .info-card .icon {
            width: 40px;
            height: 40px;
            background: var(--secondary);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
        }
        
        /* 9. FOOTER */
        footer {
            background: var(--primary);
            color: white;
            padding: 50px 0 20px;
        }
        
        .footer-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
            display: flex;
            flex-wrap: wrap;
            gap: 40px;
            justify-content: space-between;
        }
        
        .footer-col {
            flex: 1;
            min-width: 250px;
        }
        
        .footer-col h3 {
            margin-bottom: 20px;
            color: var(--light);
            font-size: 1.3em;
        }
        
        .footer-col ul {
            list-style: none;
        }
        
        .footer-col ul li {
            margin-bottom: 10px;
        }
        
        .footer-col ul li a {
            color: #ddd;
            text-decoration: none;
            transition: color 0.3s;
        }
        
        .footer-col ul li a:hover {
            color: var(--secondary);
        }
        
        .contact-footer {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 15px;
        }
        
        .copyright {
            text-align: center;
            margin-top: 40px;
            padding-top: 20px;
            border-top: 1px solid rgba(255,255,255,0.1);
            color: #aaa;
            font-size: 0.9em;
        }
        
        /* 10. VENTANA Y MENSAJES DEL CHATBOT */
        .age-selector {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(44, 62, 80, 0.98);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 99999;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        
        .age-modal {
            background: white;
            padding: 40px;
            border-radius: 25px;
            max-width: 600px;
            width: 90%;
            text-align: center;
            box-shadow: 0 30px 80px rgba(0,0,0,0.4);
            animation: slideUp 0.5s ease;
        }
        
        @keyframes slideUp {
            from { transform: translateY(30px); opacity: 0; }
            to { transform: translateY(0); opacity: 1; }
        }
        
        .age-header h2 {
            color: #2c3e50;
            margin-bottom: 10px;
            font-size: 2em;
        }
        
        .age-header p {
            color: #7f8c8d;
            margin-bottom: 40px;
            font-size: 1.1em;
        }
        
        .age-options {
            display: flex;
            gap: 20px;
            margin: 40px 0;
            justify-content: center;
            flex-wrap: wrap;
        }
        
        .age-btn {
            flex: 1;
            min-width: 160px;
            padding: 25px 15px;
            border: none;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 12px;
            position: relative;
            overflow: hidden;
        }
        
        .age-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 5px;
            background: rgba(255,255,255,0.5);
        }
        
        .age-btn:hover {
            transform: translateY(-10px) scale(1.05);
            box-shadow: 0 20px 40px rgba(0,0,0,0.2);
        }
        
        .age-icon {
            font-size: 3em;
            margin-bottom: 5px;
        }
        
        .age-label {
            font-size: 1.4em;
            font-weight: 700;
        }
        
        .age-range {
            font-size: 0.9em;
            opacity: 0.8;
        }
        
        /* Botón Niños */
        .kid-btn {
            background: linear-gradient(145deg, #FF9A9E, #FAD0C4, #A1C4FD);
            color: #333;
        }
        
        /* Botón Jóvenes */
        .young-btn {
            background: linear-gradient(145deg, #6C5CE7, #00CEC9, #FD79A8);
            color: white;
        }
        
        /* Botón Adultos */
        .adult-btn {
            background: linear-gradient(145deg, #2C3E50, #3498DB, #E74C3C);
            color: white;
        }
        
        .age-note {
            margin-top: 30px;
            color: #95a5a6;
            font-size: 0.9em;
        }

        /* 11. DECORACIONES TEMÁTICAS */
        .theme-decorations {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 999;
            overflow: hidden;
        }

        .decoration {
            position: absolute;
            font-size: 2em;
            opacity: 0;
            transition: opacity 0.5s ease;
            z-index: -1;
            animation-duration: 20s;
            animation-iteration-count: infinite;
            animation-timing-function: linear;
        }

        /* Decoraciones para NIÑOS - Flotantes y divertidas */
        .theme-kid .kid-only {
            opacity: 0.7;
            animation-name: floatAnimation;
        }

        /* Decoraciones para JÓVENES - Dinámicas */
        .theme-young .young-only {
            opacity: 0.6;
            animation-name: pulseAnimation;
        }

        /* Decoraciones para ADULTOS - Sutiles */
        .theme-adult .adult-only {
            opacity: 0.4;
            animation-name: subtleFloat;
        }

        /* Animaciones específicas */
        @keyframes floatAnimation {
            0%, 100% {
                transform: translateY(0) rotate(0deg);
            }
            25% {
                transform: translateY(-20px) rotate(5deg);
            }
            50% {
                transform: translateY(0) rotate(0deg);
            }
            75% {
                transform: translateY(10px) rotate(-5deg);
            }
        }

        @keyframes pulseAnimation {
            0%, 100% {
                transform: scale(1);
                opacity: 0.6;
            }
            50% {
                transform: scale(1.1);
                opacity: 0.8;
            }
        }

        @keyframes subtleFloat {
            0%, 100% {
                transform: translateY(0);
            }
            50% {
                transform: translateY(-10px);
            }
        }

        /* Posiciones específicas para cada decoración */
        .pencil { animation-delay: 0s; font-size: 2.5em; }
        .paint { animation-delay: 3s; font-size: 3em; }
        .book { animation-delay: 5s; font-size: 2.8em; }
        .star { animation-delay: 7s; font-size: 2em; }

        .laptop { animation-delay: 1s; font-size: 2.2em; }
        .phone { animation-delay: 4s; font-size: 2.3em; }
        .music { animation-delay: 6s; font-size: 2em; }

        .briefcase { animation-delay: 2s; font-size: 2em; }
        .chart { animation-delay: 5s; font-size: 2.5em; }

        /* MARCO ALINEADO - CONTROL TOTAL CON VARIABLES */
        .theme-decorations img {
            display: block;
            max-width: 100%;
            height: auto;
            pointer-events: none;
        }
        
        /* === ESTILOS GENERALES === */
        .theme-kid .marco img {
            width: var(--deco-size-normal);
            animation: marcoFloat 12s infinite ease-in-out;
            filter: drop-shadow(0 3px 6px rgba(255,105,105,0.3));
            opacity: var(--deco-opacity);
        }
        
        /* === FILA SUPERIOR (4) === */
        .theme-kid .top img {
            width: var(--deco-size-top);
            animation-name: floatTop;
        }
        .top.pos1 img { animation-delay: 0s; }
        .top.pos2 img { animation-delay: 3s; }
        .top.pos3 img { animation-delay: 6s; }
        .top.pos4 img { animation-delay: 9s; }
        
        /* === COLUMNA IZQUIERDA (5) === */
        .theme-kid .left img {
            width: var(--deco-size-side);
            animation-name: floatLeft;
        }
        .left.pos5 img { animation-delay: 1s; }
        .left.pos6 img { animation-delay: 4s; }
        .left.pos7 img { animation-delay: 7s; }
        .left.pos8 img { animation-delay: 10s; }
        .left.pos9 img { animation-delay: 13s; }
        
        /* === COLUMNA DERECHA (4) === */
        .theme-kid .right img {
            width: var(--deco-size-side);
            animation-name: floatRight;
        }
        .right.pos10 img { animation-delay: 2s; }
        .right.pos11 img { animation-delay: 5s; }
        .right.pos12 img { animation-delay: 8s; }
        .right.pos13 img { animation-delay: 11s; }
        
        /* === FILA INFERIOR (4) === */
        .theme-kid .bottom img {
            width: var(--deco-size-bottom);
            animation-name: floatBottom;
        }
        .bottom.pos14 img { animation-delay: 0.5s; }
        .bottom.pos15 img { animation-delay: 3.5s; }
        .bottom.pos16 img { animation-delay: 6.5s; }
        .bottom.pos17 img { animation-delay: 9.5s; }
        
        /* === nino15 ESPECIAL (más grande) === */
        .bottom.pos15 img {
            width: var(--deco-size-special) !important;
            opacity: 1 !important; /* Siempre al máximo */
            filter: drop-shadow(0 6px 12px rgba(255,105,105,0.6));
            animation: highlightPulse 4s infinite ease-in-out;
        }
        
        /* === ANIMACIONES === */
        @keyframes floatTop {
            0%, 100% { transform: translateY(0) rotate(0deg); }
            50% { transform: translateY(-10px) rotate(5deg); }
        }
        
        @keyframes floatLeft {
            0%, 100% { transform: translateX(0) rotate(0deg); }
            50% { transform: translateX(-10px) rotate(-5deg); }
        }
        
        @keyframes floatRight {
            0%, 100% { transform: translateX(0) rotate(0deg); }
            50% { transform: translateX(10px) rotate(5deg); }
        }
        
        @keyframes floatBottom {
            0%, 100% { transform: translateY(0) rotate(0deg); }
            50% { transform: translateY(10px) rotate(-5deg); }
        }
        
        @keyframes highlightPulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.15); }
        }

        /* 12. CATÁLOGO Y TARJETAS DE LIBROS */
        .materias-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr); /* ← 3 columnas FIJAS */
            gap: 30px;
            margin-bottom: 50px; /* Reducido porque la paginación agrega espacio */
            max-width: 1200px;
            margin-left: auto;
            margin-right: auto;
            padding: 0 20px;
        }

        /* Responsive: en tablets 2 columnas, en móviles 1 */
        @media (max-width: 992px) {
            .materias-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 576px) {
            .materias-grid {
                grid-template-columns: 1fr;
            }
        }

        /* Tarjeta de materia - ANIMACIONES SUAVES COMO INDEX */
        .materia-card {
            max-width: 350px;
            width: 100%;
            background: white;
            border-radius: 15px;
            overflow: hidden;
            box-shadow: 0 10px 30px rgba(0,0,0,0.08);
            transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) !important; /* ← CAMBIADO */
            position: relative;
            will-change: transform, box-shadow;
            backface-visibility: hidden;
            -webkit-font-smoothing: antialiased;
        }
        
        .materia-card:hover {
            transform: translateY(-15px) scale(1.03) !important;  /* ← MÁS SUAVE */
            box-shadow: 0 25px 50px rgba(0,0,0,0.15) !important;  /* ← SOMBRA MÁS FUERTE */
        }
        
        /* Imagen superior */
        .materia-img {
            height: 200px;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            position: relative;
        }
        
        /* Etiqueta inferior */
        .materia-label {
            background: #2C3E50 !important; /* Mantener consistencia */
            color: white;
            padding: 12px 20px;
            text-align: center;
            font-weight: 600;
            font-size: 1.1em;
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            border-bottom-left-radius: 15px;
            border-bottom-right-radius: 15px;
        }

        .categoria-header {
            height: 500px;
            background-size: cover;
            background-position: center;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            color: white;
            text-align: center;
            padding: 20px;
        }

        .categoria-header h1 {
            font-size: 3.5rem;
            margin-bottom: 10px;
            text-shadow: 2px 2px 10px rgba(0,0,0,0.5);
        }

        /* 13. ESTILOS COMPLETOS DE LA TARJETA (Sin perder nada)
        =================================================== */

        /* ANIMACIÓN SUAVE PARA TARJETAS - igual que Index */
        /* ANIMACIÓN SUAVE PARA TARJETAS - igual que Index */
        .libro-card {
            transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) !important;  /* ← MÁS SUAVE */
            transform-origin: center;
            will-change: transform, box-shadow;
            overflow: visible;
        }
        
        .libro-card:hover {
            transform: translateY(-15px) scale(1.05) !important;  /* ← MÁS PRONUNCIADO */
            box-shadow: 0 25px 50px rgba(0,0,0,0.2) !important;   /* ← SOMBRA MÁS FUERTE */
        }

        /* b. El contenedor de la Portada (el degradado de arriba) */
        .portada-container {
            height: 220px;
            background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            overflow: hidden;
            padding: 25px;
        }

        .portada-img {
            width: 140px;
            height: 190px;
            object-fit: cover;
            border-radius: 6px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.3);
            transition: all 0.4s;
            cursor: pointer;
        }

        /* c. El carrusel de páginas de muestra */
        .paginas-container {
            height: 160px;
            position: relative;
            background: #f8f9fa;
            border-bottom: 1px solid #eee;
            overflow: hidden;
        }

        .paginas-carousel {
            display: flex;
            width: 500%; /* CAMBIAR de 600% a 500% (5 slides × 100%) */
            height: 100%;
            transition: transform 0.5s ease-in-out;
        }

        .pagina-slide {
            flex: 0 0 20%; /* CAMBIAR de 16.666% a 20% (100% ÷ 5 slides) */
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 15px;
        } 

        .pagina-img {
            max-height: 130px;
            max-width: 85%;
            object-fit: contain;
            border-radius: 4px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.15);
            cursor: pointer;
            transition: all 0.3s;
            background: white;
            padding: 2px;
        }

        /* d. Las flechitas del carrusel */
        .carousel-controls {
            position: absolute;
            top: 50%;
            left: 0;
            right: 0;
            transform: translateY(-50%);
            display: flex;
            justify-content: space-between;
            padding: 0 8px;
            z-index: 5;
            pointer-events: none;
        }

        .carousel-btn {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: rgba(255,255,255,0.95);
            border: none;
            color: var(--primary);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 10px rgba(0,0,0,0.2);
            pointer-events: auto; 
        }

        /* e. Los puntos indicadores (dots) */
        .carousel-dots {
            position: absolute;
            bottom: 10px;
            left: 0;
            right: 0;
            display: flex;
            justify-content: center;
            gap: 6px;
            z-index: 5;
        }

        .dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: rgba(0,0,0,0.2);
            cursor: pointer;
        }

        .dot.active {
            background: var(--secondary);
            transform: scale(1.3);
        }

        /* f. Información (Título y Precio) */
        .info-container {
            padding: 20px;
        }

        .libro-titulo {
            font-size: 1.2em;
            color: var(--primary);
            margin-bottom: 15px;
            font-weight: 700;
            text-align: center;
        }

        .detalles-grid {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            justify-content: center;
            margin: 15px 0;
        }

        .detalle-item {
            background: #f5f5f5;
            border-radius: 20px;
            padding: 6px 12px;
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 0.85em;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }

        .detalle-icono {
            color: var(--secondary);
            font-size: 0.9em;
        }

        .detalle-valor {
            font-weight: 600;
            color: #333;
        }

        .detalle-etiqueta {
            color: #777;
            font-size: 0.75em;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        /* Precio destacado */
        .detalle-item .precio-libro {
            color: var(--accent);
            font-weight: 700;
            font-size: 1.1em;
        }

        .btn-carrito {
            background: linear-gradient(135deg, #2ecc71, #27ae60);
            color: white;
            width: 100%;
            padding: 12px;
            border-radius: 8px;
            font-weight: 600;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        /* 14. AJUSTES RESPONSIVE */
        /* Tablets y Laptops pequeñas */
        @media (max-width: 992px) {
            .main-nav ul {
                gap: 15px;
            }
            .search-box input {
                width: 120px;
            }
            .hero-content h2 {
                font-size: 2.5em;
            }
        }

        /* Celulares (Fusión de tus dos bloques) */
        @media (max-width: 768px) {
            .header-container {
                flex-direction: column;
                gap: 20px; 
            }
    
            .header-top-row {
                flex-direction: column;
                gap: 15px;
            }
    
            .header-bottom-row {
                margin-top: 5px;
                padding-bottom: 10px;
            }
    
            #change-theme-btn {
                width: 90%;
                max-width: 250px;
                justify-content: center;
            }

            .main-nav ul {
                flex-wrap: wrap;
                justify-content: center;
            }
    
            .top-container {
                flex-direction: column;
                gap: 10px;
            }
    
            .hero-content h2 {
                font-size: 2em;
            }
    
            .cards-container {
                margin-top: -50px;
            }
        }

        /* Garantizar que la plantilla NUNCA se vea */
        #card-template {
            display: none !important;
            visibility: hidden !important;
            opacity: 0 !important;
            height: 0 !important;
            width: 0 !important;
            overflow: hidden !important;
            position: absolute !important;
            left: -9999px !important;
            pointer-events: none !important;
            margin: 0 !important;
            padding: 0 !important;
            border: none !important;
        }

        /* Arreglar visualización de materias en nivel.html */
        .materia-img {
            position: relative;
            min-height: 180px;
            background-size: cover !important;
            background-position: center !important;
            background-repeat: no-repeat !important;
        }

        .materia-label {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            padding: 12px 20px;
            text-align: center;
            font-weight: 600;
            font-size: 1.1em;
            color: white;
            background-color: var(--secondary) !important;
            z-index: 2;
        }

        .materia-content {
            display: none; /* Ocultamos este contenido si no se usa */
        }

        /* Mostrar solo cuando sea necesario */
        .materia-card.book .materia-content {
            display: block;
            padding: 15px;
            background: rgba(255, 255, 255, 0.9);
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
        }
        
        main.contenedor-principal {
            padding-bottom: 40px;
        }
        
        /* PAGINACIÓN */
        .paginacion {
            display: flex;
            justify-content: center;
            gap: 10px;
            margin-top: 40px;
            margin-bottom: 60px;
        }
        
        .pag-btn {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            border: 2px solid var(--secondary);
            background: white;
            color: var(--primary);
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
        }
        
        .pag-btn:hover {
            background: var(--light);
            transform: translateY(-2px);
        }
        
        .pag-btn.active {
            background: var(--secondary);
            color: white;
        }

        /* ESTILOS SIMPLES PARA PRUEBA */
.libro-card-simple {
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    background: white;
    transition: transform 0.3s;
}

.libro-card-simple:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.portada-simple {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    overflow: hidden;
    border-radius: 5px;
}

.portada-img-simple {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: pointer;
}

.titulo-simple {
    font-size: 16px;
    font-weight: bold;
    margin: 10px 0;
    color: #333;
}

.precio-simple {
    color: #e74c3c;
    font-weight: bold;
    font-size: 18px;
    margin: 5px 0;
}

.paginas-simple {
    color: #7f8c8d;
    font-size: 14px;
}

/* FIX PARA VISOR: Grid de 3 columnas */
#visor-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 30px !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 20px !important;
}

/* Modal de selección de compra */
.modal-seleccion {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s;
}

.modal-seleccion-contenido {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    padding: 25px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-seleccion-contenido h3 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.4em;
}

.opciones-compra {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 25px 0;
}

.opcion {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.opcion:hover {
    border-color: #4CAF50;
    background: #f9f9f9;
    transform: translateY(-3px);
}

.opcion.seleccionada {
    border-color: #4CAF50;
    background: #e8f5e9;
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.2);
}

.opcion-icono {
    width: 50px;
    height: 50px;
    background: #f0f0f0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 1.5em;
    color: #555;
}

.opcion-pdf .opcion-icono { background: #e3f2fd; color: #2196F3; }
.opcion-fisico .opcion-icono { background: #e8f5e9; color: #4CAF50; }
.opcion-ambos .opcion-icono { background: #fff3e0; color: #FF9800; }

.opcion-info {
    flex: 1;
}

.opcion-info h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 1.1em;
}

.opcion-info p {
    margin: 0;
    color: #666;
    font-size: 0.9em;
}

.opcion-precio {
    font-weight: bold;
    font-size: 1.2em;
    margin-top: 5px;
}

.opcion-pdf .opcion-precio { color: #2196F3; }
.opcion-fisico .opcion-precio { color: #4CAF50; }
.opcion-ambos .opcion-precio { color: #FF9800; }

.modal-seleccion-acciones {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.modal-seleccion-acciones button {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-cancelar {
    background: #f44336;
    color: white;
}

.btn-cancelar:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

.btn-confirmar {
    background: #4CAF50;
    color: white;
}

.btn-confirmar:hover {
    background: #388E3C;
    transform: translateY(-2px);
}

.btn-confirmar:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

        /* Estilos para modal de login */
        .modal-login {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.7);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
            animation: fadeIn 0.3s;
        }

        .modal-login-contenido {
            background: white;
            padding: 30px;
            border-radius: 20px;
            max-width: 400px;
            width: 90%;
            text-align: center;
            box-shadow: 0 20px 40px rgba(0,0,0,0.3);
            position: relative;
            color: #333;
        }

        .modal-login-cerrar {
            position: absolute;
            top: 15px;
            right: 15px;
            background: none;
            border: none;
            font-size: 1.5em;
            color: #999;
            cursor: pointer;
        }

        .modal-login-cerrar:hover {
            color: #e74c3c;
        }

        .modal-login-tabs {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
            border-bottom: 1px solid #ddd;
            padding-bottom: 10px;
        }

        .tab-link {
            flex: 1;
            background: none;
            border: none;
            padding: 10px;
            font-weight: 600;
            color: #666;
            cursor: pointer;
            border-radius: 5px 5px 0 0;
        }

        .tab-link.active {
            color: var(--accent, #3498db);
            border-bottom: 3px solid var(--accent, #3498db);
        }

        .tab-content {
            display: none;
        }

        .tab-content.active {
            display: block;
        }

        .modal-login .form-group {
            margin-bottom: 15px;
            text-align: left;
        }

        .modal-login label {
            display: block;
            margin-bottom: 5px;
            font-weight: 500;
            color: #555;
        }

        .modal-login input {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 5px;
            font-size: 1rem;
            color: #333;
        }

        .modal-login .btn-login,
        .modal-login .btn-registro {
            width: 100%;
            padding: 12px;
            background: var(--accent, #3498db);
            color: white;
            border: none;
            border-radius: 5px;
            font-weight: 600;
            cursor: pointer;
            margin-top: 10px;
        }

        .modal-login .btn-login:hover,
        .modal-login .btn-registro:hover {
            background: var(--accent-hover, #2980b9);
        }

        .error-message {
            color: #e74c3c;
            font-size: 0.9rem;
            margin-top: 5px;
            min-height: 20px;
        }

        .acciones-container {
    margin-top: auto;
    padding-top: 15px;
}

.btn-accion {
    width: 100%;
}

.btn-carrito {
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-carrito:hover {
    transform: translateY(-4px);
}

/* ===================================== */
/* SOLUCIÓN DEFINITIVA BOTÓN COMPRAR */
/* ===================================== */

.libro-card {
    position: relative;
    overflow: visible !important;
}

.libro-card * {
    pointer-events: auto;
}

.libro-card::before,
.libro-card::after {
    pointer-events: none !important;
}

.portada-container,
.paginas-carousel,
.pagina-slide {
    pointer-events: none !important;
}

.acciones-container {
    position: relative;
    z-index: 50;
    margin-top: 20px;
}

.btn-accion,
.btn-carrito,
.btn-comprar {
    position: relative;
    z-index: 100;
    width: 100%;
    cursor: pointer;
    pointer-events: auto !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-comprar:hover {
    transform: translateY(-5px);
}
