/* css/style.css - Premium Dark Mode Design */

/* Fuentes alojadas en local (antes @import de Google Fonts) */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url(fonts/outfit-variable.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: italic;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/playfair-display-italic-600.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/playfair-display-normal-600.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --bg-color: hsl(225, 10%, 8%);
    --bg-surface: hsl(225, 10%, 12%);
    --bg-glass: rgba(25, 26, 30, 0.6);
    --text-primary: hsl(0, 0%, 95%);
    --text-secondary: hsl(220, 10%, 70%);
    --accent: hsl(350, 80%, 55%);
    --accent-hover: hsl(350, 80%, 45%);
    --success: hsl(150, 70%, 40%);
    --hero-title: var(--text-primary);

    --font-heading: 'Playfair Display', serif;
    --font-body: 'Outfit', sans-serif;

    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* === Temas === */

/* Tema Medianoche (Negro Puro) */
body.theme-midnight {
    --bg-color: #000000;
    --bg-surface: #0a0a0a;
    --bg-glass: rgba(0, 0, 0, 0.8);
    --accent: #ffffff;
    --accent-hover: #cccccc;
}

/* Tema Royal (Azul y Oro) */
body.theme-royal {
    --bg-color: #0a192f;
    --bg-surface: #112240;
    --bg-glass: rgba(10, 25, 47, 0.7);
    --accent: #ffd700;
    --accent-hover: #ffad00;
}

/* Tema Esmeralda (Verde y Plata) */
body.theme-emerald {
    --bg-color: #06231a;
    --bg-surface: #0a3a2a;
    --bg-glass: rgba(6, 35, 26, 0.7);
    --accent: #2ecc71;
    --accent-hover: #27ae60;
}

/* Tema Lava (Naranja y Gris) */
body.theme-lava {
    --bg-color: #1a1a1a;
    --bg-surface: #262626;
    --bg-glass: rgba(26, 26, 26, 0.7);
    --accent: #ff4500;
    --accent-hover: #e63e00;
}

/* === Temas Light Mode === */

/* Tema Nieve (Blanco y Negro) */
body.theme-light {
    --bg-color: #f8f9fa;
    --bg-surface: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.8);
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --accent: #d32f2f;
    --accent-hover: #b71c1c;
    --hero-title: #000000;
}

/* Tema Sepia (Clásico y Cálido) */
body.theme-sepia {
    --bg-color: #f4ecd8;
    --bg-surface: #fdf6e3;
    --bg-glass: rgba(244, 236, 216, 0.7);
    --text-primary: #5b4636;
    --text-secondary: #8a735e;
    --accent: #a0522d;
    --accent-hover: #8b4513;
    --hero-title: #3d2b1f;
}

/* Tema Brisa (Azul Claro) */
body.theme-ocean {
    --bg-color: #eef2f3;
    --bg-surface: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --accent: #2980b9;
    --accent-hover: #1f6696;
    --hero-title: #1a252f;
}

/* === Nuevos Temas Premium === */

/* Tema Atardecer (Naranja/Rosado cálido) */
body.theme-sunset {
    --bg-color: #1a0f14;
    --bg-surface: #2d1b24;
    --bg-glass: rgba(45, 27, 36, 0.7);
    --accent: #ff7e67;
    --accent-hover: #ff5733;
    --text-primary: #fdf0f0;
}

/* Tema Bosque Profundo (Verde oscuro y madera) */
body.theme-forest {
    --bg-color: #0d1a11;
    --bg-surface: #15291b;
    --bg-glass: rgba(21, 41, 27, 0.7);
    --accent: #d4af37;
    /* Dorado hoja seca */
    --accent-hover: #c5a017;
    --text-primary: #e8f0e6;
}

/* Tema Cyberpunk (Neon, Negro, Magenta, Cyan) */
body.theme-cyberpunk {
    --bg-color: #050510;
    --bg-surface: #101026;
    --bg-glass: rgba(16, 16, 38, 0.8);
    --accent: #ff00ff;
    --accent-hover: #00ffff;
    --text-primary: #e0e0ff;
    --text-secondary: #8888cc;
}

/* Tema Café y Crema (Marrón, Beige, Dorado) */
body.theme-coffee {
    --bg-color: #f5f0e6;
    --bg-surface: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.8);
    --text-primary: #3b2818;
    --text-secondary: #6e4c2e;
    --accent: #b5651d;
    --accent-hover: #8a4813;
    --hero-title: #291a0e;
}

/* Tema Amatista (Púrpuras y violetas elegantes) */
body.theme-amethyst {
    --bg-color: #130b1c;
    --bg-surface: #221533;
    --bg-glass: rgba(34, 21, 51, 0.7);
    --accent: #b366ff;
    --accent-hover: #9933ff;
    --text-primary: #f0e6ff;
}

/* Tema Glaciar (Blancos, grises claros, cian hielo) */
body.theme-arctic {
    --bg-color: #f4f7f8;
    --bg-surface: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.8);
    --text-primary: #2a3439;
    --text-secondary: #607d8b;
    --accent: #00bcd4;
    --accent-hover: #0097a7;
    --hero-title: #1c2529;
}

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

html, 
body {
    --surface: var(--bg-surface);
    overflow-x: hidden;
    width: 100%;
    position: relative;
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 600;
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.8s ease-out forwards;
}

/* Navbar */
.navbar {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 99999;
    transform: translateZ(0);
    /* Force into 3D rendering context */
    padding: 10px 0;
    transition: var(--transition);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

/* Hamburger Menu Toggle */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    z-index: 100002;
    padding: 10px;
}

.menu-toggle span {
    display: block;
    width: 28px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 3px;
    transition: var(--transition);
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.cart-icon {
    position: relative;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.cart-icon:hover {
    transform: scale(1.1);
    color: var(--accent);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -12px;
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hero Section */
.hero {
    margin-top: 80px;
    min-height: 80vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: visible;
    z-index: 100;
    padding: 60px 0;
}

/* Abstract Background Glow */
.hero::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(220, 20, 60, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: -1;
    border-radius: 50%;
    filter: blur(40px);
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: flex-start;
    overflow: visible !important;
}

.hero-content {
    position: relative;
    z-index: 20;
    overflow: visible !important;
}

.hero-content h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 20px;
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;
    -webkit-text-fill-color: initial;
    margin-bottom: 1rem;
    color: var(--hero-title);
    letter-spacing: -1px;
}

.hero-content p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.hero-image {
    perspective: 1000px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.hero-image img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    transform: rotateY(-15deg) rotateX(5deg);
    transition: var(--transition);
}

.hero-image:hover img {
    transform: rotateY(0deg) rotateX(0deg) scale(1.05);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 10px 20px rgba(220, 20, 60, 0.3);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-3px);
    box-shadow: 0 15px 25px rgba(220, 20, 60, 0.4);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-primary);
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

/* Extra Books Section */
.catalog-section {
    padding: 80px 0;
    background-color: var(--bg-surface);
    position: relative;
    z-index: 1;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin: 0 auto 50px auto;
    position: relative;
    display: table;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 25%;
    width: 50%;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
}

.book-card {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
    text-align: center;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-10px);
    border-color: rgba(220, 20, 60, 0.3);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.book-img {
    height: 250px;
    background-color: transparent;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-style: italic;
    overflow: hidden;
}

.book-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.book-title, .book-info h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.book-author, .autor {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
    flex-grow: 1;
}

.book-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 15px;
}

/* Book Badges (Discount & Shipping) */
.book-badges {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    z-index: 15;
}

.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.1);
}

.badge-discount {
    background: var(--accent);
    color: white;
}

.badge-shipping {
    background: #2ecc71;
    color: white;
    display: flex;
    align-items: center;
    gap: 4px;
}

.badge-shipping::before {
    content: '🚚';
    font-size: 0.8rem;
}

/* Wishlist Button - Only for product page now */
.wishlist-btn { 
    outline: none; 
    background: rgba(0,0,0,0.5); 
    border: none; 
    border-radius: 50%; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: all 0.3s; 
    z-index: 10; 
    padding: 0;
}
.wishlist-btn:hover { background: rgba(255,255,255,0.2) !important; transform: scale(1.1); }
.wishlist-btn.active .heart-icon { color: #ff4757; }
.wishlist-btn .heart-icon::before { content: '🤍'; }
.wishlist-btn.active .heart-icon::before { content: '❤️'; animation: heartBeat 0.3s ease-in-out; }
@keyframes heartBeat { 0% { transform: scale(1); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* Footer */
/* Newsletter Section Styling - Unified with Search Bar */
.newsletter-section {
    margin: 80px 0;
    padding: 100px 0;
    background: var(--bg-surface);
    border-top: 1px solid rgba(128, 128, 128, 0.05);
}

.newsletter-title {
    font-size: 2.5rem;
}

.newsletter-form {
    display: flex;
    gap: 15px;
    /* Separate elements with a gap as in uno.png */
    max-width: 650px;
    margin: 0 auto;
    justify-content: center;
    background: transparent !important;
    /* Remove the container pill background */
    border: none !important;
    box-shadow: none !important;
}

.newsletter-input {
    flex: 1;
    background: var(--bg-color);
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 50px;
    /* Matching search bar */
    padding: 15px 30px;
    color: var(--text-primary);
    outline: none;
    font-size: 1.1rem;
    font-family: var(--font-body);
    transition: var(--transition);
}

body.theme-light .newsletter-input {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.15);
}

.newsletter-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(220, 20, 60, 0.1);
}

.newsletter-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.newsletter-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 15px 40px;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.newsletter-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 20, 60, 0.3);
}

footer {
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background-color: var(--bg-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Cart / Checkout Pages */
.page-container,
.admin-page-container {
    padding: 120px 0 60px;
    min-height: 80vh;
}

/* Quantity Input Styling */
.qty-input {
    width: 80px !important;
    text-align: center;
    background: var(--bg-color);
    border: 1px solid rgba(128, 128, 128, 0.4);
    border-radius: 8px;
    padding: 0.8rem !important;
    color: var(--text-primary);
    font-weight: 600;
    transition: var(--transition);
    outline: none;
    appearance: textfield;
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(220, 20, 60, 0.2);
    background: var(--bg-surface);
}

body.theme-light .qty-input {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.2);
}

.checkout-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.checkout-card {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cart-item:last-child {
    border-bottom: none;
}

.item-info h4 {
    margin-bottom: 5px;
}

.item-price {
    font-weight: 600;
    color: var(--accent);
}

/* Form Controls */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-body);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.summary-total {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--accent);
}

.discount-text {
    color: var(--success);
    font-size: 0.9rem;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.result-card {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.result-icon.success {
    color: var(--success);
}

.result-icon.error {
    color: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .container {
        padding: 0 15px; /* Ajustar padding lateral en móviles pequeños */
    }

    .hero {
        overflow: visible; /* Permitir que los menús desplegables se muestren sobre el contenido inferior */
        z-index: 100;
        padding: 40px 0;
    }

    .hero .container {
        grid-template-columns: 1fr;
        text-align: left;
        gap: 30px;
        overflow: visible !important;
    }

    .hero-image {
        order: -1;
        perspective: none; /* Quitar perspectiva en móvil para evitar artefactos visuales */
    }

    .hero-image img {
        transform: none !important; /* Quitar rotación 3D en móviles para evitar desbordamiento */
        max-width: 80%;
        margin: 0 auto;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .checkout-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Tabs & Format Selection --- */
.format-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 2rem;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    position: relative;
    transition: color 0.3s;
}

.tab-btn .tab-price {
    text-transform: none;
    font-weight: 500;
    font-size: 0.85em;
    letter-spacing: 0;
    opacity: 0.85;
}

.tab-btn.active {
    color: var(--text-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    position: relative;
    z-index: 10;
    overflow: visible !important;
}

.store-selector {
    position: relative;
    z-index: 15;
    overflow: visible !important;
}

.price-display {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    font-family: var(--font-display);
}

.format-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn-format {
    background: #000;
    color: #fff;
    border: none;
    padding: 1.2rem;
    width: 100%;
    max-width: 300px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s;
}

.btn-format:hover {
    opacity: 0.8;
}

.bookstore-select-container {
    position: relative;
    max-width: 300px;
    z-index: 50;
    overflow: visible !important;
}

.bookstore-trigger {
    background: #fff;
    color: #000;
    border: 1px solid #000;
    padding: 1rem;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
}

.bookstore-trigger i {
    transition: transform 0.3s;
}

.bookstore-trigger.active i {
    transform: rotate(180deg);
}

/* Búsqueda Predictiva */
.search-container {
    position: relative;
    margin: 0 1.5rem;
    flex: 1;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 0.8rem 1.2rem;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
    padding-right: 45px;
    /* Space for mic button */
}

.search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(255, 126, 95, 0.2);
}

.voice-search-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.voice-search-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.voice-search-btn.listening {
    color: var(--accent);
    animation: pulseMic 1.5s infinite;
    background: rgba(220, 20, 60, 0.2);
}

@keyframes pulseMic {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 20, 60, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(220, 20, 60, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(220, 20, 60, 0);
    }
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-radius: 12px;
    margin-top: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    max-height: 450px;
    /* Equivalente aprox. a 5 resultados visibles */
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100001;
    transform: translateZ(0);
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Scrollbar personalizado para la caja de búsqueda */
.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.search-results.show {
    display: block;
    animation: fadeInDown 0.3s ease;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.search-item img {
    width: 45px;
    height: 65px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.search-item-info {
    flex: 1;
}

.search-item-title {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.search-item-author {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.search-item-prices {
    font-size: 0.8rem;
    color: var(--accent);
    margin-top: 4px;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 992px) {
    .menu-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--bg-surface);
        flex-direction: column;
        justify-content: center;
        padding: 40px;
        transition: 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
        z-index: 100001;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links a {
        font-size: 1.2rem;
        width: 100%;
        text-align: center;
        padding: 15px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .logo {
        flex: 1;
        min-width: 0;
        font-size: 1.1rem;
        margin-right: 15px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .logo img {
        max-height: 30px !important;
    }

    .nav-actions {
        order: 2;
        gap: 15px;
        flex-shrink: 0;
    }

    .cart-icon {
        margin-right: 0;
    }

    .search-container {
        order: 3;
        flex: none; /* Asegurar que no intente crecer/encogerse con los de arriba */
        width: 100%;
        margin: 12px 0 5px 0;
        max-width: 100%;
    }

    .hero-content h1 {
        font-size: 2.8rem;
    }
}

@media (max-width: 576px) {
    .hero-content h1 {
        font-size: 2.2rem;
    }

    .newsletter-form {
        flex-direction: column;
    }

    .newsletter-btn {
        width: 100%;
    }

    .section-title,
    .newsletter-title {
        font-size: 1.8rem;
    }

    /* Admin Specific Responsive */
    .admin-search-bar {
        padding: 10px;
    }
    .admin-search-bar > div {
        flex-direction: column;
        gap: 8px !important;
    }
    .admin-search-bar input {
        width: 100%;
    }
    .admin-search-bar .btn {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    
    .admin-page-container {
        padding-top: 100px;
    }
    
    /* Flex headers in admin */
    .admin-page-container > div[style*="display: flex"] {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
        margin-bottom: 30px !important;
    }
    
    .admin-page-container > div[style*="display: flex"] .btn {
        width: 100%;
    }

    /* Admin filter forms */
    form[method="GET"][style*="display: flex"] {
        flex-direction: column;
        align-items: stretch !important;
        width: 100%;
    }
    
    #custom-dates {
        flex-direction: column;
        align-items: stretch !important;
    }

    /* Coupons & Newsletter layouts */
    .coupon-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    .coupon-form {
        position: static !important;
        order: -1; /* Show form first on mobile */
    }
    
    /* Tables in boxes */
    .admin-box table, .admin-card table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .actions .btn {
        width: 100%;
        text-align: center;
    }
}

.bookstore-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #000;
    border-top: none;
    display: none;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.bookstore-dropdown.show {
    display: block;
}

.bookstore-item {
    padding: 0.8rem 1rem;
    color: #000;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: 600;
}

.bookstore-item:hover {
    background: #f5f5f5;
}

/* === Formatted Text Styling (e.g. from TinyMCE) === */
.product-description {
    line-height: 1.6;
    color: var(--text-secondary);
}

.product-description p {
    margin-bottom: 1.2rem;
}

.product-description ul, 
.product-description ol {
    margin-left: 2rem;
    margin-bottom: 1.5rem;
}

.product-description ul {
    list-style-type: disc;
}

.product-description ol {
    list-style-type: decimal;
}

.product-description li {
    margin-bottom: 0.5rem;
}

.product-description li:last-child {
    margin-bottom: 0;
}

.product-description strong, 
.product-description b {
    font-weight: 700;
    color: var(--text-primary);
}

.product-description em, 
.product-description i {
    font-style: italic;
}

/* === Lee Gratis Feature & Redesigned Newsletter === */

/* Nav Badge NUEVO */
.nav-badge-new {
    background: var(--accent, #dc143c);
    color: #ffffff !important;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: 0.5px;
    display: inline-block;
    line-height: 1;
}

/* Home Section: Empieza a leer antes de decidir (Fondo diferenciado según PDF 1) */
.free-chapter-section {
    padding: 75px 0 65px;
    background-color: #121318;
    background-image: radial-gradient(circle at 90% 15%, rgba(220, 20, 60, 0.08) 0%, transparent 60%);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 2;
}

body.theme-light .free-chapter-section {
    background-color: #f6f0ea !important; /* Tono arena / pergamino suave claramente distinguible del blanco */
    background-image: none !important;
    border-top: 1px solid #e8ded4 !important;
    border-bottom: 1px solid #e8ded4 !important;
}

.free-chapter-section .book-card {
    background: var(--bg-color, #111216);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.free-chapter-section .book-card:hover {
    transform: translateY(-8px);
    border-color: rgba(220, 20, 60, 0.4);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
}

body.theme-light .free-chapter-section .book-card {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 6px 18px rgba(90, 70, 50, 0.08) !important;
}

body.theme-light .free-chapter-section .book-card:hover {
    border-color: rgba(220, 20, 60, 0.4) !important;
    box-shadow: 0 14px 28px rgba(90, 70, 50, 0.15) !important;
}

.free-chapter-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 35px;
    gap: 20px;
    flex-wrap: wrap;
}

.free-chapter-header-left {
    max-width: 650px;
}

.free-chapter-eyebrow {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent, #dc143c);
    margin-bottom: 8px;
    display: block;
}

.free-chapter-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px;
    line-height: 1.2;
}

.free-chapter-desc {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.5;
    margin: 0;
}

.btn-dark-pill {
    background: #18191c;
    color: #ffffff !important;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-dark-pill:hover {
    background: #000000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Grid 5 columnas para la Home */
.free-books-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 24px;
}

@media (max-width: 1100px) {
    .free-books-grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .free-books-grid-5 {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .free-books-grid-5 {
        grid-template-columns: 1fr;
    }
}

/* Tarjeta Home */
.free-book-card {
    display: flex;
    flex-direction: column;
    text-align: left;
    transition: transform 0.3s ease;
}

.free-book-card:hover {
    transform: translateY(-6px);
}

.free-book-cover-wrap {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1 / 1.45;
    background: #f0f0f0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 12px;
}

.free-book-cover-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.free-book-card:hover .free-book-cover-wrap img {
    transform: scale(1.03);
}

.free-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ffffff;
    color: #111111;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 2;
    pointer-events: none;
}

.free-book-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
}

.free-book-title:hover {
    color: var(--accent, #dc143c);
}

.free-book-author {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.free-book-link {
    color: var(--accent, #dc143c);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
    transition: gap 0.2s ease;
}

.free-book-link:hover {
    gap: 8px;
}

/* === Página Lee Gratis (lee-gratis.php) === */

.free-breadcrumbs {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 45px 0 35px;
}

.free-breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
}

.free-breadcrumbs a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.free-page-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
    margin-top: 10px;
    margin-bottom: 50px;
    flex-wrap: wrap;
}

/* Paginación Lee Gratis */
.free-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 40px 0 50px;
    flex-wrap: wrap;
}

.free-page-btn {
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #ffffff;
    color: var(--text-primary);
}

body:not(.theme-light) .free-page-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.free-page-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

body:not(.theme-light) .free-page-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.free-page-btn.active {
    background: var(--accent, #dc143c) !important;
    color: #ffffff !important;
    border-color: var(--accent, #dc143c) !important;
    box-shadow: 0 4px 10px rgba(220, 20, 60, 0.3);
}

.free-page-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.free-page-hero-left {
    flex: 1 1 500px;
}

.free-page-hero-left h1 {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.15;
    margin: 0 0 16px;
}

.free-page-hero-left p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
    max-width: 540px;
}

.free-page-steps {
    flex: 0 1 400px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: rgba(0, 0, 0, 0.02);
    padding: 20px 24px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

body:not(.theme-light) .free-page-steps {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.free-step-item {
    display: flex;
    align-items: center;
    gap: 14px;
}

.free-step-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent, #dc143c);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    flex-shrink: 0;
}

.free-step-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Barra de filtros por categoría */
.free-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 35px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body:not(.theme-light) .free-filter-bar {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.free-filter-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.free-filter-tab {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.free-filter-tab:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.04);
}

body:not(.theme-light) .free-filter-tab:hover {
    background: rgba(255, 255, 255, 0.06);
}

.free-filter-tab.active {
    background: #111111;
    color: #ffffff !important;
    font-weight: 600;
}

body:not(.theme-light) .free-filter-tab.active {
    background: #ffffff;
    color: #111111 !important;
}

.free-filter-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Grid 4 columnas para Lee Gratis */
.free-books-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
    margin-bottom: 60px;
}

@media (max-width: 1024px) {
    .free-books-grid-4 {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .free-books-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .free-books-grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Tarjeta Completa (Lee Gratis) */
.free-book-full-card {
    display: flex;
    flex-direction: column;
    text-align: left;
    transition: transform 0.3s ease;
}

.free-book-full-card:hover {
    transform: translateY(-6px);
}

.free-book-cat-tag {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-secondary);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin: 6px 0 4px;
}

.btn-free-download {
    background: var(--accent, #dc143c);
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    padding: 12px 16px;
    width: 100%;
    font-weight: 600;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    margin-top: auto;
    transition: background 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 10px rgba(220, 20, 60, 0.2);
}

.btn-free-download:hover {
    background: var(--accent-hover, #b81033);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(220, 20, 60, 0.3);
}

.link-free-buy {
    display: block;
    text-align: center;
    margin-top: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    transition: color 0.2s ease;
}

.link-free-buy:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* === Rediseño de Newsletter (PDF 2) === */
.newsletter-card-v2 {
    background: #111215;
    border-radius: 14px;
    padding: 45px 50px;
    color: #ffffff;
    margin: 60px auto 40px;
    max-width: 960px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 850px) {
    .newsletter-card-v2 {
        flex-direction: column;
        align-items: stretch;
        padding: 35px 25px;
        gap: 25px;
    }
}

.newsletter-v2-info {
    flex: 1 1 450px;
}

.newsletter-v2-title {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 10px;
    line-height: 1.25;
}

.newsletter-v2-desc {
    color: #a5a8b0;
    font-size: 0.98rem;
    line-height: 1.5;
    margin: 0;
}

.newsletter-v2-form-wrap {
    flex: 0 1 400px;
}

.newsletter-v2-label {
    display: block;
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.newsletter-v2-form-row {
    display: flex;
    gap: 8px;
}

@media (max-width: 480px) {
    .newsletter-v2-form-row {
        flex-direction: column;
    }
}

.newsletter-v2-input {
    flex: 1;
    background: #1c1d22 !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.newsletter-v2-input::placeholder {
    color: #6c707a;
}

.newsletter-v2-input:focus {
    border-color: var(--accent, #dc143c) !important;
}

.newsletter-v2-btn {
    background: var(--accent, #dc143c);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 12px 22px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.newsletter-v2-btn:hover {
    background: var(--accent-hover, #b81033);
    transform: translateY(-1px);
}

/* ==========================================================
   Cabecera ancha (index.php): clase .navbar--wide
   Escritorio: logo | menú centrado | buscador | carrito al borde derecho
   Móvil/tablet (<=992px): se mantiene el menú hamburguesa de siempre
   ========================================================== */
.cart-icon .icon,
.voice-search-btn .icon { display: block; flex: none; }

.navbar--wide .container {
    max-width: none;
    padding: 0 clamp(20px, 2.4vw, 48px);
}

.voice-search-btn { color: var(--text-secondary); }
.voice-search-btn:hover { color: var(--accent); }

@media (min-width: 993px) {
    .navbar--wide { padding: 16px 0; }

    .navbar--wide .container {
        flex-wrap: wrap;
        justify-content: flex-start;
        column-gap: clamp(20px, 2.2vw, 44px);
        row-gap: 12px;
    }

    .navbar--wide .logo { order: 1; flex: none; }

    .navbar--wide .nav-links {
        order: 2;
        flex: 1 1 auto;
        justify-content: center;
        gap: clamp(16px, 1.9vw, 40px);
    }

    .navbar--wide .nav-links a {
        position: relative;
        padding: 8px 0;
        font-size: 0.92rem;
        font-weight: 500;
        letter-spacing: 0.015em;
        white-space: nowrap;
        color: var(--text-secondary);
    }

    .navbar--wide .nav-links a::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: 2px;
        height: 1px;
        background: var(--accent);
        transform: scaleX(0);
        transform-origin: left;
        transition: transform 0.25s ease;
    }

    .navbar--wide .nav-links a:hover,
    .navbar--wide .nav-links a:focus-visible { color: var(--text-primary); }

    .navbar--wide .nav-links a:hover::after,
    .navbar--wide .nav-links a:focus-visible::after { transform: scaleX(1); }

    .navbar--wide .search-container {
        order: 3;
        margin: 0;
        flex: 0 1 clamp(200px, 18vw, 320px);
        max-width: none;
    }

    .navbar--wide .nav-actions { order: 4; margin-left: 0; }

    .navbar--wide .cart-icon { padding: 6px; }
    .navbar--wide .cart-count { top: -2px; right: -4px; }
}

/* Anchos medios: el buscador baja a una segunda fila para que el menú respire */
@media (min-width: 993px) and (max-width: 1199px) {
    .navbar--wide .search-container {
        order: 5;
        flex: 1 1 100%;
        max-width: 560px;
        margin: 0 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .navbar--wide .nav-links a::after { transition: none; }
}

/* Resultados del buscador (cabecera ancha): la caja crece hacia el centro de la pantalla */
@media (min-width: 1200px) {
    .navbar--wide .search-results {
        left: auto;
        right: 0;
        width: clamp(440px, 42vw, 680px);
        max-height: min(560px, calc(100vh - 110px));
    }
}

/* Enlace activo de la cabecera común (includes/header.php) */
.navbar--wide .nav-links a.is-active { color: var(--accent); }
@media (min-width: 993px) {
    .navbar--wide .nav-links a.is-active { color: var(--text-primary); }
    .navbar--wide .nav-links a.is-active::after { transform: scaleX(1); }
}
