/* ================= WhatsApp Inquiry Widget (scoped to .wa-widget) ================= */
.wa-widget,
.wa-widget *,
.wa-widget *::before,
.wa-widget *::after {
    box-sizing: border-box;
}

.wa-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2147483000; /* above site chrome */
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #1f2d3a;
}

/* ---- Floating bubble ---- */
/* Collapsed, the bubble is a 60px circle. On hover/focus it expands into a
   pill that reveals the "Send us an inquiry" label. A fixed-width icon zone
   on the left keeps the glyph centered as the pill grows. */
.wa-widget__bubble {
    position: relative;
    height: 60px;
    min-width: 60px; /* guarantees a circle even when the label is absent */
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: #25D366;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

.wa-widget__bubble:hover {
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
    background: #1fbd5a;
}

.wa-widget__bubble:focus-visible {
    outline: 3px solid #0b5c33;
    outline-offset: 3px;
}

/* Fixed-size icon zone; also the positioning context for the two glyphs. */
.wa-widget__bubble-icon,
.wa-widget__bubble-close {
    position: absolute;
    top: 50%;
    left: 30px; /* centre of the 60px icon zone */
    display: block;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Both icons are centered geometrically via translate(-50%, -50%). */
.wa-widget__bubble-icon {
    transform: translate(-50%, -50%) rotate(0) scale(1);
}

.wa-widget__bubble-close {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-90deg) scale(0.6);
}

.wa-widget.is-open .wa-widget__bubble-icon {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(90deg) scale(0.6);
}

.wa-widget.is-open .wa-widget__bubble-close {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0) scale(1);
}

/* ---- Hover-expand label ---- */
.wa-widget__bubble-label {
    /* Reserve the 60px icon zone on the left, then grow the label area. */
    padding-left: 60px;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 60px; /* vertically centre within the pill */
    opacity: 0;
    transition: max-width 0.28s ease, opacity 0.2s ease, padding-right 0.28s ease;
}

/* Expand on hover or keyboard focus — but not while the panel is open. */
.wa-widget:not(.is-open) .wa-widget__bubble:hover .wa-widget__bubble-label,
.wa-widget:not(.is-open) .wa-widget__bubble:focus-visible .wa-widget__bubble-label {
    max-width: 240px;
    padding-right: 22px;
    opacity: 1;
}

/* ---- Chat popup ---- */
.wa-widget__panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 360px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 120px);
    /* svh excludes dynamic browser UI (address bar), so the panel never
       exceeds the visible area when the bar is showing. Falls back to vh. */
    max-height: calc(100svh - 120px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
    transform-origin: bottom right;
    transform: translateY(12px) scale(0.96);
    opacity: 0;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.wa-widget__panel[hidden] {
    display: none;
}

.wa-widget.is-open .wa-widget__panel {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* ---- Header ---- */
.wa-widget__header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 18px 20px;
    background: #075E54; /* dark green */
    color: #fff;
}

.wa-widget__header-text {
    flex: 1 1 auto;
    min-width: 0;
}

.wa-widget__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
}

.wa-widget__subtitle {
    margin: 4px 0 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

.wa-widget__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.wa-widget__close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.wa-widget__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ---- Body (scrollable) ---- */
.wa-widget__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px;
    background: #e5ddd5; /* classic WhatsApp chat backdrop */
    background-image: linear-gradient(rgba(229, 221, 213, 0.6), rgba(229, 221, 213, 0.6));
}

.wa-widget__intro {
    margin: 0 0 16px;
    padding: 10px 12px;
    background: #fff;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #2a3942;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

/* ---- Form ---- */
.wa-widget__form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.wa-widget__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wa-widget__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #334;
}

.wa-widget__input {
    width: 100%;
    padding: 9px 11px;
    font-family: inherit;
    font-size: 0.9rem;
    color: #1f2d3a;
    background: #f7f9fa;
    border: 1px solid #d4dce0;
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wa-widget__input::placeholder {
    color: #9aa6ad;
}

.wa-widget__input:focus {
    outline: none;
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.25);
    background: #fff;
}

.wa-widget__textarea {
    resize: vertical;
    min-height: 72px;
    max-height: 180px;
}

.wa-widget__field.is-invalid .wa-widget__input {
    border-color: #d9342b;
    background: #fff6f5;
}

.wa-widget__field.is-invalid .wa-widget__input:focus {
    box-shadow: 0 0 0 3px rgba(217, 52, 43, 0.2);
}

.wa-widget__error {
    display: none;
    font-size: 0.78rem;
    color: #c42c22;
}

.wa-widget__field.is-invalid .wa-widget__error {
    display: block;
}

/* ---- Submit ---- */
.wa-widget__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 2px;
    padding: 11px 16px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    background: #25D366;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.wa-widget__submit:hover {
    background: #1fbd5a;
}

.wa-widget__submit:active {
    transform: translateY(1px);
}

.wa-widget__submit:focus-visible {
    outline: 3px solid #0b5c33;
    outline-offset: 2px;
}

.wa-widget__hint {
    margin: 0;
    font-size: 0.8rem;
    color: #0b7a3b;
}

.wa-widget__privacy {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.4;
    color: #70808a;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .wa-widget {
        right: 14px;
        bottom: 14px;
        /* Clear the iOS home indicator / gesture bar. */
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }

    .wa-widget__panel {
        width: calc(100vw - 28px);
        bottom: 72px;
        /* Fit within the *visible* viewport, accounting for the top browser
           bar (svh) plus the bubble, its gap, and the widget's own offset.
           vh line first as a fallback for browsers without svh support. */
        max-height: calc(100vh - 72px - 28px);
        max-height: calc(100svh - 72px - 28px - env(safe-area-inset-bottom, 0px));
    }

    /* Keep a compact circle on small screens; the hover-expand label is a
       desktop affordance. */
    .wa-widget__bubble {
        height: 56px;
        min-width: 56px;
    }

    .wa-widget__bubble-icon,
    .wa-widget__bubble-close {
        left: 28px; /* centre of the 56px icon zone */
    }

    .wa-widget__bubble-label {
        padding-left: 56px;
    }
}

/* On touch / coarse-pointer devices there is no hover, so never expand the
   pill — the bubble opens the widget on tap regardless. */
@media (hover: none), (pointer: coarse) {
    .wa-widget__bubble-label {
        display: none;
    }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .wa-widget__bubble,
    .wa-widget__panel,
    .wa-widget__bubble-icon,
    .wa-widget__bubble-close,
    .wa-widget__bubble-label,
    .wa-widget__input,
    .wa-widget__submit {
        transition: none;
    }
}
