:root {
    /* --- SYSTEM: BREAKPOINTS (REM) --- */
    /* Base 16px. sm=640px, md=768px, lg=1024px, xl=1280px */
    --bp-sm: 40rem;
    --bp-md: 48rem;
    --bp-lg: 64rem;
    --bp-xl: 80rem;

    /* --- SYSTEM: COLORS --- */
    
    /* Primary (Brand Action) */
    --col-primary: #2563eb;       /* Azul Eléctrico */
    --col-primary-hover: #1d4ed8; /* Azul Oscuro (Hover) */
    
    /* Secondary (Surface & UI) */
    --col-secondary: #f8fafc;        /* Paneles / Tarjetas */
    --col-secondary-border: #e2e8f0; /* Bordes sutiles */
    
    /* Tertiary (Accents & Status) */
    --col-tertiary: #f59e0b;      /* Ambar / Highlight */
    --col-tertiary-hot: #ef4444;  /* Rojo / Hot Deals */
    --col-tertiary-hot-text: #ffe6e6;

    /* Backgrounds */
    --bg-main: #f1f5f9;           /* Fondo general (Claro) */
    --bg-input: #ffffff;          /* Fondo inputs */
    --bg-white: #ffffff;          /* Blanco puro */
    --bg-nav: #ffffff;           /* Fondo navegación */
    --bg-code: #0a0a0a;           /* Fondo terminal/terminal */
    --bg-code-secondary: #1e293b;  /* Fondo terminal (oscuro) */

    /* Text */
    --text-main: #1e293b;         /* Texto principal (Oscuro) */
    --text-muted: #64748b;        /* Texto secundario (Gris) */
    --text-inverse: #1e293b;      /* Texto sobre fondos claros */
    --text-dark: #000000;         /* Texto sobre fondos claros (para badges) */
    --text-light: #ffffff;        /* Texto sobre fondos oscuros */
    --text-code: #e6e6e6;         /* Texto terminal */


    /* Typography */
    --font-main: 'Plus Jakarta Sans', sans-serif;
    --font-heading: 'Space Grotesk', sans-serif;

    font-display: swap;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-main);
    line-height: 1.5;
}

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

button ,a, input[type="submit"], input[type="reset"], input[type="button"], input[type="file"], input[type="checkbox"], input[type="radio"], input[type="range"], select, textarea, details, summary, summary::after, summary::-webkit-details-marker, input[type="text"] {
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-select {
    background: var(--col-primary);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

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

/* Header */
.tech-header {
    background-color: var(--col-secondary);
    border-bottom: 1px solid var(--col-secondary-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar { padding: 15px 0; }

.brand-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-inverse);
    text-decoration: none;
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex-shrink: 1;
}

.brand-logo span:last-child { color: var(--col-primary); }

/* Mobile Menu Button (Hidden by default) */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    font-size: 28px;
}

.search-box {
    flex-grow: 1;
    margin: 0 40px;
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--col-secondary-border);
    border-radius: 6px;
    padding: 5px;
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-inverse);
    width: 100%;
    padding: 0 15px;
    outline: none;
}

.search-box button {
    background: var(--col-primary);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.user-name {
    text-align:center;
}

.user-nav { display: flex; gap: 20px; }
.user-nav form { display: flex; margin: 0; padding: 0; border: none; background: none; line-height: 0; }
.icon-btn { color: var(--text-main); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; position: relative; transition: color 0.3s; background: none; border: none; padding: 0; cursor: pointer; font-family: inherit; appearance: none; -webkit-appearance: none; line-height: 1; }
.icon-btn:hover { color: var(--col-primary); }

.badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--col-tertiary);
    color: var(--text-dark);
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Nav */
.main-nav { border-top: 1px solid var(--col-secondary-border); background: var(--bg-nav); }
.nav-list {
    display: flex;
    list-style: none;
    gap: 30px;
    padding: 12px 0;
    min-width: max-content; /* Prevent items from being squeezed */
}

/* Responsive nav overflow handling */
#main-nav > div {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch; /* Smooth scroll iOS */
}

#main-nav > div::-webkit-scrollbar {
    height: 6px;
}
#main-nav > div::-webkit-scrollbar-thumb {
    background: var(--col-secondary-border);
    border-radius: 3px;
}

#main-nav > div {
    scrollbar-width: thin;
    scrollbar-color: var(--col-primary) var(--col-secondary-border);
}

.nav-list a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-list a:hover, .nav-list a.active { color: var(--text-inverse); }
.nav-list .special a { color: var(--col-tertiary); }

/* Category Strip */
.category-strip { padding: 30px 0; background: var(--bg-main); }
.cat-grid { display: flex; justify-content: center; gap: 40px; }
.cat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    min-width: 80px; /* Ensure click area on mobile */
}
.cat-item:hover { color: var(--col-primary); transform: translateY(-3px); }
.cat-item span { 
    font-size: 32px; 
    margin-bottom: 8px; 
    background: var(--col-secondary); 
    padding: 15px; 
    border-radius: 50%; 
}

/* Responsive: switch cat-item to row layout and shrink icon on smaller viewports */
@media (max-width: 48rem) {
    .cat-grid {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    .cat-item {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }
    .cat-item span {
        font-size: 20px;
        margin-bottom: 0;
        padding: 10px;
    }
}

.categories-container {
    display: flex;
    width: 100%;
    justify-content: space-around;
}

@media (max-width: 1150px) {
    .categories-container {
        .trusted-by {
            display: none;
        }
    
        width: 100%;
        justify-content: flex-start;

        .category-strip .container .cat-grid {
            display: flex;
            align-items: start;
        }
    }
}

/* Trusted Brands */
.trusted-by { padding: 40px 0; text-align: center; border-top: 1px solid var(--col-secondary-border); border-bottom: 1px solid var(--col-secondary-border); }
.trusted-by p { color: var(--text-muted); font-size: 14px; font-weight: 500; margin-bottom: 20px; text-transform: uppercase; letter-spacing: 0.5px; }
.trusted-logos { display: flex; justify-content: center; align-items: center; gap: 30px; flex-wrap: wrap; }
.trusted-logos .brand-logo { height: 32px; width: auto; opacity: 0.7; transition: opacity 0.2s; filter: grayscale(100%); }
.trusted-logos .brand-logo:hover { opacity: 1; filter: grayscale(0%); }

/* --- CART DRAWER COMPONENT --- */

/* Fondo oscuro (Overlay) */
.cart-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 210ms ease;
}

.cart-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* Panel Lateral */
.cart-drawer {
    position: fixed;
    top: 0; right: 0;
    width: 100%;
    max-width: 420px; /* Ancho en desktop */
    height: 100vh;
    background: var(--col-secondary);
    border-left: 1px solid var(--col-secondary-border);
    z-index: 999;
    
    /* Estado inicial: Fuera de pantalla a la derecha */
    transform: translateX(100%);
    transition: transform 210ms ease-in-out;
    
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}

.cart-drawer.open {
    transform: translateX(0); /* Estado abierto: En pantalla */
}

/* Header del Carrito */
.cart-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--col-secondary-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-nav);
}

.cart-header h3 { color: var(--text-inverse); margin: 0; font-size: 18px; }

.close-cart {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.close-cart:hover { color: var(--col-tertiary-hot); }

/* Lista de Items */
.cart-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Scrollbar personalizado para el carrito */
.cart-items::-webkit-scrollbar { width: 6px; }
.cart-items::-webkit-scrollbar-thumb { background: var(--col-secondary-border); border-radius: 3px; }

/* Item Individual */
.cart-item {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    background: var(--bg-main);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.cart-item:hover { border-color: var(--col-secondary-border); }

.cart-item img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    background: white;
    border-radius: 6px;
    padding: 5px;
}

.cart-item-details { 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
}

.cart-item-details h4 { 
    font-size: 14px; 
    color: var(--text-inverse); 
    margin: 0 0 5px 0; 
    line-height: 1.3;
}

.cart-item-details .price { 
    color: var(--col-primary); 
    font-weight: 700; 
    font-size: 15px; 
}

.remove-btn {
    border-radius: 0.3rem;
    font-weight: 600;
    text-decoration: none;
    align-self: flex-start;
    color: var(--col-tertiary-hot-text);
    background: var(--col-tertiary-hot);
    border: none;
    padding: 0.4rem;
    cursor: pointer;
    font-size: 12px;
    margin-top: 0.4rem;
}

/* Footer del Carrito */
.cart-footer {
    padding: 25px;
    border-top: 1px solid var(--col-secondary-border);
    background: var(--bg-nav);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-weight: 700;
    color: var(--text-inverse);
    font-size: 20px;
}

.checkout-btn {
    width: 100%;
    text-align: center;
    padding: 15px;
    font-size: 16px;
    display: block;
    cursor: pointer;
}

.empty-msg {
    text-align: center;
    color: var(--text-muted);
    margin-top: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* --- HERO CAROUSEL (SWIPER) --- */

.hero-section {
    margin-bottom: 40px;
    /* Evitar saltos de layout al cargar, pero permitir crecer */
    min-height: 380px; 
}

.hero-swiper {
    border-radius: 12px;
    border: 1px solid var(--col-secondary-border);
    overflow: hidden;
    /* FIX RESPONSIVE: Eliminar altura fija que corta el contenido */
    height: auto; 
}

/* FIX RESPONSIVE: Estirar slides a la altura del más alto */
.hero-swiper .swiper-wrapper {
    align-items: stretch;
}

/* FIX RESPONSIVE: Slide flexible */
.hero-swiper .swiper-slide {
    height: auto;
    display: flex;
}

.hero-banner {
    width: 100%;
    /* Altura mínima para desktop, pero flexible para crecer */
    min-height: 400px;
    height: 100%; /* Llena toda la altura del slide */
    padding: 60px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-size: cover;
    background-position: center;
    box-sizing: border-box; /* Importante para que el padding no rompa anchos */
}

/* Slide Branding (Estático) */
.branding-slide {
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
}

/* Slide Producto (Dinámico) */
.product-slide {
    background: var(--col-secondary);
    border-left: 4px solid var(--col-primary);
}

.hero-content {
    z-index: 10;
    width: 50%;
    padding-right: 20px;
}

/* FIX RESPONSIVE: Tipografía fluida (Clamp) */
.hero-content h1 {
    font-size: clamp(24px, 4vw, 42px);
    line-height: 1.1;
    margin: 15px 0;
    color: var(--text-inverse);
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.price-highlight {
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 700;
    color: var(--col-tertiary);
    margin-bottom: 15px;
}

.specs-mini {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.specs-mini span {
    background: rgba(0,0,0,0.05);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-muted);
    border: 1px solid var(--col-secondary-border);
}

.hero-image-container {
    width: 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    /* Sin altura fija para permitir flexibilidad */
}

.hero-image-container img {
    max-width: 100%;
    max-height: 350px; /* Límite visual para desktop */
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5));
    transition: transform 0.4s ease;
}

.swiper-slide-active .hero-image-container img {
    transform: scale(1.05) translateY(-10px);
}

.bg-accent { background: var(--col-tertiary-hot); }

/* Personalización de Controles Swiper */
.swiper-button-next, .swiper-button-prev {
    color: var(--col-primary);
    background: rgba(0,0,0,0.08);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    backdrop-filter: blur(4px);
    z-index: 20;
}

.swiper-button-next:after, .swiper-button-prev:after {
    font-size: 18px;
    font-weight: bold;
}

/* Products */
.product-section { padding-bottom: 60px; }
.section-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 25px; }
.section-header h2 { font-size: 24px; color: var(--text-inverse); }
.view-all { color: var(--col-primary); text-decoration: none; display: flex; align-items: center; gap: 5px; font-size: 14px; }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 25px;
}

.tech-card {
    background: var(--col-secondary);
    border: 1px solid var(--col-secondary-border);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.tech-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border-color: var(--col-primary);
}

.badge-hot {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--col-tertiary-hot);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 10;
}

.img-wrapper {
    height: 200px;
    padding: 20px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.card-body { padding: 15px; flex-grow: 1; }
.card-body .category { color: var(--col-primary); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }
.card-body h3 { font-size: 15px; color: var(--text-inverse); margin: 8px 0; font-weight: 600; }

.specs-preview { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 15px; }
.spec-tag { background: #2d3748; color: #cbd5e1; font-size: 10px; padding: 2px 6px; border-radius: 3px; }

.price-block .price { font-size: 18px; font-weight: 700; color: var(--text-inverse); }

.card-footer { padding: 0 15px 15px; }
.btn-add-cart {
    width: 100%;
    background: transparent;
    border: 1px solid var(--col-secondary-border);
    color: var(--text-main);
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-add-cart:hover { background: var(--col-primary); border-color: var(--col-primary); color: white; }

.tech-footer { border-top: 1px solid var(--col-secondary-border); padding: 40px 0; margin-top: 40px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* --- RESPONSIVE MEDIA QUERIES --- */

/* Tablet & Mobile (Below 768px / 48rem) */
@media (max-width: 48rem) {
    /* Top Bar Stacking */
    .top-bar .container {
        flex-wrap: wrap;
        gap: 15px;
    }

    .brand-logo {
        flex-grow: 1; /* Logo takes available space */
    }

    /* Search Box moves to its own line */
    .search-box {
        order: 3; /* Push to bottom of flex container */
        width: 100%;
        margin: 5px 0;
    }

    .user-nav {
        order: 2; /* Nav next to logo */
        flex-wrap: wrap;
        gap: 10px;
        justify-content: flex-end;
        flex: 1 1 auto;
        min-width: 0;
    }

    .user-nav .user-name {
        display: none;
    }

    .user-nav .icon-btn {
        padding: 4px 6px;
    }

    .user-nav .icon-btn .material-icons-round {
        font-size: 20px;
    }

    /* Hamburger Button */
    .mobile-menu-toggle {
        display: block; /* Show hamburger */
        order: 0;
        margin-right: 15px;
    }

    /* Navigation Drawer */
    .main-nav {
        display: none; /* Hidden by default */
        border-bottom: 1px solid var(--col-secondary-border);
    }

    .main-nav.active {
        display: block; /* Show when toggled */
        animation: slideDown 0.3s ease-out;
    }

    .nav-list {
        flex-direction: column; /* Vertical list */
        gap: 0;
        padding: 0;
    }

    .nav-list li {
        border-bottom: 1px solid var(--col-secondary-border);
    }

    .nav-list a {
        display: block;
        padding: 15px 20px;
    }

    /* Scrollable Categories */
    .category-strip {
        padding: 20px 0;
    }
    
    .cat-grid {
        justify-content: flex-start; /* Align left to allow scroll */
        overflow-x: auto; /* Enable scroll */
        padding-bottom: 10px; /* Space for scrollbar */
        gap: 20px;
        -webkit-overflow-scrolling: touch; /* Smooth scroll iOS */
    }

    /* Hero Text Resize */
    .hero-banner {
        flex-direction: column-reverse; /* Imagen arriba, texto abajo en móvil */
        height: auto;
        min-height: auto; /* Dejar que el contenido mande */
        padding: 40px 20px;
        text-align: center;
        justify-content: flex-end;
    }

    .hero-content {
        width: 100%;
        max-width: 100%;
        margin-top: 20px;
        padding-right: 0;
    }

    .hero-content h1 {
        font-size: 28px;
    }
    
    .hero-image-container {
        width: 100%;
        height: 200px;
        margin-bottom: 10px;
    }
    
    .hero-image-container img {
        max-height: 100%;
        width: auto;
    }

    .specs-mini {
        justify-content: center;
    }

    .swiper-button-next, .swiper-button-prev {
        display: none; /* Ocultar flechas en móvil */
    }

    /* Grid Adjustments */
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr)); /* 1 column on very small screens */
    }
}

/* Small Mobile (Below 480px) */
@media (max-width: 30rem) {
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .view-all span { display: none; } /* Hide arrow on tiny screens */
}

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

.tag {
    padding: 0.4rem 0.5rem;
    border-radius: 0.3rem 0.6rem 0.3rem 0.6rem;
    color: var(--text-light);
}

.btn-primary {
    background: var(--col-primary);
    color: white;
    border: 1px solid var(--col-primary);
    font-weight: 600;
    border-radius: 0.4rem;
    text-decoration: none;
    padding: 0.6rem 0.8rem;
}

/* --- PROMO TICKER BAR --- */
.promo-ticker-wrap {
    width: 100%;
    background-color: var(--col-tertiary); /* Color Ámbar llamativo */
    color: #1e293b;
    overflow: hidden;
    height: 36px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--col-tertiary-hot);
    position: relative;
    z-index: 90;
}

.promo-ticker-track {
    display: flex;
    /* La animación mueve el contenido a la izquierda indefinidamente */
    animation: tickerScroll 25s linear infinite;
    width: max-content; /* Asegura que el ancho se ajuste al contenido */
}

/* Pausar animación al pasar el mouse para leer con calma */
.promo-ticker-wrap:hover .promo-ticker-track {
    animation-play-state: paused;
}

.ticker-content {
    display: flex;
    align-items: center;
    flex-shrink: 0; /* Evita que se encoja */
}

.ticker-item {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
}

.ticker-item .material-icons-round {
    font-size: 16px;
}

.ticker-separator {
    margin: 0 15px;
    opacity: 0.5;
}

@keyframes tickerScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); } /* Se mueve la mitad (el primer bloque) y se reinicia instantáneamente */
}
