/* Live enquiry widget. Scope every rule so page styles and form resets stay separate. */
#chat-widget,
#chat-widget * {
    box-sizing: border-box;
}

#chat-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99999;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #19382f;
}

#chat-widget button,
#chat-widget input,
#chat-widget textarea {
    font-family: inherit;
}

#chat-widget #chat-toggle-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 64px;
    height: 64px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #1cbd69, #078775);
    color: white;
    cursor: pointer;
    box-shadow: 0 6px 24px #123d3240;
    transition: transform .2s ease;
}

#chat-widget #chat-toggle-btn:hover {
    transform: translateY(-2px);
}
#chat-widget #chat-toggle-btn svg {
    width: 30px;
    height: 30px;
    fill: white;
}
#chat-widget .chat-btn-label {
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .06em;
}
#chat-widget .notif-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    border: 2px solid white;
    border-radius: 50%;
    background: #ef5350;
}

#chat-widget #chat-box {
    position: absolute;
    right: 0;
    bottom: 78px;
    display: none;
    flex-direction: column;
    width: min(370px, calc(100vw - 32px));
    max-height: calc(100vh - 126px);
    max-height: min(680px, calc(100dvh - 126px));
    overflow: hidden;
    border: 1px solid #d5e4dc;
    border-radius: 18px;
    background: white;
    box-shadow: 0 18px 60px #123d3233, 0 4px 12px #123d321a;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .18s ease, transform .18s ease;
}

#chat-widget #chat-box.open {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}
#chat-widget .chat-header {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 12px;
    padding: 18px 20px;
    background: linear-gradient(120deg, #12553e, #078775);
    color: white;
}
#chat-widget .chat-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border: 1px solid #ffffff38;
    border-radius: 12px;
    background: #ffffff1f;
    font-size: 22px;
}
#chat-widget .chat-header-info {
    min-width: 0;
    flex: 1;
}
#chat-widget .chat-header-info h3 {
    margin: 0;
    color: white;
    font-size: 17px;
    font-weight: 650;
    line-height: 1.3;
    letter-spacing: 0;
}
#chat-widget .live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    color: #e5fff1;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
}
#chat-widget .live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #97efae;
}
#chat-widget .chat-close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #ffffff40;
    border-radius: 8px;
    background: transparent;
    color: white;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}
#chat-widget .chat-close:hover {
    background: #ffffff24;
}
#chat-widget .chat-body {
    min-height: 0;
    padding: 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #91b7a3 transparent;
}
#chat-widget .step {
    display: none;
}
#chat-widget .step.active {
    display: block;
}
#chat-widget .welcome-bubble {
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid #dcebe2;
    border-radius: 10px 10px 10px 2px;
    background: #f0f7f2;
    color: #365449;
    font-size: 13px;
    line-height: 1.6;
}
#chat-widget .field-group {
    margin: 0 0 14px;
}
#chat-widget .field-label {
    display: block;
    margin: 0 0 7px;
    color: #314e42;
    font-size: 13px;
    font-weight: 600;
}
#chat-widget .field-optional {
    color: #66776e;
    font-size: 12px;
    font-weight: 400;
}
#chat-widget .field-input {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #bdcec3;
    border-radius: 8px;
    background: white;
    color: #19382f;
    font-size: 14px;
    line-height: 1.5;
}
#chat-widget .field-input::placeholder {
    color: #718177;
    opacity: 1;
}
#chat-widget textarea.field-input {
    min-height: 112px;
    resize: vertical;
    max-height: 200px;
}
#chat-widget .field-input:focus {
    outline: 2px solid #7db399;
    outline-offset: 1px;
    border-color: #1a7552;
}
#chat-widget .field-error {
    display: none;
    margin: 6px 0 0;
    color: #b3261e;
    font-size: 12px;
}
#chat-widget .field-error.show {
    display: block;
}
#chat-widget .pref-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
#chat-widget .pref-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    gap: 6px;
    min-height: 38px;
    margin: 0;
    padding: 7px 9px;
    border: 1px solid #c9ddcf;
    border-radius: 7px;
    background: #f3f8f4;
    color: #21513a;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}
#chat-widget .pref-pill input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: #087a50;
}
#chat-widget .pref-pill:has(input:checked) {
    border-color: #70a88b;
    background: #eaf5ed;
}
#chat-widget .send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    margin: 6px 0 0;
    padding: 11px 16px;
    border: 0;
    border-radius: 8px;
    background: #087a50;
    color: white;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.5;
    cursor: pointer;
}
#chat-widget .send-btn:hover {
    background: #075d3f;
}
#chat-widget .send-btn:disabled {
    opacity: .65;
    cursor: wait;
}
#chat-widget .chat-back {
    display: block;
    margin: 14px auto 0;
    padding: 4px;
    border: 0;
    background: transparent;
    color: #236346;
    font-size: 12px;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
#chat-widget .chat-footer {
    flex-shrink: 0;
    padding: 11px 20px;
    border-top: 1px solid #e5ece6;
    background: #f8faf8;
    color: #63746a;
    font-size: 11px;
    text-align: center;
}
#chat-widget .chat-footer a {
    color: #17633e;
    text-decoration: underline;
    text-underline-offset: 2px;
}
#chat-widget .thankyou-screen {
    padding: 10px 0;
    text-align: center;
}
#chat-widget .thankyou-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: #e6f4e9;
    font-size: 28px;
}
#chat-widget .thankyou-title {
    margin-bottom: 8px;
    font-size: 20px;
    font-weight: 650;
}
#chat-widget .thankyou-subtitle {
    color: #596c61;
    font-size: 14px;
    line-height: 1.7;
}
#chat-widget .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff70;
    border-top-color: white;
    border-radius: 50%;
    animation: chat-spinner .7s linear infinite;
}
#chat-widget button:focus-visible {
    outline: 3px solid #84b99b;
    outline-offset: 3px;
}
@keyframes chat-spinner { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
    #chat-widget {
        right: 14px;
        bottom: 14px;
    }
    #chat-widget #chat-box {
        right: 0;
        bottom: 76px;
        /* Leave room for the page scrollbar as well as both edge margins. */
        width: calc(100vw - 44px);
        max-height: calc(100vh - 112px);
        max-height: calc(100dvh - 112px);
    }
    #chat-widget .chat-header {
        padding: 16px;
    }
    #chat-widget .chat-body {
        padding: 16px;
    }
    #chat-widget .field-input {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #chat-widget #chat-box,
    #chat-widget #chat-toggle-btn {
        transition: none;
    }
    #chat-widget .spinner {
        animation: none;
    }
}

@media print { #chat-widget { display: none; } }
