/* ═══════════════════════════════════════════════════════
   CASULO · WhatsApp Component
   FAB premium + modal de contato sofisticado
   ═══════════════════════════════════════════════════════ */

:root {
    --cw-gold:        #C48D3D;
    --cw-gold-dark:   #9C6E25;
    --cw-gold-light:  #E8B86D;
    --cw-text:        #1E1208;
    --cw-text-soft:   #4A3525;
    --cw-text-muted:  #6B5744;
    --cw-bg:          #FBF4E3;
    --cw-bg-warm:     #FCEFD2;
    --cw-bg-rose:     #F8D8DC;
    --cw-bg-sky:      #C8E0F0;
    --cw-green:       #D0E087;
    --cw-blue:        #B1DFF9;
    --cw-blue-deep:   #6CBBEA;
    --cw-pink:        #F9CFD1;
    --cw-yellow:      #FFF1B0;
    --cw-wpp:         #25D366;
    --cw-wpp-dark:    #128C7E;
    --cw-radius:      1.25rem;
    --cw-radius-lg:   1.75rem;
    --cw-ease:        cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── FAB ─────────────────────────────────────────────── */
.cw-fab {
    position: fixed;
    bottom: clamp(1rem, 2.4vw, 1.75rem);
    right:  clamp(1rem, 2.4vw, 1.75rem);
    z-index: 90;
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 1.2rem 0.55rem 0.55rem;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid rgba(177,223,249,.4);
    border-radius: 999px;
    box-shadow:
        0 14px 38px rgba(14,27,42,.16),
        0 4px 12px rgba(177,223,249,.25),
        inset 0 1px 0 rgba(255,255,255,.7);
    cursor: pointer;
    font-family: 'Poppins', system-ui, sans-serif;
    color: var(--cw-text);
    transform: translateY(14px) scale(.92);
    opacity: 0;
    pointer-events: none;
    transition:
        transform .55s var(--cw-ease),
        opacity .45s ease,
        box-shadow .35s ease,
        background .25s ease;
}
.cw-fab.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}
.cw-fab:hover {
    background: #fff;
    box-shadow:
        0 22px 52px rgba(30,18,8,.2),
        0 6px 20px rgba(37,211,102,.28),
        inset 0 1px 0 rgba(255,255,255,.85);
    transform: translateY(-3px) scale(1.01);
}
.cw-fab:focus-visible {
    outline: none;
    background: #fff;
    box-shadow:
        0 22px 52px rgba(30,18,8,.2),
        0 0 0 4px rgba(37,211,102,.4),
        inset 0 1px 0 rgba(255,255,255,.85);
    transform: translateY(-3px) scale(1.01);
}
.cw-fab:active { transform: translateY(-1px) scale(.99); }

.cw-fab__core {
    width: 46px; height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cw-wpp) 0%, var(--cw-wpp-dark) 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    box-shadow:
        inset 0 -2px 6px rgba(0,0,0,.18),
        inset 0 1px 1px rgba(255,255,255,.25),
        0 4px 14px rgba(37,211,102,.36);
}

.cw-fab__halo,
.cw-fab__ring {
    position: absolute;
    left: 0.55rem;
    top: 50%;
    width: 46px; height: 46px;
    border-radius: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
.cw-fab__halo {
    background: rgba(37,211,102,.55);
    filter: blur(8px);
    animation: cw-fab-halo 2.4s ease-out infinite;
    z-index: 0;
}
.cw-fab__ring {
    border: 2px solid rgba(37,211,102,.55);
    animation: cw-fab-ring 2.4s ease-out infinite .6s;
    z-index: 1;
}
@keyframes cw-fab-halo {
    0%   { transform: translateY(-50%) scale(.9);  opacity: .6; }
    100% { transform: translateY(-50%) scale(1.45); opacity: 0; }
}
@keyframes cw-fab-ring {
    0%   { transform: translateY(-50%) scale(1);   opacity: .65; }
    100% { transform: translateY(-50%) scale(1.85); opacity: 0; }
}

.cw-fab__label {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
    text-align: left;
    padding-right: 0.15rem;
}
.cw-fab__label strong {
    font-weight: 600;
    font-size: 0.86rem;
    color: var(--cw-text);
    letter-spacing: -0.005em;
}
.cw-fab__label span {
    font-size: 0.7rem;
    color: var(--cw-text-muted);
    margin-top: 2px;
}

/* ── MODAL ───────────────────────────────────────────── */
.cw-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(0.75rem, 3vw, 2rem);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .45s ease, visibility .45s;
}
.cw-modal.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.cw-modal__backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 30%, rgba(177,223,249,.22) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 70%, rgba(208,224,135,.15) 0%, transparent 55%),
        rgba(7,24,38,.55);
    backdrop-filter: blur(8px) saturate(120%);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
}

.cw-modal__panel {
    position: relative;
    width: min(960px, 100%);
    max-height: min(640px, calc(100vh - 2rem));
    background: var(--cw-bg);
    border-radius: var(--cw-radius-lg);
    overflow: hidden;
    display: grid;
    grid-template-columns: 0.92fr 1fr;
    box-shadow:
        0 40px 100px rgba(0,0,0,.4),
        0 0 0 1px rgba(177,223,249,.3),
        inset 0 1px 0 rgba(255,255,255,.6);
    transform: translateY(40px) scale(.96);
    transition: transform .55s var(--cw-ease);
    font-family: 'Poppins', system-ui, sans-serif;
}
.cw-modal.is-open .cw-modal__panel {
    transform: translateY(0) scale(1);
}

.cw-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 5;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.85);
    border: 1px solid rgba(30,18,8,.08);
    backdrop-filter: blur(8px);
    color: var(--cw-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s, transform .25s var(--cw-ease), color .2s;
}
.cw-modal__close:hover {
    background: #fff;
    color: #1A5E8A;
    transform: rotate(90deg) scale(1.05);
}

/* ── ASIDE (lado esquerdo, dourado) ──────────────────── */
.cw-modal__aside {
    position: relative;
    background: var(--cw-gold);
    color: #fff;
    padding: clamp(2rem, 4vw, 2.75rem);
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}
.cw-modal__aside-decor {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(60px);
}
.cw-modal__aside-decor--1 {
    width: 280px; height: 280px;
    background: rgba(255,241,176,.32);
    top: -20%; right: -15%;
    animation: cw-blob 18s ease-in-out infinite;
}
.cw-modal__aside-decor--2 {
    width: 220px; height: 220px;
    background: rgba(255,255,255,.18);
    bottom: -15%; left: -10%;
    animation: cw-blob 22s ease-in-out infinite reverse 4s;
}
@keyframes cw-blob {
    0%,100% { transform: translate(0,0) scale(1); }
    50%      { transform: translate(20px,-15px) scale(1.1); }
}

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

.cw-modal__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.28);
    padding: 0.32rem 0.85rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,.95);
    margin-bottom: 1.5rem;
    backdrop-filter: blur(8px);
}
.cw-modal__chip-dot {
    width: 7px; height: 7px;
    background: #5BFFAE;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(91,255,174,.7);
    animation: cw-blink 1.6s ease-in-out infinite;
}
@keyframes cw-blink {
    0%,100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .55; transform: scale(.85); }
}

.cw-modal__aside h3 {
    font-size: clamp(1.3rem, 2.4vw, 1.7rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.75rem;
    letter-spacing: -0.015em;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,.18);
}
.cw-modal__aside p {
    font-size: 0.92rem;
    color: rgba(255,255,255,.85);
    line-height: 1.65;
    margin-bottom: 1.5rem;
    max-width: 320px;
}

.cw-modal__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}
.cw-modal__list li {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.84rem;
    color: rgba(255,255,255,.92);
}
.cw-modal__list svg {
    color: var(--cw-yellow);
    flex-shrink: 0;
    background: rgba(255,255,255,.15);
    width: 22px; height: 22px;
    border-radius: 50%;
    padding: 4px;
    box-sizing: border-box;
}

/* ── FORM ────────────────────────────────────────────── */
.cw-modal__form {
    padding: clamp(2rem, 4vw, 2.75rem) clamp(1.75rem, 3.5vw, 2.5rem);
    background: linear-gradient(180deg, #fff 0%, var(--cw-bg) 100%);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}

.cw-modal__header { margin-bottom: 0.5rem; }
.cw-modal__header h2 {
    font-size: clamp(1.2rem, 2.4vw, 1.5rem);
    font-weight: 700;
    color: var(--cw-text);
    letter-spacing: -0.015em;
    margin-bottom: 0.25rem;
}
.cw-modal__header p {
    font-size: 0.85rem;
    color: var(--cw-text-muted);
    line-height: 1.5;
}

.cw-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

.cw-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    position: relative;
}
.cw-field label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--cw-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.cw-field input,
.cw-field select {
    width: 100%;
    padding: 0.78rem 1rem;
    background: rgba(255,255,255,.85);
    border: 1.5px solid rgba(177,223,249,.45);
    border-radius: 0.85rem;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--cw-text);
    transition: border-color .25s, box-shadow .25s, background .2s;
    appearance: none;
    -webkit-appearance: none;
}
.cw-field input::placeholder { color: rgba(74,106,136,.55); }
.cw-field input:hover,
.cw-field select:hover {
    border-color: rgba(177,223,249,.72);
    background: #fff;
}
.cw-field input:focus,
.cw-field select:focus {
    outline: none;
    border-color: var(--cw-blue-deep);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(177,223,249,.25);
}
.cw-field input:invalid:not(:placeholder-shown),
.cw-field select:invalid:not(:focus):not([data-pristine]) {
    border-color: rgba(220, 70, 70, .35);
}

.cw-select-wrap { position: relative; }
.cw-select-arrow {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #1A5E8A;
    pointer-events: none;
    transition: transform .25s;
}
.cw-select-wrap:focus-within .cw-select-arrow { transform: translateY(-50%) rotate(180deg); }

.cw-submit {
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--cw-wpp) 0%, var(--cw-wpp-dark) 100%);
    color: #fff;
    border: none;
    border-radius: 0.95rem;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: -0.005em;
    cursor: pointer;
    box-shadow:
        0 10px 28px rgba(37,211,102,.34),
        inset 0 1px 0 rgba(255,255,255,.2),
        inset 0 -2px 6px rgba(0,0,0,.12);
    transition: transform .3s var(--cw-ease), box-shadow .3s, background .25s;
    position: relative;
    overflow: hidden;
}
.cw-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.18) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform .8s var(--cw-ease);
}
.cw-submit:hover {
    transform: translateY(-2px);
    box-shadow:
        0 16px 36px rgba(37,211,102,.42),
        inset 0 1px 0 rgba(255,255,255,.25),
        inset 0 -2px 6px rgba(0,0,0,.12);
}
.cw-submit:hover::before { transform: translateX(100%); }
.cw-submit:active { transform: translateY(0); }

.cw-disclaimer {
    margin-top: 0.25rem;
    font-size: 0.72rem;
    color: var(--cw-text-muted);
    text-align: center;
    line-height: 1.5;
}

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 800px) {
    .cw-modal__panel {
        grid-template-columns: 1fr;
        max-height: calc(100dvh - 1rem);
        overflow-y: auto;
    }
    .cw-modal__aside {
        padding: 1.75rem;
        align-items: flex-start;
    }
    .cw-modal__aside h3 { font-size: 1.2rem; }
    .cw-modal__aside p  { font-size: 0.85rem; margin-bottom: 0.875rem; }
    .cw-modal__list li  { font-size: 0.78rem; }
    .cw-modal__form { padding: 1.5rem 1.25rem 1.75rem; }
    .cw-grid { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
    /* FAB mais compacto em mobile, centralizado e respeitando safe-area */
    .cw-fab {
        bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
        right: 1rem;
        padding: 0.5rem;
        box-shadow: 0 12px 28px rgba(30,18,8,.22), 0 4px 10px rgba(37,211,102,.32);
    }
    .cw-fab__label { display: none; }
    .cw-fab__halo, .cw-fab__ring { left: 0.5rem; }
    .cw-fab__core { width: 44px; height: 44px; }
    .cw-fab__halo, .cw-fab__ring { width: 44px; height: 44px; }
}

@media (max-width: 480px) {
    /* Modal full-bleed bottom-sheet */
    .cw-modal { padding: 0; align-items: flex-end; }
    .cw-modal__panel {
        border-radius: 1.5rem 1.5rem 0 0;
        max-height: 94dvh;
        align-self: flex-end;
        width: 100%;
    }
    .cw-modal__panel::before {
        content: '';
        position: absolute;
        top: 0.65rem;
        left: 50%;
        transform: translateX(-50%);
        width: 44px;
        height: 4px;
        background: rgba(177,223,249,.6);
        border-radius: 2px;
        z-index: 6;
    }
    .cw-modal__close {
        top: 1.4rem;
        right: 1rem;
        width: 38px;
        height: 38px;
    }
    .cw-modal__aside {
        padding: 2.2rem 1.5rem 1.5rem;
        min-height: auto;
    }
    .cw-modal__aside-content h3 { font-size: 1.1rem; line-height: 1.25; }
    .cw-modal__aside-content p { font-size: 0.83rem; margin-bottom: 0.85rem; }
    .cw-modal__list { display: none; }
    .cw-modal__chip { font-size: 0.65rem; padding: 0.28rem 0.75rem; margin-bottom: 0.85rem; }
    .cw-modal__form {
        padding: 1.4rem 1.15rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
        gap: 0.85rem;
    }
    .cw-modal__header h2 { font-size: 1.15rem; }
    .cw-modal__header p { font-size: 0.82rem; }
    .cw-field label { font-size: 0.68rem; }
    .cw-field input, .cw-field select {
        padding: 0.85rem 0.95rem;
        border-radius: 0.78rem;
        min-height: 48px;
    }
    .cw-submit { padding: 1.05rem 1.4rem; font-size: 0.92rem; min-height: 52px; }
    .cw-disclaimer { font-size: 0.7rem; }
}

@media (max-width: 380px) {
    .cw-modal__aside { padding: 1.85rem 1.25rem 1.25rem; }
    .cw-modal__form { padding: 1.2rem 1rem calc(1.3rem + env(safe-area-inset-bottom, 0px)); }
    .cw-fab { right: 0.85rem; bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px)); }
}

/* Touch devices: alvos confortáveis */
@media (pointer: coarse) {
    .cw-modal__close { width: 44px; height: 44px; }
    .cw-field input, .cw-field select { min-height: 48px; }
    .cw-submit { min-height: 52px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cw-fab, .cw-modal, .cw-modal__panel, .cw-fab__halo, .cw-fab__ring,
    .cw-modal__aside-decor, .cw-modal__chip-dot {
        animation: none !important;
        transition-duration: .01ms !important;
    }
}
