/* =========================================================
           FLAME TOWERS AI CHAT
        ========================================================= */

#ft-chat {
    position: fixed;
    right: 30px;
    bottom: 30px;
    font-family: Arial, sans-serif;
    /* NOTE: position:fixed always creates its own stacking context
       (per CSS spec), regardless of z-index. Without an explicit
       z-index here, this whole widget would be treated as z-index:0
       and would render BELOW any sibling (e.g. #back-to-top) that has
       an explicit z-index, no matter what z-index its children use.
       Setting this above #back-to-top's z-index (9970) keeps the
       widget correctly on top; internal stacking of the button,
       overlay and window is still governed by their own z-index below. */
    z-index: 9999;
}


/* =========================================================
           FLOATING BUTTON
        ========================================================= */

#ft-chat-button {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient( 135deg, var(--color-gold-light, #f4d77b), var(--color-gold, #b8860b) );
    color: #111;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 0 rgba( 212, 175, 55, .7 ), 0 15px 40px rgba( 0, 0, 0, .5 );
    animation: ftPulse 2.5s infinite;
    transition: .3s;
    position: relative;
    z-index: 9999;
}


    #ft-chat-button:hover {
        transform: translateY(-5px) scale(1.05);
    }


@keyframes ftPulse {


    0% {
        box-shadow: 0 0 0 0 rgba( 212, 175, 55, .7 ), 0 15px 40px rgba( 0, 0, 0, .5 );
    }


    70% {
        box-shadow: 0 0 0 20px rgba( 212, 175, 55, 0 ), 0 15px 40px rgba( 0, 0, 0, .5 );
    }


    100% {
        box-shadow: 0 0 0 0 rgba( 212, 175, 55, 0 ), 0 15px 40px rgba( 0, 0, 0, .5 );
    }
}


/* =========================================================
           CHAT OVERLAY (page dimming)
        ========================================================= */

#ft-chat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .3s ease, visibility .3s ease;
}

    #ft-chat-overlay.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }


/* =========================================================
           CHAT WINDOW
        ========================================================= */

#ft-chat-window {
    position: absolute;
    right: 0;
    bottom: 80px;
    width: 360px;
    height: 520px;
    background: var(--color-dark-navy, #111);
    border: 1px solid rgba( 212, 175, 55, .6 );
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 70px rgba( 0, 0, 0, .65 );
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px) scale(.98);
    transition: opacity .3s ease, visibility .3s ease, transform .3s ease;
}

    #ft-chat-window.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }


/* =========================================================
           HEADER
        ========================================================= */

.ft-chat-header {
    height: 70px;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-navy-mid, #0b0b0b);
    color: white;
}


    .ft-chat-header strong {
        display: block;
        color: var(--color-gold, #d4af37);
    }


    .ft-chat-header small {
        color: #aaa;
    }


#ft-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
}


/* =========================================================
           MESSAGES
        ========================================================= */

#ft-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}


.ft-ai-message,
.ft-user-message {
    max-width: 80%;
    padding: 12px 15px;
    margin-bottom: 12px;
    border-radius: 15px;
    line-height: 1.5;
}


.ft-ai-message {
    background: var(--color-navy-light, #222);
    color: white;
}


.ft-user-message {
    margin-left: auto;
    background: var(--color-gold, #d4af37);
    color: #111;
}


/* =========================================================
           SUGGESTIONS
        ========================================================= */

.ft-suggestions {
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}


    .ft-suggestions button {
        background: var(--color-navy-light, #222);
        border: 1px solid #555;
        color: white;
        padding: 7px 10px;
        border-radius: 20px;
        cursor: pointer;
        font-size: 12px;
        transition: .2s;
    }


        .ft-suggestions button:hover {
            border-color: var(--color-gold, #d4af37);
        }


        .ft-suggestions button.active {
            background: var(--color-gold, #d4af37);
            border-color: var(--color-gold, #d4af37);
            color: #111;
        }

/*.ft-suggestion.active {
    background: #FF8C42 !important;
    color: #ffffff !important;
    border-color: #FF8C42 !important;
    font-weight: 600 !important;
}*/


/* =========================================================
           INPUT
        ========================================================= */

.ft-chat-input {
    display: flex;
    padding: 10px;
    background: var(--color-navy-mid, #0b0b0b);
}


    .ft-chat-input input {
        flex: 1;
        background: var(--color-navy-light, #222);
        border: none;
        padding: 12px;
        color: white;
        outline: none;
    }


    .ft-chat-input button {
        width: 70px;
        background: var(--color-gold, #d4af37);
        border: none;
        cursor: pointer;
    }


/* =========================================================
           TYPING ANIMATION
        ========================================================= */

.ft-typing span {
    animation: ftTyping 1.4s infinite;
}


    .ft-typing span:nth-child(2) {
        animation-delay: .2s;
    }


    .ft-typing span:nth-child(3) {
        animation-delay: .4s;
    }


@keyframes ftTyping {


    0%, 60%, 100% {
        opacity: .2;
    }


    30% {
        opacity: 1;
    }
}


/* =========================================================
           MOBILE
        ========================================================= */

@media(max-width:600px) {


    #ft-chat-window {
        width: calc( 100vw - 30px );
        right: -15px;
        height: 80vh;
    }
}


/* =========================================================
           CATALOGUE OPTIONS
        ========================================================= */

.ft-catalogue-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}


.ft-catalogue-option {
    background: var(--color-navy-light, #222);
    border: 1px solid var(--color-gold, #d4af37);
    color: white;
    padding: 9px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    transition: .2s;
}


    .ft-catalogue-option:hover {
        background: var(--color-gold, #d4af37);
        color: #111;
    }


/* =========================================================
   APPOINTMENT FORM
========================================================= */

.ft-appointment-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}


    .ft-appointment-form input,
    .ft-appointment-form select,
    .ft-appointment-form textarea {
        width: 100%;
        box-sizing: border-box;
        background: var(--color-navy-light, #222);
        border: 1px solid #555;
        border-radius: 8px;
        color: white;
        padding: 10px;
        font-size: 12px;
        outline: none;
    }


        .ft-appointment-form input:focus,
        .ft-appointment-form select:focus,
        .ft-appointment-form textarea:focus {
            border-color: var(--color-gold, #d4af37);
        }


    .ft-appointment-form select {
        color: white;
    }


        .ft-appointment-form select option {
            background: var(--color-navy-light, #222);
            color: white;
        }


    .ft-appointment-form input[type="datetime-local"] {
        color-scheme: dark;
    }


    .ft-appointment-form textarea {
        resize: vertical;
    }


.ft-submit-appointment {
    width: 100%;
    background: var(--color-gold, #d4af37);
    color: #111;
    border: none;
    border-radius: 8px;
    padding: 11px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 4px;
}


    .ft-submit-appointment:hover {
        background: var(--color-gold-light, #f4d77b);
    }


    .ft-submit-appointment:disabled {
        opacity: .6;
        cursor: not-allowed;
    }


/* =========================================================
   CONSENT CHECKBOX (forms + catalogue email step)
========================================================= */

.ft-consent-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--color-navy-light, #222);
    border: 1px solid #555;
    border-radius: 8px;
    padding: 10px;
    margin-top: 4px;
    max-width: 85%;
    box-sizing: border-box;
}

    .ft-appointment-form .ft-consent-row {
        max-width: 100%;
        margin-top: 0;
    }

    .ft-consent-row input[type="checkbox"] {
        width: 15px !important;
        height: 15px !important;
        flex-shrink: 0;
        margin: 2px 0 0;
        padding: 0;
        background: transparent;
        border: none;
        accent-color: var(--color-gold, #d4af37);
        cursor: pointer;
    }

    .ft-consent-row label {
        font-size: 11px;
        line-height: 1.5;
        color: rgba(255, 255, 255, 0.82);
        cursor: pointer;
    }

    .ft-consent-row.is-consent-error {
        border-color: #d64545;
    }

        .ft-consent-row.is-consent-error label {
            color: #ff8a8a;
        }


/* =========================================================
   APPOINTMENT AND CATALOGUE INPUT TEXT
========================================================= */


/* User-entered text */

#ft-chat-window input,
#ft-chat-window textarea,
#ft-chat-window select {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}


    /* Placeholder text */

    #ft-chat-window input::placeholder,
    #ft-chat-window textarea::placeholder {
        color: var(--color-gold, #d4af37) !important;
        opacity: 1 !important;
    }


    /* Chrome / Edge */

    #ft-chat-window input::-webkit-input-placeholder,
    #ft-chat-window textarea::-webkit-input-placeholder {
        color: var(--color-gold, #d4af37) !important;
        opacity: 1 !important;
    }


    /* Firefox */

    #ft-chat-window input::-moz-placeholder,
    #ft-chat-window textarea::-moz-placeholder {
        color: var(--color-gold, #d4af37) !important;
        opacity: 1 !important;
    }


/* Appointment form specifically */

#ft-chat-window .ft-appointment-form input,
#ft-chat-window .ft-appointment-form textarea {
    background: var(--color-navy-light, #222) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}


    /* Appointment placeholder text */

    #ft-chat-window .ft-appointment-form input::placeholder,
    #ft-chat-window .ft-appointment-form textarea::placeholder {
        color: var(--color-gold, #d4af37) !important;
        opacity: 1 !important;
    }


/* =========================================================
   RTL SUPPORT (ARABIC)
========================================================= */

.ft-rtl {
    direction: rtl;
}

    .ft-rtl .ft-chat-input {
        /* Force this row's own layout direction to ltr so that
           flex-direction: row-reverse below produces a deterministic,
           unambiguous visual reversal (send button left, input right),
           independent of the inherited direction:rtl from .ft-rtl. */
        direction: ltr;
        flex-direction: row-reverse;
    }

    .ft-rtl .ft-chat-input input {
        /* The text field content still reads/types right-to-left. */
        direction: rtl;
        text-align: right;
    }

    .ft-rtl .ft-chat-input button {
        flex-shrink: 0;
    }

    .ft-rtl .ft-ai-message {
        margin-left: auto;
        margin-right: 0;
    }

    .ft-rtl .ft-user-message {
        margin-right: auto;
        margin-left: 0;
    }

    .ft-rtl .ft-suggestions {
        justify-content: flex-end;
    }

/* =========================================================
   FLAME TOWERS APPOINTMENT AUTOFILL PROTECTION
========================================================= */

/* Prevent browser autofill from changing the Flame Towers
   appointment fields to white. */

#ft-chat-window .ft-appointment-form input:-webkit-autofill,
#ft-chat-window .ft-appointment-form input:-webkit-autofill:hover,
#ft-chat-window .ft-appointment-form input:-webkit-autofill:focus,
#ft-chat-window .ft-appointment-form input:-webkit-autofill:active,
#ft-chat-window .ft-appointment-form textarea:-webkit-autofill,
#ft-chat-window .ft-appointment-form textarea:-webkit-autofill:hover,
#ft-chat-window .ft-appointment-form textarea:-webkit-autofill:focus,
#ft-chat-window .ft-appointment-form textarea:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #222 inset !important;
    box-shadow: 0 0 0 1000px #222 inset !important;
    -webkit-text-fill-color: #ffffff !important;
    color: #ffffff !important;
    caret-color: #ffffff !important;
    transition: background-color 9999s ease-in-out 0s !important;
}


/* Keep the Flame Towers dark appearance even when
   browser autofill is active. */

#ft-chat-window .ft-appointment-form input,
#ft-chat-window .ft-appointment-form textarea {
    background-color: #222 !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}


/* =========================================================
   APPOINTMENT SELECT
========================================================= */

#ft-chat-window .ft-appointment-form select {
    background-color: #222 !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}


/* =========================================================
   PLACEHOLDERS
========================================================= */

#ft-chat-window .ft-appointment-form input::placeholder,
#ft-chat-window .ft-appointment-form textarea::placeholder {
    color: var(--color-gold, #d4af37) !important;
    opacity: 1 !important;
}


/*===========================================================*/




/* =========================================================
   CATALOGUE EMAIL INPUT HIGHLIGHT
========================================================= */

#ft-message-input.ft-catalogue-email-active {
    border: 1px solid var(--color-gold, #d4af37) !important;
    box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.25), 0 0 15px rgba(212, 175, 55, 0.35) !important;
    background: var(--color-navy-light, #222) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    animation: ftCatalogueEmailPulse 1.8s ease-in-out infinite;
}


@keyframes ftCatalogueEmailPulse {

    0%, 100% {
        box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.20), 0 0 10px rgba(212, 175, 55, 0.25);
    }

    50% {
        box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.45), 0 0 20px rgba(212, 175, 55, 0.50);
    }
}


/* =========================================================
   NORMAL CHAT INPUT DISABLED DURING APPOINTMENT
========================================================= */

#ft-message-input.ft-chat-disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
}


#ft-send.ft-chat-disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
}