/* =====================================================
   BENSAL INDUSTRIA QUÍMICA — Estilos personalizados
   ===================================================== */

/* --- Global: evitar scroll horizontal en mobile --- */
html, body { overflow-x: hidden; }

/* --- Navbar (siempre blanca) --- */
#navbar {
    background: #ffffff;
    box-shadow: 0 1px 12px rgba(0,0,0,0.08);
}

.nav-link { color: #1e3a5f; transition: color 0.2s; }
.nav-link:hover { color: #f59e0b; }

.nav-active {
    color: #f59e0b !important;
    background: rgba(245,158,11,0.1);
    border-radius: 8px;
}

/* --- Mobile menu links --- */
.mobile-nav-link {
    display: block;
    padding: 0.875rem 1rem;
    color: rgba(255,255,255,0.88);
    font-size: 1rem;
    font-weight: 500;
    border-radius: 10px;
    margin-bottom: 2px;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}
.mobile-nav-link:hover  { background: rgba(255,255,255,0.1); color: #ffffff; }
.mobile-nav-active      { background: rgba(245,158,11,0.18); color: #f59e0b !important; font-weight: 700; }

.mobile-nav-cta {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.875rem;
    background: #f59e0b;
    color: #fff;
    font-weight: 700;
    font-size: 0.9375rem;
    border-radius: 10px;
    transition: background 0.2s;
    text-decoration: none;
}
.mobile-nav-cta:hover { background: #d97706; }

/* Mobile menu slide animation */
@keyframes menuSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
#mobile-menu[data-open="true"] {
    animation: menuSlideDown 0.22s ease-out forwards;
}

/* --- Botones globales --- */
.btn-accent {
    background: #f59e0b;
    color: #fff;
    display: inline-block;
    transition: background 0.2s, transform 0.15s;
}
.btn-accent:hover { background: #d97706; transform: translateY(-1px); }

.btn-primary {
    background: #1e3a5f;
    color: #fff;
    display: inline-block;
    transition: background 0.2s, transform 0.15s;
}
.btn-primary:hover { background: #152a45; transform: translateY(-1px); }

.btn-outline-white {
    border: 2px solid rgba(255,255,255,0.8);
    color: #fff;
    display: inline-block;
    transition: all 0.2s;
}
.btn-outline-white:hover { background: rgba(255,255,255,0.15); border-color: #fff; }

/* --- Hero --- */
.hero-section {
    background: linear-gradient(160deg, #0d2137 0%, #1e3a5f 45%, #162f52 100%);
    position: relative;
    overflow: hidden;
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
}

.hero-deco-1 {
    position: absolute;
    top: -180px; right: -140px;
    width: 680px; height: 680px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37,99,235,0.28) 0%, transparent 68%);
    pointer-events: none;
}
.hero-deco-2 {
    position: absolute;
    bottom: -200px; left: -100px;
    width: 520px; height: 520px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245,158,11,0.13) 0%, transparent 65%);
    pointer-events: none;
}
.hero-deco-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.055);
    pointer-events: none;
}
.hero-ring-1 { width: 480px; height: 480px; top: -120px; right: -120px; }
.hero-ring-2 { width: 700px; height: 700px; top: -260px; right: -260px; }

.hero-content { position: relative; z-index: 1; }

/* --- Hero product visual --- */
.hero-product-wrap {
    position: relative;
    animation: heroSlideIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
    display: inline-block;
}

@keyframes heroSlideIn {
    from { opacity: 0; transform: translateX(80px); }
    to   { opacity: 1; transform: translateX(0);    }
}

.hero-product-img {
    display: block;
    width: 100%;
    max-width: 540px;
    height: auto;
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 2rem; left: 50%;
    transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    color: rgba(255,255,255,0.5);
    font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
}
.scroll-indicator svg { animation: bounce-slow 2s infinite; }

@keyframes bounce-slow {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(6px); }
}

/* === Popup promocional ================================================== */
.popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.popup-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.popup-box {
    position: relative;
    background: #fff;
    border-radius: 20px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.4);
    transform: scale(0.92) translateY(20px);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.popup-overlay.is-visible .popup-box {
    transform: scale(1) translateY(0);
}

.popup-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    width: 2rem;
    height: 2rem;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}
.popup-close:hover { background: rgba(0, 0, 0, 0.75); }

.popup-media { line-height: 0; border-radius: 20px 20px 0 0; overflow: hidden; }
.popup-media img  { width: 100%; max-height: 340px; object-fit: cover; display: block; }
.popup-media iframe,
.popup-media video { width: 100%; aspect-ratio: 16/9; display: block; }

.popup-body   { padding: 1.375rem 1.5rem 0.875rem; }
.popup-title  { font-size: 1.125rem; font-weight: 800; color: #1e3a5f; margin-bottom: 0.4rem; line-height: 1.35; }
.popup-desc   { font-size: 0.9rem; color: #4b5563; line-height: 1.6; }

.popup-footer { padding: 1rem 1.5rem 1.5rem; }
.popup-wpp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: #25d366;
    color: #fff;
    font-weight: 700;
    font-size: 0.9375rem;
    border-radius: 12px;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
}
.popup-wpp-btn:hover { background: #1ebe5d; transform: translateY(-1px); }

/* --- Stats bar --- */
.stats-bar {
    background: #fff;
    box-shadow: 0 4px 30px rgba(0,0,0,0.08);
    position: relative; z-index: 10;
}
.stat-item { border-right: 1px solid #e5e7eb; }
.stat-item:last-child { border-right: none; }

/* --- Cards de producto --- */
.product-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.07);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-6px); box-shadow: 0 12px 35px rgba(0,0,0,0.13); }
.product-card .product-img-wrap {
    aspect-ratio: 4/3; overflow: hidden;
    background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    display: flex; align-items: center; justify-content: center;
}
.product-card .product-img-wrap img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.4s ease;
}
.product-card:hover .product-img-wrap img { transform: scale(1.05); }

.product-img-placeholder { width: 80px; height: 80px; opacity: 0.25; }

.category-badge {
    display: inline-block; font-size: 11px; font-weight: 700;
    letter-spacing: 0.5px; padding: 3px 10px; border-radius: 999px; text-transform: uppercase;
}
.badge-cip         { background: #dbeafe; color: #1e40af; }
.badge-selladores  { background: #d1fae5; color: #065f46; }
.badge-lubricantes { background: #fef3c7; color: #92400e; }

/* --- Product tags --- */
.product-tag {
    display: inline-block; font-size: 0.6875rem; font-weight: 700;
    letter-spacing: 0.04em; padding: 2px 9px; border-radius: 999px; text-transform: uppercase;
}
.product-tag-promo    { background: #ffedd5; color: #9a3412; }
.product-tag-discount { background: #fee2e2; color: #991b1b; }
.product-tag-new      { background: #dcfce7; color: #166534; }
.product-tag-other    { background: #e0e7ff; color: #3730a3; }

/* --- News cards --- */
.news-card {
    border-radius: 16px; overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.07);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    background: #fff; display: flex; flex-direction: column;
}
.news-card:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,0.12); }
.news-card .news-img-wrap {
    aspect-ratio: 16/9; overflow: hidden;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
}
.news-card .news-img-wrap img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.4s ease; opacity: 0.9;
}
.news-card:hover .news-img-wrap img { transform: scale(1.05); opacity: 1; }

/* --- Promo banner --- */
.promo-banner {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    position: relative; overflow: hidden;
}
.promo-banner::before {
    content: ''; position: absolute; top: -50%; right: -10%;
    width: 400px; height: 400px; border-radius: 50%;
    background: rgba(255,255,255,0.08);
}

/* --- Testimonios --- */
.testimonials-section { background: #f8fafc; }
.testimonial-slider-wrap { overflow: hidden; position: relative; }
.testimonial-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.25,0.46,0.45,0.94);
}
.testimonial-slide { min-width: 100%; padding: 0 8px; }
.testimonial-card {
    background: #fff; border-radius: 20px; padding: 2.5rem;
    box-shadow: 0 4px 25px rgba(0,0,0,0.08); position: relative;
}
.testimonial-card::before {
    content: '\201C'; position: absolute; top: 1.5rem; left: 2rem;
    font-size: 5rem; line-height: 1; color: #f59e0b;
    font-family: Georgia, serif; opacity: 0.4;
}
.testimonial-stars { color: #f59e0b; }

.slider-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #cbd5e1; cursor: pointer; transition: all 0.3s;
}
.slider-dot.active { background: #f59e0b; width: 24px; border-radius: 4px; }

/* --- Sección institucional --- */
.about-section { background: linear-gradient(180deg, #fff 0%, #f8fafc 100%); }
.about-icon-box {
    width: 56px; height: 56px; border-radius: 14px;
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* --- Sección CTA final --- */
.cta-section {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f2240 100%);
    position: relative; overflow: hidden;
}
.cta-section::before {
    content: ''; position: absolute; bottom: -60px; right: -60px;
    width: 300px; height: 300px; border-radius: 50%;
    background: rgba(245,158,11,0.08);
}

/* --- Wave top footer --- */
.wave-top { line-height: 0; overflow: hidden; background: #f8fafc; }
.wave-top svg { display: block; }

/* --- WhatsApp flotante --- */
.whatsapp-btn {
    position: fixed; bottom: 24px; right: 20px; z-index: 999;
    width: 54px; height: 54px; border-radius: 50%;
    background: #25d366; color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(37,211,102,0.45);
    transition: transform 0.2s, box-shadow 0.2s;
}
.whatsapp-btn:hover { transform: scale(1.1); box-shadow: 0 6px 25px rgba(37,211,102,0.55); }
.whatsapp-tooltip {
    position: absolute; right: calc(100% + 12px); top: 50%;
    transform: translateY(-50%);
    background: #1e3a5f; color: #fff; font-size: 12px; font-weight: 600;
    padding: 5px 12px; border-radius: 8px; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.whatsapp-btn:hover .whatsapp-tooltip { opacity: 1; }

/* --- Page hero (páginas internas) --- */
.page-hero {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    padding: 4rem 0; position: relative; overflow: hidden;
}
.page-hero::before {
    content: ''; position: absolute; inset: 0;
    background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* --- Formulario de contacto --- */
.form-input {
    width: 100%; border: 1.5px solid #e2e8f0; border-radius: 10px;
    padding: 0.75rem 1rem; font-size: 0.9375rem; color: #1e293b;
    background: #f8fafc; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s; font-family: inherit;
}
.form-input:focus {
    border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.12); background: #fff;
}
.form-label {
    display: block; font-size: 0.875rem; font-weight: 600;
    color: #374151; margin-bottom: 6px;
}

/* --- Breadcrumb --- */
.breadcrumb { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.breadcrumb a { color: rgba(255,255,255,0.75); font-size: 13px; transition: color 0.2s; }
.breadcrumb a:hover { color: #f59e0b; }
.breadcrumb .sep { color: rgba(255,255,255,0.4); font-size: 13px; }
.breadcrumb .current { color: rgba(255,255,255,0.95); font-size: 13px; font-weight: 600; }

/* --- Paginación --- */
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-btn {
    min-width: 38px; height: 38px; border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600; color: #374151;
    transition: all 0.2s; text-decoration: none;
}
.page-btn:hover, .page-btn.active {
    background: #1e3a5f; border-color: #1e3a5f; color: #fff;
}

/* --- Animaciones --- */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}
.float-anim { animation: float 4s ease-in-out infinite; }

.img-placeholder-bg { background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%); }


/* =================================================================
   RESPONSIVE — MOBILE FIRST OVERRIDES
   ================================================================= */

/* ---- ≤ 768px (tablet y mobile) ---- */
@media (max-width: 768px) {

    /* Hero principal */
    .hero-section { min-height: calc(90vh - 80px); }
    .hero-content { padding-top: 0 !important; padding-bottom: 0 !important; }

    /* Page hero (internas) */
    .page-hero { padding: 2.5rem 0; }

    /* Stats bar: grid 2x2 en mobile — borders correctos */
    .stat-item {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    /* Separador vertical entre columnas: solo items impares */
    .stat-item:nth-child(odd) { border-right: 1px solid #e5e7eb; }
    /* Última fila: sin border-bottom */
    .stats-bar .grid > *:nth-child(3),
    .stats-bar .grid > *:nth-child(4) { border-bottom: none; }
    /* Tailwind divide-y agrega border-top al item 2 (col 2, fila 1) — corregir */
    .stats-bar .grid > *:nth-child(2) { border-top: none !important; }

    /* Testimonial card */
    .testimonial-card { padding: 1.75rem 1.5rem; }
    .testimonial-card::before { font-size: 3.5rem; top: 1rem; left: 1.25rem; }

    /* Promo banner: texto más compacto */
    .promo-banner { padding: 2rem 1.25rem; }

    /* WhatsApp flotante: un poco más pequeño y separado del borde */
    .whatsapp-btn { width: 50px; height: 50px; bottom: 20px; right: 16px; }
    .whatsapp-tooltip { display: none; }

    /* Product cards: no hover lift en touch */
    .product-card:hover { transform: none; }
    .news-card:hover    { transform: none; }

    /* Pagination: wrap correctamente */
    .pagination { justify-content: center; }

    /* Formulario de contacto: inputs más grandes en touch */
    .form-input { font-size: 1rem; padding: 0.875rem 1rem; }
}

/* ---- ≤ 640px (mobile pequeño) ---- */
@media (max-width: 640px) {

    /* Hero: menos padding vertical en mobile */
    .hero-section { min-height: calc(85vh - 80px); }

    /* Page hero: más compacto */
    .page-hero { padding: 2rem 0; }
    .page-hero h1 { font-size: 1.625rem !important; line-height: 1.25; }

    /* Texto hero principal */
    .hero-content h1 { font-size: 2rem !important; line-height: 1.2; }
    .hero-content p  { font-size: 1rem !important; }

    /* Stats: 2 col, todos con borde inferior excepto últimos 2 */
    .stat-item { padding: 1.25rem 0.75rem; }

    /* CTA section: botones apilados */
    .cta-section .flex { flex-wrap: wrap; gap: 0.75rem; }

    /* Navbar: logo más compacto */
    #navbar img { height: 2.25rem; }

    /* Footer: centrar en mobile */
    footer .text-sm { font-size: 0.75rem; }

    /* Breadcrumb: texto más pequeño */
    .breadcrumb a,
    .breadcrumb .sep,
    .breadcrumb .current { font-size: 12px; }

    /* Paginación */
    .page-btn { min-width: 34px; height: 34px; font-size: 13px; }
}

/* ---- ≤ 480px (mobile muy pequeño — iPhone SE, etc.) ---- */
@media (max-width: 480px) {

    /* Hero: compacto en pantallas muy pequeñas */
    .hero-section { min-height: calc(80vh - 80px); }
    .hero-content h1 { font-size: 1.75rem !important; }

    /* Ocultar decoraciones pesadas en pantallas muy chicas */
    .hero-deco-1, .hero-deco-2,
    .hero-ring-1, .hero-ring-2 { opacity: 0.4; }

    /* Scroll indicator: ocultar en pantallas muy chicas */
    .scroll-indicator { display: none; }

    /* About section visual: no overflow */
    .about-section .rounded-3xl { border-radius: 1rem; }
}

/* ---- Safe area para iPhones con notch ---- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .whatsapp-btn {
        bottom: calc(20px + env(safe-area-inset-bottom));
        right:  calc(16px + env(safe-area-inset-right));
    }
}

.hero-section.hero-bensal {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 680px;
    display: flex;
    align-items: center;
    background-color: #061630;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Evita que los efectos anteriores cubran la fotografía */
.hero-section.hero-bensal::before,
.hero-section.hero-bensal::after {
    content: none;
}

.hero-bensal .hero-content {
    position: relative;
    z-index: 2;
}

.hero-bensal .scroll-indicator {
    z-index: 3;
}

/* Refuerza el contraste del texto en tablets y celulares */
@media (max-width: 1023px) {
    .hero-section.hero-bensal {
        min-height: 600px;
        background-position: 65% center;
    }

    .hero-section.hero-bensal::before {
        content: "";
        position: absolute;
        inset: 0;
        background: rgba(4, 18, 42, 0.78);
        z-index: 1;
        pointer-events: none;
    }
}

@media (max-width: 639px) {
    .hero-section.hero-bensal {
        min-height: 560px;
    }
}

@media (min-width: 1024px) {
    .hero-section.hero-bensal {
        background-size: 100% auto !important;
        background-position: right bottom !important;
        background-attachment: scroll !important;
    }
}
