/* Chat Widget Styles - Coastal Luxury Theme */
:root {
    --chat-primary: #0170B9;
    --chat-secondary: #005a96;
    --chat-accent: #EFB509;
    --chat-bg: #ffffff;
    --chat-text: #333333;
    --chat-light-bg: #f5f5f5;
    --chat-border: #e0e0e0;
}

/* Global Box Sizing for Widget */
.chat-widget-container *,
.chat-widget-container *::before,
.chat-widget-container *::after {
    box-sizing: border-box;
}

/* Floating Chat Button */
.chat-widget-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--chat-primary);
    color: white;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.chat-widget-button:hover {
    transform: scale(1.1);
    background-color: var(--chat-secondary);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.chat-widget-button.active {
    transform: rotate(90deg);
    background-color: #666;
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    max-width: calc(100vw - 40px);
    /* Prevent overflow on small screens */
    height: 500px;
    max-height: calc(100vh - 120px);
    background-color: var(--chat-bg);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-family: 'Poppins', sans-serif;
}

.chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ... existing styles ... */

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100% !important;
        height: 100% !important;
        height: 100dvh !important;
        /* Dynamic Viewport Height for mobile browsers */
        max-width: 100vw !important;
        max-height: 100dvh !important;
        border-radius: 0;
        margin: 0;
        transform: none;
    }

    .chat-window.open {
        transform: none;
    }

    .chat-widget-button {
        bottom: 20px;
        right: 20px;
    }

    /* Fix input area on mobile */
    .chat-input-area {
        padding: 10px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        /* iOS Safe Area */
    }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-avatar {
    width: 35px;
    height: 35px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--chat-primary);
    font-size: 18px;
}

.chat-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-title span {
    font-size: 12px;
    opacity: 0.8;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chat-close:hover {
    opacity: 1;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: #f9f9f9;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.message.bot {
    align-self: flex-start;
    background-color: white;
    color: var(--chat-text);
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message.user {
    align-self: flex-end;
    background-color: var(--chat-primary);
    color: white;
    border-bottom-right-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message-time {
    font-size: 10px;
    margin-top: 5px;
    display: block;
    opacity: 0.7;
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-self: flex-start;
    background-color: white;
    padding: 10px 15px;
    border-radius: 15px;
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

.typing-indicator.active {
    display: block;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: #bbb;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Chat Input Area */
.chat-input-area {
    padding: 15px;
    background-color: white;
    border-top: 1px solid var(--chat-border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    min-width: 0;
    /* Fix for flex container overflow */
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    padding: 10px 15px;
    font-family: inherit;
    font-size: 14px;
    max-height: 100px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: var(--chat-primary);
}

.chat-send {
    flex-shrink: 0;
    /* Prevent button from shrinking */
    width: 40px;
    height: 40px;
    background-color: var(--chat-primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.chat-send:hover {
    background-color: var(--chat-secondary);
}

.chat-send:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}