
/* ==========================================================
   RED CARPET TOURS - CHAT ASSISTANT
========================================================== */

:root {
    --chat-red: #b1252b;
    --chat-red-dark: #8f1d22;
    --chat-red-deep: #75171c;
    --chat-red-light: #fff1f2;

    --chat-text: #1d2635;
    --chat-muted: #7c8492;
    --chat-border: #e7e9ee;
    --chat-background: #f6f7f9;

    --chat-success: #209653;
    --chat-danger: #dc3545;

    --chat-shadow:
        0 20px 60px rgba(22, 35, 59, 0.18),
        0 5px 20px rgba(22, 35, 59, 0.08);
}


/* ==========================================================
   BASIC RESET - ONLY CHAT
========================================================== */

#chatButton,
#chatBox,
#chatBox * {
    box-sizing: border-box;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;
}


/* ==========================================================
   FLOATING CHAT BUTTON
========================================================== */

#chatButton {
    position: fixed;
    right: 24px;
    bottom: 24px;

    display: flex;
    align-items: center;
    gap: 9px;

    padding: 8px 16px 8px 8px;

    border: 0;
    border-radius: 50px;

    background: linear-gradient(
        135deg,
        var(--chat-red),
        var(--chat-red-dark)
    );

    color: #fff;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    z-index: 2147483647;

    box-shadow:
        0 8px 26px rgba(177, 37, 43, 0.32);

    transition:
        transform .22s ease,
        box-shadow .22s ease;
}


#chatButton:hover {
    transform: translateY(-3px);

    box-shadow:
        0 13px 30px rgba(177, 37, 43, 0.38);
}


#chatButton:active {
    transform: scale(.97);
}


.chatButtonIcon {
    width: 38px;
    height: 38px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: rgba(255, 255, 255, .14);
}


.chatButtonIcon svg {
    width: 26px;
    height: 26px;
}


.chatButtonText {
    white-space: nowrap;
}


/* Notification */

.chatNotification {
    position: absolute;
    top: -3px;
    right: -3px;

    min-width: 18px;
    height: 18px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0 3px;

    border: 2px solid #fff;
    border-radius: 50%;

    background: #22c55e;

    color: #fff;

    font-size: 9px;
    font-weight: 700;

    animation: chatNotificationPulse 2s infinite;
}


@keyframes chatNotificationPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, .35);
    }

    70% {
        box-shadow: 0 0 0 7px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}


/* ==========================================================
   CHAT WINDOW
========================================================== */

#chatBox {
    position: fixed;
    right: 24px;
    bottom: 88px;

    width: 390px;
    height: min(520px, calc(100vh - 115px));

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background: #fff;

    border: 1px solid rgba(22, 35, 59, .06);
    border-radius: 22px;

    box-shadow: var(--chat-shadow);

    z-index: 2147483647;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(20px) scale(.97);
    transform-origin: bottom right;

    transition:
        opacity .22s ease,
        transform .28s cubic-bezier(.4, 0, .2, 1),
        visibility .22s ease;
}


#chatBox.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform:translateY(0)scale(1);
}


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

#chatHeader {
    min-height: 82px;

    flex-shrink: 0;

    display: flex;
    align-items: center;

    padding: 15px 17px;

    color: #fff;

    background: linear-gradient(
        130deg,
        var(--chat-red) 0%,
        #941f25 58%,
        var(--chat-red-deep) 100%
    );
}


.chatHeaderContent {
    flex: 1;

    min-width: 0;

    display: flex;
    align-items: center;
    gap: 11px;
}


.chatAvatar {
    width: 45px;
    height: 45px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border:
        1px solid
        rgba(255, 255, 255, .25);

    border-radius: 50%;

    background:
        rgba(255, 255, 255, .14);

    font-size: 15px;
    font-weight: 700;
}


.chatHeaderText {
    min-width: 0;
}


.chatTitle {
    overflow: hidden;

    color: #fff;

    font-size: 15px;
    font-weight: 700;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.chatStatus {
    display: flex;
    align-items: center;
    gap: 6px;

    margin-top: 3px;

    color:
        rgba(255, 255, 255, .80);

    font-size: 10.5px;
}


.statusDot {
    width: 7px;
    height: 7px;

    flex-shrink: 0;

    border-radius: 50%;

    background: #4ade80;

    box-shadow:
        0 0 0 3px
        rgba(74, 222, 128, .15);
}


/* Close Button */

#chatClose {
    width: 35px;
    height: 35px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background:
        rgba(255, 255, 255, .10);

    color: #fff;

    font-size: 20px;
    line-height: 1;

    cursor: pointer;

    transition:
        background .2s ease,
        transform .2s ease;
}


#chatClose:hover {
    background:
        rgba(255, 255, 255, .20);

    transform: rotate(6deg);
}


/* ==========================================================
   MESSAGE AREA
========================================================== */

#chatMessages {
    flex: 1;
    min-height: 0;

    overflow-x: hidden;
    overflow-y: auto;

    padding: 18px 15px;

    background: linear-gradient(
        180deg,
        #f9fafb 0%,
        #f5f6f8 100%
    );

    color: var(--chat-text);

    font-size: 13px;

    overscroll-behavior: contain;

    scroll-behavior: smooth;
}


/* Scrollbar */

#chatMessages::-webkit-scrollbar {
    width: 5px;
}


#chatMessages::-webkit-scrollbar-track {
    background: transparent;
}


#chatMessages::-webkit-scrollbar-thumb {
    background: #d6d8dd;
    border-radius: 20px;
}


/* ==========================================================
   WELCOME AREA
========================================================== */

.chatWelcome {
    padding: 2px 8px 16px;

    text-align: center;
}


.chatWelcomeIcon {
    width: 46px;
    height: 46px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0 auto 9px;

    border-radius: 15px;

    background: var(--chat-red-light);

    color: var(--chat-red);

    font-size: 21px;
}


.chatWelcome h4 {
    margin: 0;

    color: var(--chat-text);

    font-size: 14px;
    font-weight: 700;
}


.chatWelcome p {
    max-width: 280px;

    margin: 5px auto 0;

    color: var(--chat-muted);

    font-size: 11.5px;
    line-height: 1.5;
}


/* ==========================================================
   MESSAGE ROW
========================================================== */

.messageRow {
    display: flex;

    width: 100%;

    margin-bottom: 12px;
}


.botRow {
    justify-content: flex-start;
}


.userRow {
    justify-content: flex-end;
}


/* ==========================================================
   MESSAGE BUBBLES
========================================================== */

.message {
    max-width: 84%;

    padding: 10px 13px;

    overflow-wrap: anywhere;

    border-radius: 15px;

    font-size: 12.5px;
    line-height: 1.55;

    animation: chatMessageIn .22s ease;
}


.message.bot {
    margin-right: auto;

    border:
        1px solid
        var(--chat-border);

    border-bottom-left-radius: 5px;

    background: #fff;

    color: var(--chat-text);

    box-shadow:
        0 2px 7px
        rgba(22, 35, 59, .04);
}


.message.user {
    margin-left: auto;

    border-bottom-right-radius: 5px;

    background: linear-gradient(
        135deg,
        var(--chat-red),
        #981f25
    );

    color: #fff;

    box-shadow:
        0 3px 10px
        rgba(177, 37, 43, .15);
}


@keyframes chatMessageIn {
    from {
        opacity: 0;

        transform:
            translateY(7px);
    }

    to {
        opacity: 1;

        transform:
            translateY(0);
    }
}


.message strong {
    font-weight: 700;
}


.message.bot strong {
    color: #242a34;
}


.botListItem {
    margin: 3px 0;
}


/* ==========================================================
   QUICK ACTION BUTTONS
========================================================== */

.quickActions {
    display: flex;
    flex-wrap: wrap;

    gap: 7px;

    margin: 4px 0 17px;
}


.quickAction {
    padding: 7px 11px;

    border:
        1px solid
        #e2e4e8;

    border-radius: 30px;

    background: #fff;

    color: #555d69;

    font-size: 10.5px;
    font-weight: 500;

    cursor: pointer;

    transition:
        border .2s ease,
        background .2s ease,
        color .2s ease,
        transform .2s ease;
}


.quickAction:hover:not(:disabled) {
    border-color:
        rgba(177, 37, 43, .40);

    background:
        var(--chat-red-light);

    color:
        var(--chat-red);

    transform:
        translateY(-1px);
}


.quickAction:disabled {
    opacity: .45;

    cursor: not-allowed;
}


/* ==========================================================
   TYPING INDICATOR
========================================================== */

.typingMessage {
    display: inline-flex;

    padding: 11px 13px;

    border:
        1px solid
        var(--chat-border);

    border-radius:
        15px
        15px
        15px
        5px;

    background: #fff;

    box-shadow:
        0 2px 7px
        rgba(22, 35, 59, .04);
}


.typing {
    display: flex;
    align-items: center;

    gap: 4px;
}


.typing span {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #9ca3af;

    animation:
        chatTyping
        1.2s
        infinite;
}


.typing span:nth-child(2) {
    animation-delay: .15s;
}


.typing span:nth-child(3) {
    animation-delay: .3s;
}


@keyframes chatTyping {
    0%,
    60%,
    100% {
        opacity: .5;

        transform:
            translateY(0);
    }

    30% {
        opacity: 1;

        transform:
            translateY(-4px);
    }
}


/* ==========================================================
   LEAD FORM
========================================================== */

.leadFormCard {
    width: 76%;
    padding: 15px;
    border:1px solid #e6e8ec;
    border-radius: 17px  17px 17px  6px;
    background: #dddddd;
    box-shadow:0 4px 16px rgba(22, 35, 59, .06);
    animation: chatMessageIn.25s ease;
}


.leadFormHeader {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
}


.leadFormIcon {
    width: 37px;
    height: 37px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: var(--chat-red-light);
    color: var(--chat-red);
    font-size: 17px;
}


.leadFormTitle {
    color: var(--chat-text);
    font-size: 13px;
    font-weight: 700;
}


.leadFormSubtitle {
    margin-top: 3px;
    color: var(--chat-muted);
    font-size: 10.5px;
    line-height: 1.4;
}


/* Fields */

.leadField {
    margin-bottom: 10px;
}


.leadField label {
    display: block;
    margin-bottom: 5px;
    color: #454b57;
    font-size: 10.5px;
    font-weight: 600;
}


.leadField input {
    width: 100%;
    height: 41px;
    padding: 0 11px;
    border: 1px solid#e0e3e8;
    border-radius: 9px;
    outline: none;
    background: #fafafa;
    color: var(--chat-text);
    font-size: 11.5px;
    transition:border .2s ease,box-shadow .2s ease, background .2s ease;
}


.leadField input::placeholder {
    color: #a1a6af;
}


.leadField input:focus {
    border-color:rgba(177, 37, 43, .50);
    background: #fff;
    box-shadow:0 0 0 3px rgba(177, 37, 43, .07);
}


.leadField input.fieldInvalid {
    border-color:
        var(--chat-danger);

    background: #fffafa;
}


/* Field Error */

.fieldError {
    display: block;

    margin-top: 3px;

    color: var(--chat-danger);

    font-size: 9px;
}


/* Phone */

.phoneInputWrapper {
    display: flex;
    align-items: center;

    height: 41px;

    overflow: hidden;

    border:
        1px solid
        #e0e3e8;

    border-radius: 9px;

    background: #fafafa;

    transition:
        border .2s ease,
        box-shadow .2s ease;
}


.phoneInputWrapper:focus-within {
    border-color:
        rgba(177, 37, 43, .50);

    background: #fff;

    box-shadow:
        0 0 0 3px
        rgba(177, 37, 43, .07);
}


.phonePrefix {
    flex-shrink: 0;

    padding: 0 10px;

    border-right:
        1px solid
        #e1e3e7;

    color: #606773;

    font-size: 11px;
    font-weight: 500;
}


.phoneInputWrapper input {
    flex: 1;

    height: 100%;

    border: 0 !important;
    border-radius: 0;

    background: transparent;

    box-shadow: none !important;
}


/* Lead Error */

.leadGeneralError {
    margin: 5px 0 7px;

    color: var(--chat-danger);

    font-size: 9.5px;

    text-align: center;
}


/* Lead Button */

.leadSubmitBtn {
    width: 100%;
    min-height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 7px;

    margin-top: 3px;

    padding: 9px 12px;

    border: 0;
    border-radius: 10px;

    background: linear-gradient(
        135deg,
        var(--chat-red),
        var(--chat-red-dark)
    );

    color: #fff;

    font-size: 11px;
    font-weight: 600;

    cursor: pointer;

    transition:
        transform .2s ease,
        box-shadow .2s ease,
        opacity .2s ease;
}


.leadSubmitBtn:hover:not(:disabled) {
    transform:
        translateY(-1px);

    box-shadow:
        0 5px 14px
        rgba(177, 37, 43, .22);
}


.leadSubmitBtn:disabled {
    opacity: .45;

    cursor: not-allowed;
}


.leadSubmitArrow {
    font-size: 15px;
}


/* Lead Privacy */

.leadPrivacy {
    margin-top: 8px;

    color: #989da6;

    font-size: 8.5px;

    text-align: center;
}


/* Loading */

.leadLoadingSpinner {
    width: 13px;
    height: 13px;

    border:
        2px solid
        rgba(255, 255, 255, .40);

    border-top-color: #fff;

    border-radius: 50%;

    animation:
        leadLoadingSpin
        .7s
        linear
        infinite;
}


@keyframes leadLoadingSpin {
    to {
        transform: rotate(360deg);
    }
}


/* ==========================================================
   LEAD SUCCESS
========================================================== */

.leadSuccessCard {
    width: 96%;

    display: flex;
    align-items: flex-start;

    gap: 10px;

    padding: 13px;

    border:
        1px solid
        #d6ebde;

    border-radius:
        15px
        15px
        15px
        5px;

    background:
        #f2faf5;

    animation:
        chatMessageIn
        .25s ease;
}


.leadSuccessIcon {
    width: 30px;
    height: 30px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background:
        var(--chat-success);

    color: #fff;

    font-size: 13px;
    font-weight: 700;
}


.leadSuccessTitle {
    color: #155c34;

    font-size: 11.5px;
    font-weight: 700;
}


.leadSuccessText {
    margin-top: 2px;

    color: #62756a;

    font-size: 10px;
    line-height: 1.45;
}


/* ==========================================================
   INPUT AREA
========================================================== */

#chatInputArea {
    flex-shrink: 0;

    padding: 10px 11px 8px;

    border-top:
        1px solid
        var(--chat-border);

    background: #fff;
}


.chatInputWrapper {
    min-height: 49px;

    display: flex;
    align-items: center;

    gap: 7px;

    padding:
        4px
        5px
        4px
        13px;

    border:
        1px solid
        #e4e7eb;

    border-radius: 14px;

    background: #f7f8fa;

    transition:
        border .2s ease,
        background .2s ease,
        box-shadow .2s ease;
}


.chatInputWrapper:focus-within {
    border-color:
        rgba(177, 37, 43, .45);

    background: #fff;

    box-shadow:
        0 0 0 3px
        rgba(177, 37, 43, .07);
}


/* Chat Input */

#chatInput {
    flex: 1;

    min-width: 0;

    padding: 9px 0;

    border: 0;
    outline: 0;

    background: transparent;

    color: var(--chat-text);

    font-size: 12px;

    box-shadow: none;
}


#chatInput::placeholder {
    color: #9da2ab;
}


#chatInput:disabled {
    cursor: not-allowed;

    color: #9ca1aa;
}


/* ==========================================================
   SEND BUTTON
========================================================== */

#sendBtn {
    width: 39px;
    height: 39px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;
    border-radius: 11px;

    background: linear-gradient(
        135deg,
        var(--chat-red),
        var(--chat-red-dark)
    );

    color: #fff;

    cursor: pointer;

    transition:
        transform .2s ease,
        box-shadow .2s ease,
        opacity .2s ease;
}


#sendBtn:hover:not(:disabled) {
    transform:
        scale(1.05);

    box-shadow:
        0 5px 12px
        rgba(177, 37, 43, .23);
}


#sendBtn:active:not(:disabled) {
    transform:
        scale(.96);
}


#sendBtn:disabled {
    opacity: .42;

    cursor: not-allowed;
}


#sendBtn svg {
    width: 17px;
    height: 17px;
}


/* ==========================================================
   FOOTER
========================================================== */

.chatFooterNote {
    margin-top: 6px;

    color: #a0a5ad;

    font-size: 8.5px;

    text-align: center;
}


/* ==========================================================
   TABLET
========================================================== */

@media (max-width: 768px) and (min-width: 481px) {

    #chatBox {
        right: 18px;
        bottom: 82px;

        width: 370px;
    }

    #chatButton {
        right: 18px;
        bottom: 18px;
    }
}


/* ==========================================================
   MOBILE
========================================================== */

@media (max-width: 480px) {

    #chatBox {
        left: 10px;
        right: 10px;
        bottom: 72px;

        width: auto;

        height: 58vh;
        max-height: 50px;

        border-radius: 18px;
    }

    #chatHeader {
        min-height: 70px;

        padding: 11px 13px;
    }


    .chatAvatar {
        width: 40px;
        height: 40px;

        font-size: 13px;
    }


    .chatTitle {
        font-size: 14px;
    }


    .chatStatus {
        font-size: 9.5px;
    }


    #chatClose {
        width: 32px;
        height: 32px;
    }


    #chatMessages {
        padding: 14px 11px;

        font-size: 12px;
    }


    .message {
        max-width: 88%;

        padding: 9px 11px;

        font-size: 11.5px;
    }


    .chatWelcome {
        padding-bottom: 13px;
    }


    .chatWelcomeIcon {
        width: 42px;
        height: 42px;

        font-size: 19px;
    }


    .chatWelcome h4 {
        font-size: 13px;
    }


    .chatWelcome p {
        font-size: 10.5px;
    }


    .quickAction {
        padding: 7px 9px;

        font-size: 9.5px;
    }


    .leadFormCard,
    .leadSuccessCard {
        width: 100%;
    }


    .leadFormCard {
        padding: 13px;
    }


    #chatInputArea {
        padding: 8px;
    }


    .chatInputWrapper {
        min-height: 46px;

        border-radius: 12px;
    }


    #chatInput {
        font-size: 11.5px;
    }


    #sendBtn {
        width: 37px;
        height: 37px;
    }


    #chatButton {
        right: 13px;
        bottom: 13px;

        padding:
            6px
            13px
            6px
            6px;

        font-size: 12px;
    }


    .chatButtonIcon {
        width: 33px;
        height: 33px;
    }
}


/* ==========================================================
   VERY SMALL MOBILE
========================================================== */

@media (max-width: 360px) {

   #chatBox {
        left: 6px;
        right: 6px;
        bottom: 65px;

        height: 55vh;
        max-height: 440px;

        border-radius: 16px;
    }


    #chatButton {
        padding: 6px;

        border-radius: 50%;
    }


    .chatButtonText {
        display: none;
    }


    #chatMessages {
        padding:
            12px
            9px;
    }


    .message {
        max-width: 91%;
    }


    .leadFormCard {
        padding: 11px;
    }
}


/* ==========================================================
   SHORT SCREEN / LANDSCAPE
========================================================== */

@media (max-height: 650px) and (min-width: 481px) {

    #chatBox {
        bottom: 75px;

        height:
            calc(100vh - 95px);
    }


    #chatHeader {
        min-height: 68px;

        padding: 10px 14px;
    }


    .chatAvatar {
        width: 39px;
        height: 39px;
    }
}


/* ==========================================================
   ACCESSIBILITY
========================================================== */

@media (prefers-reduced-motion: reduce) {

    #chatBox,
    #chatButton,
    #sendBtn,
    .quickAction,
    .message,
    .leadSubmitBtn {
        transition: none !important;
        animation: none !important;
    }


    .typing span,
    .leadLoadingSpinner,
    .chatNotification {
        animation: none !important;
    }


    #chatMessages {
        scroll-behavior: auto;
    }
}
