/* =====================================================
   BAOIAM - ENQUIRY WIDGET
===================================================== */

:root {
    --enq-primary: #FF6600;
    --enq-primary-hover: #E65C00;
    --enq-dark: #222222;
    --enq-border: #E2E8F0;
    --enq-radius: 20px;
}

.enq-root {
    position: fixed;
    right: 22px;
    bottom: 24px;
    z-index: 1100;
    font-family: var(--font-sans, "Inter", sans-serif);
}

/* ==========================
   BACKDROP OVERLAY
========================== */

.enq-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: -1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.enq-root.is-open .enq-backdrop {
    opacity: 1;
    pointer-events: auto;
}

/* ==========================
   FLOATING BUTTON (FAB)
========================== */

.enq-fab {
    position: relative;
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: var(--enq-primary);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(255, 102, 0, 0.42);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    z-index: 2;
}

.enq-fab:hover {
    background: var(--enq-primary-hover);
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 14px 32px rgba(255, 102, 0, 0.5);
}

.enq-fab:focus-visible {
    outline: 3px solid rgba(255, 102, 0, 0.45);
    outline-offset: 3px;
}

.enq-fab::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--enq-primary);
    opacity: 0.55;
    z-index: -1;
    animation: enqPulse 2.4s ease-out infinite;
}

@keyframes enqPulse {
    0%   { transform: scale(1); opacity: 0.5; }
    70%  { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(1.5); opacity: 0; }
}

.enq-root.is-open .enq-fab-open { display: none; }
.enq-root:not(.is-open) .enq-fab-close { display: none; }
.enq-root.is-open .enq-fab::after { animation: none; opacity: 0; }

.enq-fab-tip {
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    padding: 7px 14px;
    border-radius: 999px;
    background: #ffffff;
    color: #222222;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.enq-fab:hover .enq-fab-tip {
    opacity: 1;
    transform: translateY(-50%) translateX(-4px);
}

.enq-root.is-open .enq-fab-tip { display: none; }

/* ==========================
   PANEL
========================== */

.enq-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 14px);
    width: min(360px, calc(100vw - 32px));
    max-height: min(580px, calc(100dvh - 90px));
    overflow-y: auto;
    border-radius: var(--enq-radius);
    background: #ffffff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);

    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.97);
    transform-origin: bottom right;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.enq-panel::-webkit-scrollbar {
    width: 6px;
}
.enq-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.enq-root.is-open .enq-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ==========================
   HEADER
========================== */

.enq-head {
    position: relative;
    padding: 18px 48px 16px 20px;
    border-radius: var(--enq-radius) var(--enq-radius) 0 0;
    background: linear-gradient(135deg, #FF7A1A 0%, #FF6600 100%);
    color: #ffffff;
}

.enq-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 15px;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.enq-close:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: rotate(90deg);
}

.enq-head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.25;
}

.enq-head p {
    margin: 5px 0 0;
    font-size: 12.5px;
    line-height: 1.45;
    opacity: 0.94;
}

/* ==========================
   FORM & FIELDS
========================== */

.enq-form {
    display: flex;
    flex-direction: column;
    gap: 11px;
    padding: 16px 20px 20px;
    background: #ffffff;
}

.enq-field {
    display: flex;
    flex-direction: column;
}

.enq-field label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 700;
    color: #444444;
}

.enq-field label span {
    color: var(--enq-primary);
}

.enq-field input,
.enq-field select,
.enq-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.4px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    font-family: inherit;
    font-size: 14px;
    color: #222222;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.enq-field select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 32px;
}

.enq-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.enq-select-chevron {
    position: absolute;
    right: 12px;
    font-size: 11px;
    color: #94a3b8;
    pointer-events: none;
}

.enq-field textarea {
    min-height: 56px;
    height: 56px;
    resize: vertical;
}

.enq-field input:focus,
.enq-field select:focus,
.enq-field textarea:focus {
    border-color: var(--enq-primary);
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.14);
}

.enq-field.has-error input,
.enq-field.has-error select,
.enq-field.has-error textarea {
    border-color: #d93025;
}

.enq-error {
    display: none;
    margin-top: 4px;
    font-size: 11.5px;
    color: #d93025;
}

.enq-field.has-error .enq-error {
    display: block;
}

.enq-turnstile {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    min-height: 0;
    width: 100%;
}

.enq-submit {
    margin-top: 3px;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    background: var(--enq-primary);
    color: #ffffff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(255, 102, 0, 0.35);
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.enq-submit:hover:not(:disabled) {
    background: var(--enq-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(255, 102, 0, 0.45);
}

.enq-submit:active:not(:disabled) {
    transform: scale(0.99);
}

.enq-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    box-shadow: none;
}

.enq-note {
    margin: 4px 0 0;
    font-size: 11px;
    line-height: 1.45;
    color: #888888;
    text-align: center;
}

/* Whole-form failure */
.enq-formerror {
    display: none;
    padding: 9px 11px;
    border-radius: 8px;
    background: #fdecea;
    font-size: 12.5px;
    color: #b3261e;
}

.enq-formerror.is-on {
    display: block;
}

/* ==========================
   SUCCESS STATE
========================== */

.enq-done {
    display: none;
    padding: 30px 24px 34px;
    text-align: center;
}

.enq-panel.is-done .enq-form,
.enq-panel.is-done .enq-head {
    display: none;
}

.enq-panel.is-done .enq-done {
    display: block;
}

.enq-done-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: #e8f5e9;
    color: #1e8e3e;
    font-size: 26px;
}

.enq-done h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: #222222;
}

.enq-done p {
    margin: 8px 0 0;
    font-size: 13.5px;
    line-height: 1.5;
    color: #666666;
}

.enq-done button {
    margin-top: 18px;
    padding: 9px 22px;
    border: 1.4px solid var(--enq-primary);
    border-radius: 999px;
    background: #ffffff;
    color: var(--enq-primary);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.enq-done button:hover {
    background: var(--enq-primary);
    color: #ffffff;
}

/* ==========================
   RESPONSIVE (MOBILE FIX)
========================== */

@media (max-width: 540px) {

    .enq-root {
        right: 16px;
        bottom: 18px;
    }

    .enq-fab {
        width: 54px;
        height: 54px;
        font-size: 20px;
    }

    /* Fixed mobile modal that fits naturally without stretching and empty blank space */
    .enq-root.is-open .enq-panel {
        position: fixed;
        left: 50%;
        bottom: 16px;
        top: auto;
        right: auto;
        transform: translate(-50%, 0) scale(1);
        width: min(390px, calc(100vw - 24px));
        max-height: calc(100dvh - 32px);
        overflow-y: auto;
        border-radius: 20px;
        box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
        z-index: 1100;
    }

    .enq-panel {
        transform-origin: center bottom;
        transform: translate(-50%, 16px) scale(0.96);
    }

    .enq-head {
        padding: 16px 44px 14px 16px;
    }

    .enq-head h3 {
        font-size: 16px;
    }

    .enq-head p {
        margin-top: 4px;
        font-size: 12px;
        line-height: 1.35;
    }

    .enq-form {
        gap: 8px;
        padding: 12px 16px 16px;
    }

    .enq-field label {
        margin-bottom: 3px;
        font-size: 11.5px;
    }

    .enq-field input,
    .enq-field select,
    .enq-field textarea {
        padding: 8px 10px;
        border-radius: 8px;
        font-size: 13.5px;
    }

    .enq-field textarea {
        min-height: 48px;
        height: 48px;
    }

    .enq-submit {
        padding: 10px 14px;
        font-size: 14px;
        border-radius: 8px;
    }

    .enq-note {
        font-size: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .enq-fab::after { animation: none; }
    .enq-panel,
    .enq-fab,
    .enq-backdrop { transition: none; }
}
