:root {
    --primary-red: #f04d61;
    --dark-overlay: rgba(0, 0, 0, 0.7);
}

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

/* Smooth in-page navigation for the CTA anchors (#registrationForm) */
html { scroll-behavior: smooth; }

body {
    font-family: 'Open Sans', sans-serif;
    background-color: #fff;
    overflow-x: hidden;
}

/* HERO SECTION - NO MARGINS */
.hero {
    position: relative;
    width: 100%;
    height: 80vh;
    min-height: 600px;
    background: linear-gradient(var(--primary-red), var(--dark-overlay)), 
                url('https://images.unsplash.com/photo-1594381898411-846e7d193883?q=80&w=1974&auto=format&fit=crop') center/cover no-repeat;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* NAVIGATION - FLOATING START */
.nav-wrapper {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1100px;
    background: white;
    border-radius: 10px;
    padding: 15px 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 2000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-wrapper.scrolled {
    top: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    padding: 15px 50px;
}

.main-nav { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; width: 100%; max-width: 1100px; margin: 0 auto; row-gap: 0; }
.logo .logo-link { text-decoration: none; color: var(--primary-red); }
.logo .logo-link:hover { color: var(--primary-red); opacity: 0.9; }
.logo img { height: 40px; display: block; }
.logo .logo-text { display: none; font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 1.5rem; color: var(--primary-red); }
.nav-links { display: flex; list-style: none; gap: 20px; align-items: center; flex-wrap: wrap; }
.nav-links a { text-decoration: none; color: #555; text-transform: uppercase; font-size: 13px; font-weight: 600; }
.nav-links a:hover { color: var(--primary-red); }

/* Hamburger: only used below breakpoint — hidden on large screens */
.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #333;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    flex-shrink: 0;
}
.menu-toggle:hover { background: rgba(0, 0, 0, 0.05); }
.menu-toggle:focus-visible { outline: 2px solid var(--primary-red); outline-offset: 2px; }

.hero-content h1 {
    font-family: 'Montserrat', sans-serif;
    color: white;
    font-size: clamp(3rem, 10vw, 5rem);
    text-shadow: 0 4px 10px rgba(0,0,0,0.3);
    margin: 0 24px;
}

.wave-container { position: absolute; bottom: -1px; width: 100%; line-height: 0; }
.wave-container svg { width: 100%; height: 100px; }

/* REGISTRATION & CONTENT */
.content-section { padding: 100px 20px; text-align: center; }
.container { max-width: 1000px; margin: 0 auto; }
.intro-text { margin-bottom: 40px; font-size: 1.1rem; line-height: 1.8; }
.form-wrapper { max-width: 600px; margin: 0 auto 60px; text-align: left; }
.input-group input { width: 100%; padding: 15px; border: 1px solid #ddd; border-radius: 4px; margin-bottom: 15px; }
.checkbox-group { margin-bottom: 15px; display: flex; align-items: center; gap: 8px; }
.checkbox-group label { font-size: 14px; color: #333; }
.btn-submit { width: 100%; background: #FF0000; color: white; padding: 18px; border: none; border-radius: 5px; font-weight: bold; cursor: pointer; font-size: 1rem; }

/* MEDIA GRID – centered for any number of items (1 or many) */
.media-grid {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 24px;
    width: 100%;
}
.media-item {
    width: 100%;
    flex-shrink: 0;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    text-align: left;
}
.media-item img,
.media-item video {
    width: auto;
    height: auto;
    max-width: min(700px, 100%);
    max-height: 70vh;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}
.media-item video {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.resource-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.15rem;
    margin: 0 0 10px;
    color: #222;
}
.resource-copy {
    font-size: 1rem;
    line-height: 1.7;
    color: #333;
    margin-bottom: 12px;
}
.resource-copy p {
    margin-bottom: 10px;
}
.resource-copy p:last-child {
    margin-bottom: 0;
}

/* FOOTER */
.map-container iframe { width: 100% !important; display: block; }
.footer-red-bg { background: #f04d61; color: white; padding: 100px 20px 60px; position: relative; }
.footer-wave { position: absolute; top: -119px; left:0; width: 100%; line-height: 0; }
.footer-wave svg { width: 100%; height: 120px; }
/* Footer: 3 columns so contact card stays centered (1fr | card | 1fr) */
.footer-container {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 40px;
}
.contact-card {
    background: white;
    padding: 40px;
    border-radius: 15px;
    width: 450px;
    max-width: 100%;
    margin: -300px auto 0;
    z-index: 10;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    color: #333;
    justify-self: center;
}
.contact-card h2 { color: red; margin-bottom: 20px; font-family: 'Montserrat'; }
.contact-card input:not([type="checkbox"]), .contact-card textarea { width: 100%; padding: 12px; margin-bottom: 10px; border: none; background: #f5f5f5; }
.btn-send { width: 100%; background: red; color: white; border: none; padding: 15px; font-weight: bold; cursor: pointer; }
/* Footer columns: center content within each column */
.footer-col {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.footer-col h3 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 15px 0;
    line-height: 1.2;
}
.footer-col p {
    margin: 4px 0;
}
.footer-icon { display: flex; justify-content: center; align-items: center; height: 60px; }
.footer-links { margin-top: 15px; text-align: center; }
.footer-links, .footer-links a { font-size: 13px; color: white; text-decoration: none; opacity: 0.9; }
.email-link { color: white; text-decoration: none; }
.captcha-wrapper { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 15px 0; }
.captcha-box { background: #f0f0f0; padding: 8px 25px; border-radius: 4px; color: #888; font-size: 14px; }
.refresh-captcha { background: none; border: none; cursor: pointer; font-size: 1.2rem; }
.footer-checkbox { display: flex; align-items: flex-start; gap: 8px; text-align: left; font-size: 12px; margin-top: 10px; color: #666; }
.footer-checkbox input[type="checkbox"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    padding: 0;
    background: none;
}
.footer-checkbox label { flex: 1; line-height: 1.4; }
.contact-card input:not([type="checkbox"]),
.contact-card textarea {
    background-color: #f5f5f5;
    border: none;
    border-radius: 8px;
    padding: 12px 15px;
    width: 100%;
    margin-bottom: 10px;
    font-family: 'Open Sans', sans-serif;
}
/* Flash messages in contact card */
.contact-card .flash { margin-bottom: 12px; padding: 10px; border-radius: 8px; font-size: 14px; }
.contact-card .flash.success { background: #d4edda; color: #155724; }
.contact-card .flash.error { background: #f8d7da; color: #721c24; }

/* ——— Registration page: mobile nav + layout ——— */
@media (max-width: 900px) {
    .hero {
        min-height: 75vh;
        height: auto;
        /* top: clear the fixed nav · bottom: keep content above the 100px wave */
        padding: 100px 0 120px;
    }

    .nav-wrapper {
        top: 12px;
        width: 94%;
        padding: 12px 16px;
    }

    .nav-wrapper.scrolled {
        padding: 12px 16px;
    }

    .main-nav .logo { order: 1; }
    .main-nav .menu-toggle { order: 2; }

    .menu-toggle {
        display: flex;
        margin-left: auto;
    }

    .nav-links {
        order: 3;
        flex-basis: 100%;
        width: 100%;
        max-height: 0;
        overflow: hidden;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0;
        margin: 0;
        display: flex;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        transition: max-height 0.35s ease, padding 0.35s ease, opacity 0.25s ease, visibility 0.25s;
    }

    .nav-links.open {
        max-height: 400px;
        padding-top: 12px;
        margin-top: 4px;
        border-top: 1px solid #eee;
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
        border-bottom: 1px solid #f0f0f0;
    }

    .nav-links li:last-child { border-bottom: none; }

    .nav-links a {
        display: block;
        padding: 14px 8px;
        font-size: 14px;
    }

    .content-section { padding: 60px 16px 80px; }
    .intro-text { font-size: 1rem; }
    /* Mobile only: one common 16px inset so title, subtitle, CTA and trust line up */
    .hero-content { width: 100%; padding: 0 16px; }
    .hero-content h1 { margin: 0; }
    .hero-subtitle { margin: 20px 0 0; }
    .hero-trust { margin: 16px 0 0; }

    .media-item { text-align: center; }
    .media-item img,
    .media-item video {
        max-width: 90%;
        max-height: 60vh;
    }
}

@media (max-width: 850px) {
    .footer-container {
        grid-template-columns: 1fr;
        align-items: center;
    }
    .contact-card {
        width: 100%;
        max-width: 450px;
        margin-top: -100px;
    }
}

/* ===================================================================== */
/* Landing redesign: hero hook, urgency, pains, features, gift,          */
/* testimonials and closing CTA. Mobile-first, reuses --primary-red.      */
/* ===================================================================== */

/* Hero hook + CTA */
.hero-subtitle {
    font-family: 'Open Sans', sans-serif;
    color: #fff;
    font-size: clamp(1.05rem, 3.5vw, 1.5rem);
    font-weight: 300;
    line-height: 1.5;
    max-width: 720px;
    margin: 20px 24px 0;
    text-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.hero-cta {
    display: inline-block;
    margin-top: 28px;
    background: #fff;
    color: var(--primary-red);
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: clamp(1rem, 2.5vw, 1.15rem);
    text-decoration: none;
    padding: 16px 38px;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0,0,0,0.3); }
.hero-trust {
    margin: 16px 24px 0;
    color: #fff;
    opacity: 0.9;
    font-size: 0.9rem;
}

/* Offset so the fixed nav never covers the form when the CTA scrolls to it */
#registrationForm { scroll-margin-top: 100px; }
.form-trust { margin-top: 12px; text-align: center; font-size: 0.85rem; color: #888; }

/* Generic content section + title */
.landing-section { padding: 70px 20px; text-align: center; }
.landing-section .container { max-width: 1000px; margin: 0 auto; }
.section-title {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(1.6rem, 5vw, 2.4rem);
    color: #222;
    margin-bottom: 36px;
}

/* Pains — "¿Te suena esto?" */
.pains-section { background: #fafafa; }
.pains-list { max-width: 760px; margin: 0 auto; text-align: left; }
.pain-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: #fff;
    border-left: 4px solid var(--primary-red);
    border-radius: 10px;
    padding: 18px 22px;
    margin-bottom: 16px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.05);
}
.pain-icon {
    color: var(--primary-red);
    font-weight: 700;
    font-size: 1.3rem;
    line-height: 1.4;
    flex-shrink: 0;
}
.pain-body { display: flex; flex-direction: column; gap: 4px; }
.pain-text { font-weight: 600; color: #222; line-height: 1.5; }
.pain-subtext { color: #666; font-size: 0.92rem; line-height: 1.5; }

/* Features — "Qué vas a encontrar dentro" */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 22px;
}
.feature-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 14px;
    padding: 28px 22px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: 0 10px 26px rgba(0,0,0,0.1); }
.feature-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: rgba(240, 77, 97, 0.12);
    color: var(--primary-red);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.feature-title { font-family: 'Montserrat', sans-serif; font-size: 1.1rem; color: #222; margin-bottom: 8px; }
.feature-desc { color: #666; font-size: 0.95rem; line-height: 1.6; }

/* Gift / lead magnet callout (sits above the form) */
.gift-callout {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 600px;
    margin: 0 auto 40px;
    padding: 22px 26px;
    background: rgba(240, 77, 97, 0.06);
    border: 2px dashed var(--primary-red);
    border-radius: 14px;
    text-align: left;
}
.gift-image { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.gift-badge {
    display: inline-block;
    background: var(--primary-red);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 50px;
    margin-bottom: 8px;
}
.gift-title { font-family: 'Montserrat', sans-serif; font-size: 1.15rem; color: #222; margin-bottom: 6px; }
.gift-desc { color: #555; font-size: 0.95rem; line-height: 1.6; }

/* Testimonials */
.testimonials-section { background: #fafafa; }
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}
.testimonial-card {
    background: #fff;
    border-radius: 16px;
    padding: 28px 26px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.07);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.testimonial-stars { color: #f5b301; font-size: 1.05rem; letter-spacing: 2px; }
.testimonial-stars .star-empty { color: #ddd; }
.testimonial-quote { color: #333; font-size: 1rem; line-height: 1.7; font-style: italic; }
.testimonial-author { display: flex; align-items: center; gap: 12px; margin-top: auto; }
.testimonial-photo { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.testimonial-photo--placeholder {
    background: var(--primary-red);
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.testimonial-meta { line-height: 1.3; }
.testimonial-name { font-weight: 700; color: #222; }
.testimonial-role { color: #888; font-size: 0.85rem; }

/* Closing CTA band */
.cta-band {
    background: var(--primary-red);
    padding: 70px 20px;
    text-align: center;
}
.cta-band-title {
    font-family: 'Montserrat', sans-serif;
    color: #fff;
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    margin-bottom: 26px;
}
.cta-band-trust { margin-top: 16px; color: #fff; opacity: 0.9; font-size: 0.9rem; }

/* FAQ accordion */
.faq-section { background: #fafafa; }
.faq-list { max-width: 760px; margin: 0 auto; text-align: left; }
.faq-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.04);
    overflow: hidden;
}
.faq-q {
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: #222;
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q::after {
    content: '+';
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--primary-red);
    line-height: 1;
    flex-shrink: 0;
}
.faq-item[open] .faq-q::after { content: '\2013'; } /* en-dash when open */
.faq-a {
    padding: 0 22px 20px;
    color: #555;
    font-size: 1rem;
    line-height: 1.7;
}

/* Urgency — floating "spots left" counter (fixed top-right, always visible) */
.urgency-counter {
    position: fixed;
    top: 88px;
    right: 16px;
    z-index: 9998;
    max-width: min(300px, calc(100vw - 32px));
    background: var(--primary-red);
    color: #fff;
    text-align: center;
    padding: 14px 34px 14px 18px;
    border-radius: 14px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: clamp(0.95rem, 2.6vw, 1.15rem);
    line-height: 1.35;
    letter-spacing: 0.2px;
    box-shadow: 0 14px 34px rgba(0,0,0,0.28);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.urgency-counter.closed { display: none; }
.urgency-counter.hiding {
    opacity: 0;
    transform: translateX(40px) scale(0.92);
    pointer-events: none;
}
.urgency-counter.reappear { animation: urgencyReappear 0.45s ease; }
.urgency-counter-close {
    position: absolute;
    top: 6px;
    right: 9px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.85);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.urgency-counter-close:hover { color: #fff; }
@keyframes urgencyReappear {
    0% { opacity: 0; transform: translateX(40px) scale(0.92); }
    60% { transform: translateX(-4px) scale(1.03); }
    100% { opacity: 1; transform: none; }
}
@media (max-width: 600px) {
    .urgency-counter { top: 70px; right: 10px; padding: 12px 30px 12px 14px; }
}
.urgency-count {
    display: inline-block;
    min-width: 1.4em;
    font-size: 1.25em;
    font-weight: 800;
    color: #fff;
    background: rgba(0,0,0,0.18);
    border-radius: 8px;
    padding: 0 8px;
    margin: 0 2px;
}
.urgency-count.pulse { animation: urgencyPulse 0.5s ease; }
@keyframes urgencyPulse {
    0% { transform: scale(1); }
    35% { transform: scale(1.28); background: rgba(0,0,0,0.32); }
    100% { transform: scale(1); }
}

/* Social-proof toasts (bottom-left) */
.signup-toasts {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 9997;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(320px, calc(100vw - 32px));
}
.signup-toast {
    position: relative;
    background: #fff;
    color: #2b2b2b;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
    padding: 12px 34px 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: signupToastIn 0.3s ease;
}
.signup-toast.out { animation: signupToastOut 0.3s ease forwards; }
.signup-toast-icon {
    width: 34px; height: 34px; flex-shrink: 0;
    border-radius: 50%;
    background: rgba(240, 77, 97, 0.12);
    color: var(--primary-red);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
}
.signup-toast-body { line-height: 1.3; }
.signup-toast-email { font-weight: 700; font-size: 0.9rem; color: #222; }
.signup-toast-sub { font-size: 0.78rem; color: #888; }
.signup-toast-close {
    position: absolute; top: 6px; right: 8px;
    background: none; border: none; color: #bbb;
    font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0;
}
.signup-toast-close:hover { color: #666; }
@keyframes signupToastIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
@keyframes signupToastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(-12px); } }

/* Bigger floating popups on desktop (counter + signup toasts) */
@media (min-width: 768px) {
    .urgency-counter {
        top: 96px;
        right: 24px;
        max-width: 400px;
        padding: 20px 46px 20px 26px;
        border-radius: 16px;
        font-size: 1.4rem;
        line-height: 1.4;
    }
    .urgency-count { font-size: 1.3em; padding: 0 11px; border-radius: 10px; }
    .urgency-counter-close { top: 9px; right: 12px; font-size: 1.5rem; }

    .signup-toasts { left: 24px; bottom: 24px; gap: 12px; max-width: 400px; }
    .signup-toast { padding: 16px 42px 16px 18px; gap: 14px; border-radius: 14px; }
    .signup-toast-icon { width: 46px; height: 46px; font-size: 1.35rem; }
    .signup-toast-email { font-size: 1.1rem; }
    .signup-toast-sub { font-size: 0.92rem; }
    .signup-toast-close { top: 8px; right: 10px; font-size: 1.35rem; }
}

@media (max-width: 600px) {
    .landing-section { padding: 50px 16px; }
    .hero-cta { width: auto; padding: 15px 30px; }
    .gift-callout { flex-direction: column; text-align: center; }
    .gift-text { text-align: center; }
}

/* ——— AI chat widget (floating bubble) ——— */
#campaign-chat {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

/* Teaser shown above the bubble: "Habla con alguien de nuestro equipo" */
.chat-teaser {
    position: relative;
    width: 220px;
    background: #fff;
    color: #2b2b2b;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    padding: 14px 16px;
    border-radius: 18px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.16);
    cursor: pointer;
    animation: chatTeaserIn 0.35s ease;
}
.chat-teaser::after {
    content: "";
    position: absolute;
    bottom: -7px;
    right: 22px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 0 0 4px 0;
    transform: rotate(45deg);
    box-shadow: 4px 4px 8px rgba(0,0,0,0.05);
}
.chat-teaser-close {
    position: absolute;
    top: -9px;
    right: -9px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #888;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.chat-teaser-close:hover { color: #333; }
#campaign-chat.open .chat-teaser,
.chat-teaser.hidden { display: none; }
@keyframes chatTeaserIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

.chat-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: var(--primary-red);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    transition: transform 0.2s ease;
}
.chat-bubble:hover { transform: scale(1.06); }
#campaign-chat.open .chat-bubble { display: none; }

.chat-panel {
    display: none;
    flex-direction: column;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 40px);
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
#campaign-chat.open .chat-panel { display: flex; }

.chat-panel-header {
    background: var(--primary-red);
    color: #fff;
    padding: 14px 16px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7f7f8;
}
.chat-messages .msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.chat-messages .msg.bot { align-self: flex-start; background: #fff; color: #333; border: 1px solid #ececec; }
.chat-messages .msg.user { align-self: flex-end; background: var(--primary-red); color: #fff; }
.chat-messages .msg.typing { font-style: italic; color: #888; }

.chat-counter { font-size: 11px; color: #888; text-align: center; padding: 6px 0; background: #f7f7f8; }

.chat-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #ececec; background: #fff; }
.chat-input input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    font-family: 'Open Sans', sans-serif;
}
.chat-input input:focus { border-color: var(--primary-red); }
.chat-input button {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border: none;
    border-radius: 50%;
    background: var(--primary-red);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-input button:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 600px) {
    #campaign-chat { bottom: 16px; right: 16px; gap: 8px; }

    /* Cleaner, smaller bubble on phones (standard ~54px) */
    .chat-bubble { width: 54px; height: 54px; box-shadow: 0 4px 14px rgba(0,0,0,0.22); }
    .chat-bubble svg { width: 24px; height: 24px; }

    /* Compact, non-intrusive nudge instead of the big 220px desktop box */
    .chat-teaser {
        width: auto;
        max-width: min(210px, calc(100vw - 86px));
        font-size: 12.5px;
        padding: 9px 12px;
        border-radius: 16px;
        box-shadow: 0 8px 20px rgba(0,0,0,0.16);
    }
    .chat-teaser::after { right: 20px; width: 14px; height: 14px; }
    .chat-teaser-close { width: 22px; height: 22px; font-size: 14px; top: -8px; right: -8px; }

    /* When open, the panel takes the whole screen. Using position:fixed +
       100dvh (with a JS fallback that sets an explicit pixel height from
       visualViewport) keeps the input visible above the on-screen keyboard. */
    #campaign-chat.open {
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
    }
    .chat-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }
    /* 16px avoids iOS auto-zoom when the input gets focus */
    .chat-input input { font-size: 16px; }
}

/* ——— WhatsApp floating bubble ——— */
#campaign-whatsapp {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9998;            /* just under the chat (9999) so the chat panel wins when open */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}
/* When the AI chat bubble is also present, sit above it (chat bubble is 60px tall at bottom:20px). */
#campaign-whatsapp.has-chat { bottom: 92px; }

.wa-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: #25D366;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    transition: transform 0.2s ease;
    text-decoration: none;
    /* Attention-grabbing pulse: a green ring that expands and fades. */
    animation: waPulse 2.2s ease-out infinite;
}
.wa-bubble:hover { transform: scale(1.06); }

@keyframes waPulse {
    0%   { box-shadow: 0 6px 20px rgba(0,0,0,0.25), 0 0 0 0 rgba(37, 211, 102, 0.55); }
    70%  { box-shadow: 0 6px 20px rgba(0,0,0,0.25), 0 0 0 16px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 6px 20px rgba(0,0,0,0.25), 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* Reclamo: speech bubble to the left of the WhatsApp bubble. */
.wa-teaser {
    position: absolute;
    right: 72px;          /* clears the 60px bubble + gap */
    bottom: 9px;
    width: max-content;
    max-width: min(240px, calc(100vw - 96px));
    background: #fff;
    color: #1f2d3d;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    padding: 11px 14px;
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.16);
    animation: waTeaserIn 0.4s ease 1.1s both;
}
.wa-teaser::after {
    content: "";
    position: absolute;
    right: -6px;
    bottom: 14px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 0 0 4px 0;
    transform: rotate(-45deg);
    box-shadow: 3px 3px 6px rgba(0,0,0,0.04);
}
.wa-teaser-close {
    position: absolute;
    top: -9px;
    left: -9px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #888;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.wa-teaser-close:hover { color: #333; }
.wa-teaser.wa-hidden { display: none; }
/* Hide the reclamo while the multi-number menu is open. */
#campaign-whatsapp.wa-open .wa-teaser { display: none; }
@keyframes waTeaserIn {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .wa-bubble { animation: none; }
    .wa-teaser { animation: none; }
}

/* Multi-number menu that expands above the bubble */
.wa-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 240px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 12px 34px rgba(0,0,0,0.22);
    animation: waMenuIn 0.18s ease;
}
.wa-menu[hidden] { display: none; }
.wa-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #1f2d3d;
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.15s ease;
}
.wa-menu-item:hover { background: #f1f5f3; }
.wa-menu-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #25D366;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wa-menu-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@keyframes waMenuIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 600px) {
    #campaign-whatsapp { right: 16px; bottom: 16px; }
    #campaign-whatsapp.has-chat { bottom: 82px; }   /* chat bubble is 54px on mobile */
    .wa-bubble { width: 54px; height: 54px; box-shadow: 0 4px 14px rgba(0,0,0,0.22); }
    .wa-bubble svg { width: 26px; height: 26px; }
}
