/* --- ESTILOS GENERALES Y ESTRUCTURA --- */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background-color: #f8fafc;
}

.container-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
}

/* --- TOP BAR (RESPONSIVE) --- */
.top-bar {
    background: #1a252f;
    color: #ffffff;
    font-size: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.top-info {
    display: flex;
    gap: 15px;
}
.top-info .separator { opacity: 0.4; }
.top-whatsapp a {
    color: #2ecc71;
    text-decoration: none !important;
    font-weight: 600;
}
@media (max-width: 768px) {
    .top-bar .container-flex {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }
    .top-info { justify-content: center; font-size: 11px; }
    .top-whatsapp { font-size: 11px; }
}

/* --- HEADER PREMIUM (CORE FIX) --- */
.header-premium {
    background: #ffffff;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}
.logo-area img {
    height: 55px;
    width: auto;
    object-fit: contain;
}
.search-area {
    position: relative;
    flex: 0 1 500px;
    margin: 0 20px;
}
.search-area input {
    width: 100%;
    padding: 10px 45px 10px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 50px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.search-area input:focus { border-color: #f39c12; }
.search-area button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: #f87722;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
}

.login-link {
    border-left: 1px solid #e2e8f0;
    padding-left: 15px;
}
.btn-login {
    background: #f87722;
    color: #ffffff !important;
    padding: 8px 18px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}
.btn-login:hover { background: #f87722; }

/* Header Responsivo para Celulares */
@media (max-width: 768px) {
    .header-premium { padding: 10px 0; }
    .header-premium .container-flex {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 12px;
    }
    .logo-area img { height: 40px; }
    .search-area {
        grid-column: span 2;
        order: 3;
        margin: 0;
    }
    .cart-login-group {
        justify-content: flex-end;
    }
    .login-link { border: none; padding: 0; }
    .btn-login span { display: none; }
    .btn-login { padding: 10px; border-radius: 50%; }
    .btn-login i { font-size: 16px; margin: 0; }
}

/* --- NAVEGACIÓN Y DROPDOWNS PREMIUM --- */
.nav-premium {
    background: #2c3e50 !important;
    position: relative;
    z-index: 999;
}
.nav-premium .container-flex {
    justify-content: flex-start !important;
}
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    padding: 10px 0;
    cursor: pointer;
}
.nav-premium ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 45px;
}
.nav-premium ul li {
    position: relative;
    height: 100%;
}
.nav-premium ul li a {
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    height: 100%;
    transition: background 0.2s;
    text-transform: uppercase;
}
.nav-premium ul li.active a,
.nav-premium ul li a:hover {
    background: #f87722;
    color: #ffffff !important;
}

/* Submenú Flotante Desktop */
.has-submenu { position: relative; }
.submenu-toggle { display: none; }
.submenu-list {
    position: absolute;
    top: 100%;
    left: 0;
    background: #1a252f;
    min-width: 230px;
    display: none;
    flex-direction: column;
    height: auto !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    padding: 5px 0 !important;
}
.submenu-list li { width: 100%; height: auto !important; }
.submenu-list li a {
    padding: 12px 20px !important;
    font-size: 13px !important;
    text-transform: none !important;
    font-weight: 400 !important;
    justify-content: flex-start;
}
.submenu-list li a:hover { background: #2c3e50; }
.has-submenu:hover .submenu-list { display: flex; }

/* Menú Responsivo Móvil */
@media (max-width: 768px) {
    .mobile-menu-btn { display: block; }
    .nav-premium ul {
        display: none;
        flex-direction: column;
        width: 100%;
        height: auto;
        background: #2c3e50;
        position: absolute;
        top: 100%;
        left: 0;
        box-shadow: 0 10px 15px rgba(0,0,0,0.1);
    }
    .nav-premium ul.active { display: flex; }
    .nav-premium ul li { width: 100%; height: auto; border-bottom: 1px solid rgba(255,255,255,0.05); }
    .nav-premium ul li a { padding: 14px 20px; justify-content: space-between; }
    
    .has-submenu { display: flex; flex-wrap: wrap; }
    .has-submenu > a { flex: 1; }
    .submenu-toggle {
        display: flex !important;
        background: rgba(255,255,255,0.05);
        border: none;
        color: white;
        width: 50px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }
    .submenu-list {
        position: relative;
        width: 100%;
        background: #1a252f;
        box-shadow: none;
        display: none !important;
    }
    .submenu-list.open-mobile { display: flex !important; }
    .submenu-list li a { padding-left: 35px !important; }
}

.nav-fixed { position: fixed; top: 0; left: 0; width: 100%; }
.nav-placeholder { display: none; height: 45px; }

/* --- SECCIÓN PRODUCTOS ESTILO SODIMAC --- */
.sodimac-style-products {
    padding: 40px 0;
    background: #ffffff;
}
.container-flex-products {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 15px;
}
.section-title {
    font-size: 22px;
    font-weight: 800;
    color: #2c3e50;
    margin-bottom: 25px;
    border-left: 4px solid #f39c12;
    padding-left: 12px;
}
.section-title span { color: #f39c12; font-weight: 400; font-size: 16px; }

.product-grid-premium {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}
.product-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}
.product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}
.product-item .badge {
    position: absolute;
    top: 10px; left: 10px;
    background: #e74c3c;
    color: white; font-size: 10px; font-weight: 700;
    padding: 4px 8px; border-radius: 4px;
}
.product-item .badge.yellow { background: #f39c12; }
.img-responsive-compact {
    width: 100%;
    height: 160px;
    object-fit: contain;
    margin-bottom: 15px;
}
.product-detail .brand {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    margin: 0 0 4px 0;
}
.product-detail h4 {
    font-size: 13px;
    color: #334155;
    font-weight: 600;
    margin: 0 0 12px 0;
    line-height: 1.4;
    height: 38px;
    overflow: hidden;
}
.price-box { display: flex; align-items: baseline; gap: 6px; margin-bottom: 15px; }
.old-price { font-size: 11px; color: #94a3b8; text-decoration: line-through; }
.current-price { font-size: 16px; color: #2c3e50; font-weight: 700; }
.btn-sodimac-slim {
    width: 100%;
    background: #2c3e50;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
}
.btn-sodimac-slim:hover { background: #f39c12; }

@media (max-width: 1100px) { .product-grid-premium { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .product-grid-premium { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
@media (max-width: 480px) { .product-grid-premium { grid-template-columns: 1fr; } }

/* --- CONTENEDOR CATEGORÍAS (MAIN DE LA TIENDA) --- */
.main-container-categorias {
    max-width: 1300px;
    margin: 0 auto;
    padding: 40px 15px;
    flex-grow: 1;
}
.categorias-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
}
.categoria-item {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    text-decoration: none !important;
    transition: 0.3s;
}
.categoria-item:hover { transform: translateY(-5px); box-shadow: 0 12px 25px rgba(0,0,0,0.06); }
.categoria-img { height: 180px; overflow: hidden; }
.categoria-img img { width: 100%; height: 100%; object-fit: cover; }
.categoria-info { padding: 15px; text-align: center; }
.categoria-info h3 { font-size: 15px; font-weight: 700; color: #2c3e50; margin: 0 0 5px 0; }
.categoria-info p { font-size: 12px; color: #64748b; margin: 0; }

@media (max-width: 992px) { .categorias-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 550px) { .categorias-grid { grid-template-columns: 1fr; } }


/* ==========================================================================
   INTERFAZ DE CARRITO (ICONO Y PANEL LATERAL) - FIX ARKIDAL
   ========================================================================== */

/* 1. Icono en el Header y Contador */
.cart-login-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cart-area {
    cursor: pointer;
    position: relative;
    padding: 5px;
    display: inline-flex;
    align-items: center;
}

.cart-wrapper i {
    font-size: 24px;
    color: #2c3e50;
    transition: color 0.2s;
}

.cart-area:hover .cart-wrapper i {
    color: #f87722; /* Color naranja Arkidal al pasar el mouse */
}

#cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 50%;
    line-height: 1;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 2. Panel Lateral (Sidebar) - REFUERZO TOTAL */
body #cart-sidebar {
    position: fixed !important;
    top: 0 !important;
    right: -400px !important; /* Escondido por defecto */
    width: 350px !important;
    height: 100vh !important;
    background-color: #ffffff !important;
    z-index: 1000000 !important; /* Prioridad máxima sobre carrusel y menú */
    display: flex !important;
    flex-direction: column;
    padding: 25px;
    box-shadow: -10px 0 30px rgba(0,0,0,0.3) !important;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    visibility: visible !important;
}

/* Clase Activa (Cuando se abre) */
body #cart-sidebar.active {
    right: 0 !important;
}

/* 3. Overlay (Fondo oscuro) */
body .overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.7) !important;
    z-index: 999999 !important; /* Justo debajo del sidebar */
    display: none; /* Controlado por jQuery fadeToggle */
}

/* 4. Ajustes Internos del Carrito */
#cart-items-container {
    flex-grow: 1;
    overflow-y: auto;
    margin: 20px 0;
    padding-right: 5px;
}

/* Personalización del scrollbar del carrito */
#cart-items-container::-webkit-scrollbar {
    width: 6px;
}
#cart-items-container::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.cart-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 2px solid #f1f5f9;
}

#total-price {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}
/* --- ESTILOS DEL NUEVO FOOTER PREMIUM --- */
.footer-premium {
    background: #1a252f;
    color: #94a3b8;
    font-size: 13px;
    margin-top: auto;
    border-top: 4px solid #f39c12;
}
.footer-main {
    max-width: 1300px;
    margin: 0 auto;
    padding: 50px 15px 30px 15px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}
.footer-col h4 {
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 8px;
}
.footer-col h4::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    width: 35px; height: 2px;
    background: #f87722;
}
.footer-col p { line-height: 1.6; margin: 0 0 15px 0; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a {
    color: #94a3b8;
    text-decoration: none !important;
    transition: color 0.2s;
}
.footer-col ul li a:hover { color: #f39c12; padding-left: 5px; }
.footer-col ul li a i { margin-right: 8px; font-size: 11px; }

.footer-socials { display: flex; gap: 10px; margin-top: 15px; }
.footer-socials a {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.05);
    color: #ffffff;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    text-decoration: none !important;
    transition: 0.2s;
}
.footer-socials a:hover { background: #f39c12; transform: translateY(-3px); }

.footer-bottom {
    background: #111a22;
    padding: 20px 0;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.footer-bottom .container-flex {
    font-size: 12px;
}
.footer-payments i {
    font-size: 24px;
    margin-left: 10px;
    color: #cbd5e1;
}

@media (max-width: 992px) {
    .footer-main { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 550px) {
    .footer-main { grid-template-columns: 1fr; gap: 25px; text-align: center; }
    .footer-col h4::after { left: 50%; transform: translateX(-50%); }
    .footer-socials { justify-content: center; }
    .footer-bottom .container-flex { flex-direction: column; gap: 10px; text-align: center; }
}
/* =========================
   BANNER NUEVOS DISEÑOS
========================= */
.banner-novedades {
    background: linear-gradient(135deg, #2c3e50 0%, #000000 100%);
    color: #ffffff;
    padding: 60px 20px;
    margin: 40px 0;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.banner-content {
    max-width: 1200px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.banner-text {
    flex: 1;
    z-index: 2;
}

.tag-nuevo {
    background: #f39c12;
    color: #fff;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 3px;
    letter-spacing: 1px;
}

.banner-text h2 {
    font-size: 38px;
    font-weight: 700;
    margin: 15px 0;
    text-transform: uppercase;
}

.banner-text p {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 25px;
    max-width: 500px;
}

.btn-banner {
    display: inline-block;
    padding: 15px 35px;
    background: #fff;
    color: #2c3e50;
    font-weight: bold;
    text-decoration: none;
    border-radius: 5px;
    transition: 0.3s;
}

.btn-banner:hover {
    background: #f39c12;
    color: #fff;
    text-decoration: none;
}

.banner-image {
    flex: 0 0 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0.1;
    font-size: 200px;
}

/* Ajuste Móvil */
@media (max-width: 768px) {
    .banner-content {
        flex-direction: column;
        text-align: center;
    }
    .banner-text h2 {
        font-size: 28px;
    }
    .banner-image {
        display: none;
    }
}
/* =========================
   BANNER LOGÍSTICA COMPACTO
========================= */
.banner-logistica-obra-compact {
    position: relative;
    padding: 40px 0; /* Reducido de 100px a 40px */
    background: url('https://images.unsplash.com/photo-1541888946425-d81bb19480c5?auto=format&fit=crop&w=1920') no-repeat center center;
    background-size: cover;
    background-attachment: fixed;
    color: #fff;
    margin: 30px 0;
}

.overlay-obra {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

.obra-content-compact {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-around; /* Alinea texto y botón en la misma línea */
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.obra-text {
    flex: 1;
    min-width: 300px;
}

.obra-badge-mini {
    background: #f39c12;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 3px;
    display: inline-block;
    margin-bottom: 8px;
}

.obra-content-compact h2 {
    font-size: 26px; /* Tamaño más discreto */
    font-weight: 700;
    margin: 0 0 5px 0;
    text-transform: uppercase;
}

.obra-content-compact p {
    font-size: 15px;
    margin: 0;
    opacity: 0.9;
}

.btn-obra-slim {
    background: #e74c3c;
    color: white;
    padding: 12px 25px;
    font-weight: bold;
    font-size: 14px;
    border-radius: 4px;
    text-decoration: none;
    transition: 0.3s;
    white-space: nowrap;
}

.btn-obra-slim:hover {
    background: #c0392b;
    color: white;
    transform: scale(1.05);
}

/* Ajuste para móviles */
@media (max-width: 768px) {
    .obra-content-compact {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    .banner-logistica-obra-compact {
        padding: 30px 15px;
    }
}
/* =========================
   WHATSAPP FLOTANTE
========================= */
.whatsapp-float {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 25px;
    right: 25px;
    background-color: #25d366;
    color: #FFF;
    border-radius: 50px;
    text-align: center;
    font-size: 35px;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.3);
    z-index: 10000; /* Por encima de todo, incluso del sidebar */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-decoration: none;
}

.whatsapp-float:hover {
    background-color: #128c7e;
    color: #FFF;
    transform: scale(1.1);
    text-decoration: none;
}

/* Tooltip (Pequeño mensaje al lado) */
.tooltip-wsap {
    position: absolute;
    right: 70px;
    background: #333;
    color: #fff;
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 400;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.whatsapp-float:hover .tooltip-wsap {
    opacity: 1;
    visibility: visible;
}
/* =========================
   PRODUCTOS DESTACADOS
========================= */
.productos-destacados {
    padding: 60px 0;
    background: #fdfdfd;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 30px;
    border-left: 5px solid #e74c3c;
    padding-left: 15px;
}

.section-title span {
    color: #7f8c8d;
    font-weight: 300;
}

/* La rejilla mágica */
.product-grid-premium {
    display: grid;
    /* Crea columnas de al menos 250px, si no hay espacio, las apila */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.product-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    position: relative;
    padding: 15px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-item:hover {
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    transform: translateY(-5px);
}

.product-img-container {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 15px;
}

.product-img-container img {
    max-height: 100%;
    object-fit: contain;
}

/* Badges de oferta */
.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #e74c3c;
    color: #fff;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 3px;
    z-index: 10;
}

.badge.nuevo { background: #27ae60; }
.badge.dscto { background: #f39c12; }

.product-detail .brand {
    font-size: 11px;
    color: #95a5a6;
    font-weight: 600;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.product-detail h4 {
    font-size: 15px;
    color: #2c3e50;
    margin: 0 0 10px 0;
    height: 40px; /* Asegura que todos los títulos midan lo mismo */
    overflow: hidden;
}

.price-box {
    margin-bottom: 15px;
}

.old-price {
    text-decoration: line-through;
    color: #95a5a6;
    font-size: 13px;
    display: block;
}

.current-price {
    color: #e74c3c;
    font-size: 22px;
    font-weight: 700;
}

.btn-add-cart {
    width: 100%;
    background: #2c3e50;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.btn-add-cart:hover {
    background: #e74c3c;
}

/* AJUSTE PARA CELULARES PEQUEÑOS */
@media (max-width: 480px) {
    .product-grid-premium {
        /* En celulares muy pequeños, muestra 2 productos por fila si quieres, o 1 */
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }
    
    .product-detail h4 {
        font-size: 13px;
    }
    
    .current-price {
        font-size: 18px;
    }
}
