/* ==========================================================================
   Contact Page AI Assistant Styles
   Design Matched with Tour AI (Color palette, typography, bubbles, buttons,
   typing indicator, input bar, cards, responsive)
   ========================================================================== */

/* Card / Flex Container */
.contact-ai-container {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 12px 35px rgba(29, 110, 124, 0.1), 0 3px 10px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--tai-border, #e3ebef);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 640px;
    height: 640px;
    position: relative;
    box-sizing: border-box;
}

/* Header - Matched with Tour AI Gradient and Elements */
.contact-ai-header {
    background: linear-gradient(135deg, #17545e 0%, #1d6e7c 40%, #55a7b5 100%);
    color: #ffffff;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.contact-ai-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.contact-ai-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
    position: relative;
    flex-shrink: 0;
}

.contact-ai-title h5 {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.2px;
    line-height: 1.25;
}

.contact-ai-status {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.contact-ai-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00e676;
    display: inline-block;
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.8);
    border: 1.5px solid #ffffff;
}

.contact-ai-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.contact-ai-btn-reset {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 30px;
    padding: 5px 14px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}

.contact-ai-btn-reset:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Chat Messages View */
.contact-ai-chat-view {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.contact-ai-chat-view.active {
    display: flex;
}

.contact-ai-messages {
    flex: 1 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    background: var(--tai-bg, #f4f7f9);
    padding: 20px 20px 24px 20px;
    scroll-behavior: smooth;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    box-sizing: border-box;
}

.contact-ai-messages::-webkit-scrollbar {
    width: 6px;
}
.contact-ai-messages::-webkit-scrollbar-track {
    background: transparent;
}
.contact-ai-messages::-webkit-scrollbar-thumb {
    background: #cbd8dc;
    border-radius: 10px;
}
.contact-ai-messages::-webkit-scrollbar-thumb:hover {
    background: #aabdc3;
}

/* Message Rows & Bubbles - Matching Tour AI Styling */
.contact-ai-msg-row {
    display: flex;
    gap: 10px;
    max-width: 85%;
    width: auto;
    box-sizing: border-box;
    animation: fadeInMsg 0.25s ease-out forwards;
}

@keyframes fadeInMsg {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.contact-ai-msg-row.visitor {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.contact-ai-msg-row.assistant {
    align-self: flex-start;
}

.contact-ai-msg-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--tai-accent, #55a7b5);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 2px;
    box-shadow: 0 2px 6px rgba(85, 167, 181, 0.35);
}

.contact-ai-bubble {
    padding: 12px 18px;
    font-size: 0.92rem;
    line-height: 1.58;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    box-sizing: border-box;
    max-width: 100%;
}

.contact-ai-msg-row.visitor .contact-ai-bubble {
    background: linear-gradient(135deg, #1d6e7c 0%, #2f8e9d 100%);
    color: #ffffff;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 3px 10px rgba(29, 110, 124, 0.18);
}

.contact-ai-msg-row.assistant .contact-ai-bubble {
    background: #ffffff;
    color: var(--tai-text, #2c3e50);
    border: 1px solid #e8eef1;
    border-radius: 16px 16px 16px 4px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.03);
}

.contact-ai-bubble p {
    margin: 0 0 8px 0;
}
.contact-ai-bubble p:last-child {
    margin-bottom: 0;
}
.contact-ai-bubble ul, .contact-ai-bubble ol {
    margin: 6px 0 8px 18px;
    padding: 0;
}
.contact-ai-bubble li {
    margin-bottom: 4px;
}
.contact-ai-bubble strong {
    color: inherit;
    font-weight: 700;
}
.contact-ai-msg-row.assistant .contact-ai-bubble strong {
    color: #11343b;
}

/* Typing Indicator - Modern AI Thinking Pill */
.contact-ai-typing {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 8px 10px;
    background: #ffffff;
    border: 1px solid #e3ebef;
    border-radius: 20px;
    align-self: flex-start;
    box-shadow: 0 4px 14px rgba(29, 110, 124, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
    margin: 4px 20px 14px 20px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.contact-ai-typing.active {
    display: inline-flex;
    animation: contactAiFadeInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes contactAiFadeInUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* AI Thinking Avatar / Compass Icon */
.contact-ai-typing .tour-ai-avatar-msg {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tai-primary, #1d6e7c) 0%, var(--tai-accent, #55a7b5) 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    margin: 0;
    box-shadow: 0 2px 8px rgba(85, 167, 181, 0.4);
    position: relative;
    animation: contactAiAvatarPulse 2.4s ease-in-out infinite;
}

.contact-ai-typing .tour-ai-avatar-msg i {
    display: inline-block;
    line-height: 1;
    transform-origin: center center;
    animation: contactAiCompassRotate 6s ease-in-out infinite;
}

/* Subtle breathing glow and gentle compass drift */
@keyframes contactAiAvatarPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(85, 167, 181, 0.45), 0 2px 6px rgba(29, 110, 124, 0.25);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(85, 167, 181, 0), 0 3px 10px rgba(85, 167, 181, 0.45);
        transform: scale(1.04);
    }
}

@keyframes contactAiCompassRotate {
    0% {
        transform: rotate(0deg);
    }
    20% {
        transform: rotate(25deg);
    }
    50% {
        transform: rotate(-20deg);
    }
    75% {
        transform: rotate(10deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

.contact-ai-typing-text {
    font-size: 0.82rem;
    color: var(--tai-text, #2c3e50);
    font-weight: 600;
    letter-spacing: -0.01em;
    user-select: none;
    margin: 0 2px 0 2px;
}

.contact-ai-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3.5px;
    margin-left: 1px;
}

.contact-ai-typing-dot {
    width: 4.5px;
    height: 4.5px;
    border-radius: 50%;
    background-color: var(--tai-accent, #55a7b5);
    display: inline-block;
    animation: contactAiBounce 1.4s infinite ease-in-out both;
}
.contact-ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.contact-ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.contact-ai-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes contactAiBounce {
    0%, 80%, 100% { transform: scale(0.4); opacity: 0.35; }
    40% { transform: scale(1.15); opacity: 1; }
}

/* Footer / Input Area - Matched with Tour AI */
.contact-ai-footer {
    background: #ffffff;
    padding: 10px 18px 12px 18px;
    border-top: 1px solid var(--tai-border, #e3ebef);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.contact-ai-escalate-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    border-radius: 10px;
    padding: 2px 12px;
    font-size: 12.5px;
    color: var(--tai-muted, #6c7a89);
}

.contact-ai-escalate-btn {
    background: var(--tai-primary, #1d6e7c);
    color: #ffffff;
    border: none;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(29, 110, 124, 0.2);
}

.contact-ai-escalate-btn:hover {
    background: var(--tai-primary-hover, #155560);
    color: #ffffff;
    transform: translateY(-1px);
}

.contact-ai-input-form {
    display: flex;
    align-items: center;
    background: #f8fafb;
    border: 1.5px solid #dbe5e8;
    border-radius: 24px;
    padding: 4px 6px 4px 16px;
    transition: all 0.25s ease;
    gap: 6px;
}

.contact-ai-input-form:focus-within {
    background: #ffffff;
    border-color: var(--tai-accent, #55a7b5);
    box-shadow: 0 0 0 3px rgba(85, 167, 181, 0.15);
}

.contact-ai-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.92rem;
    color: var(--tai-text, #2c3e50);
    padding: 8px 8px 8px 0;
    line-height: 1.45;
    font-family: inherit;
    box-sizing: border-box;
    width: 100%;
}

.contact-ai-input::placeholder {
    color: #8c9ba5;
}

.contact-ai-send-btn {
    background: linear-gradient(135deg, var(--tai-primary, #1d6e7c) 0%, var(--tai-accent, #55a7b5) 100%);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(29, 110, 124, 0.25);
}

.contact-ai-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(29, 110, 124, 0.35);
}

.contact-ai-send-btn:disabled, .contact-ai-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

/* Human Contact Form View */
.contact-ai-form-view {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: #ffffff;
    overflow-y: auto;
    padding: 24px;
}

.contact-ai-form-view.active {
    display: flex;
}

.contact-ai-form-header {
    border-bottom: 1px solid var(--tai-border, #e3ebef);
    padding-bottom: 14px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.contact-ai-form-header h5 {
    margin: 0;
    color: var(--tai-primary, #1d6e7c);
    font-weight: 700;
    font-size: 1.1rem;
}

.contact-ai-back-to-chat {
    background: none;
    border: 1px solid #dbe5e8;
    color: var(--tai-primary, #1d6e7c);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.contact-ai-back-to-chat:hover {
    background: var(--tai-accent-light, #e8f5f7);
    border-color: var(--tai-accent, #55a7b5);
}

.contact-ai-form-group {
    margin-bottom: 16px;
}

.contact-ai-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--tai-text, #2c3e50);
    margin-bottom: 6px;
}

.contact-ai-form-group .form-control {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 10px 14px;
    font-size: 14px;
    box-sizing: border-box;
}

.contact-ai-form-group .form-control:focus {
    border-color: var(--tai-accent, #55a7b5);
    outline: none;
    box-shadow: 0 0 0 3px rgba(85, 167, 181, 0.15);
}

.contact-ai-form-hint {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

.contact-ai-submit-btn {
    background: linear-gradient(135deg, var(--tai-primary, #1d6e7c) 0%, var(--tai-accent, #55a7b5) 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(29, 110, 124, 0.25);
}

.contact-ai-submit-btn:hover {
    background: linear-gradient(135deg, #155560 0%, #4797a5 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(29, 110, 124, 0.35);
}

.contact-ai-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Success View */
.contact-ai-success-view {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
    flex: 1;
}

.contact-ai-success-view.active {
    display: flex;
}

.contact-ai-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #def7ec;
    color: #0e9f6e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 16px;
}

.contact-ai-success-view h5 {
    color: var(--tai-primary, #1d6e7c);
    font-weight: 700;
    margin-bottom: 8px;
}

.contact-ai-success-view p {
    color: #64748b;
    font-size: 14px;
    max-width: 380px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.contact-ai-btn-restart {
    background: var(--tai-primary, #1d6e7c);
    color: #ffffff;
    border: none;
    border-radius: 20px;
    padding: 10px 24px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.contact-ai-btn-restart:hover {
    background: var(--tai-primary-hover, #155560);
    color: #ffffff;
}

/* Error Alert Box */
.contact-ai-error-box {
    display: none;
    background: #fde8e8;
    color: #9b1c1c;
    border: 1px solid #f8b4b4;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 14px;
}

.contact-ai-error-box.active {
    display: block;
}

/* Human Contact Details Box in Chat */
.contact-ai-bubble .contact-ai-human-details-box {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-left: 4px solid var(--tai-accent, #55a7b5);
    border-radius: 8px;
    padding: 10px 14px;
    margin: 10px 0 6px 0;
}

.contact-ai-bubble .contact-ai-human-details-box p {
    margin: 0 0 6px 0;
}

.contact-ai-bubble .contact-ai-human-details-box ul {
    margin: 0 0 4px 0;
    padding-left: 0;
    list-style: none;
}

.contact-ai-bubble .contact-ai-human-details-box li {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.contact-ai-bubble .contact-ai-human-details-box a {
    color: var(--tai-primary, #1d6e7c);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.contact-ai-bubble .contact-ai-human-details-box a:hover {
    color: var(--tai-accent, #55a7b5);
}

/* ==========================================================================
   Responsive Adjustments (Desktop, Tablet, Mobile)
   ========================================================================== */
@media (max-width: 991px) {
    .contact-ai-container {
        /* height: 600px;
        min-height: 540px; */
        margin-top: 10px;
    }
}

@media (max-width: 768px) {
    .contact-ai-container {
        /* height: 560px;
        min-height: 500px; */
        border-radius: 14px;
    }
    .contact-ai-header {
        padding: 10px 14px;
    }
    .contact-ai-avatar {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    .contact-ai-title h5 {
        font-size: 0.98rem;
    }
    .contact-ai-status {
        font-size: 0.74rem;
    }
    .contact-ai-btn-reset {
        padding: 4px 10px;
        font-size: 0.72rem;
    }
    .contact-ai-messages {
        padding: 14px 14px 18px 14px;
        gap: 12px;
        overflow-x: hidden !important;
    }
    .contact-ai-msg-row {
        max-width: 94%;
        width: auto;
    }
    .contact-ai-msg-avatar {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }
    .contact-ai-bubble {
        padding: 10px 14px;
        font-size: 0.88rem;
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
        word-break: break-word;
    }
    .contact-ai-typing {
        margin: 4px 14px 12px 14px;
        padding: 6px 12px 6px 8px;
        gap: 6px;
    }
    .contact-ai-typing .tour-ai-avatar-msg {
        width: 24px;
        height: 24px;
        min-width: 24px;
        font-size: 11px;
    }
    .contact-ai-typing-text {
        font-size: 0.78rem;
    }
    .contact-ai-footer {
        padding: 8px 12px 10px 12px;
        gap: 8px;
    }
    .contact-ai-escalate-bar {
        flex-direction: row;
        gap: 6px;
        align-items: stretch;
        text-align: center;
        padding: 6px 10px;
        font-size: 11.5px;
    }
    .contact-ai-escalate-btn {
        justify-content: center;
        padding: 6px 10px;
        font-size: 11.5px;
    }
    .contact-ai-input-form {
        padding: 3px 5px 3px 12px;
    }
    .contact-ai-input {
        font-size: 0.88rem;
        padding: 6px 4px 6px 0;
    }
    .contact-ai-send-btn {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }
    .contact-ai-form-view {
        padding: 16px 14px;
    }
}

@media (max-width: 480px) {
    .contact-ai-container {
        /* height: 520px;
        min-height: 460px; */
    }
    .contact-ai-msg-row {
        max-width: 96%;
    }
}

/* ==========================================================================
   Restored Existing Website Contact Form Card Styles
   ========================================================================== */
#existingContactFormCard {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 12px 35px rgba(29, 110, 124, 0.1), 0 3px 10px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--tai-border, #e3ebef);
    overflow: hidden;
    padding-bottom: 25px;
    box-sizing: border-box;
}

#existingContactFormCard .main_contact_head {
    background: linear-gradient(135deg, #17545e 0%, #1d6e7c 40%, #55a7b5 100%);
    color: #ffffff;
    padding: 14px 20px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

#existingContactFormCard .contact_booking_form_btn {
    color: #ffffff !important;
    font-size: 1.08rem;
    font-weight: 700;
}

#contactAiBackToChatFromNormal {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 30px;
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

#contactAiBackToChatFromNormal:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #ffffff;
}

#existingContactFormCard .contect_form_padding:last-child {
    padding: 20px 24px;
}

#existingContactFormCard .input_select_style {
    border-radius: 8px;
    border: 1px solid #d0d7de;
    padding: 10px 14px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}

#existingContactFormCard .input_select_style:focus {
    outline: none;
    border-color: #1d6e7c;
    box-shadow: 0 0 0 3px rgba(29, 110, 124, 0.15);
}

#existingContactFormCard .contact_form_button {
    background: linear-gradient(135deg, #1d6e7c 0%, #17545e 100%);
    color: #ffffff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
    padding: 12px 36px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

#existingContactFormCard .contact_form_button:hover {
    background: linear-gradient(135deg, #17545e 0%, #113f47 100%);
    box-shadow: 0 4px 12px rgba(23, 84, 94, 0.3);
}

#contactAiSwitchToStandardForm {
    color: #556987;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s;
}

#contactAiSwitchToStandardForm:hover {
    color: #1d6e7c;
    text-decoration: underline !important;
}
