/* Wood Tide Travel Chat Widget - EmailJS Fallback Mode */
/* Navy (#0a1628) and Champagne (#c9a961) color scheme */

/* Chat Button - Floating in bottom-right */
.woodtide-chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0a1628 0%, #1a2838 100%);
    border: 2px solid #c9a961;
    box-shadow: 0 4px 12px rgba(10, 22, 40, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: all 0.3s ease;
}

.woodtide-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(201, 169, 97, 0.3);
}

.woodtide-chat-button svg {
    width: 28px;
    height: 28px;
    fill: #c9a961;
}

/* Unread indicator */
.woodtide-chat-button .unread-indicator {
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #c9a961;
    border-radius: 50%;
    border: 2px solid #0a1628;
}

/* Chat Window */
.woodtide-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(10, 22, 40, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.woodtide-chat-window.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* Chat Header */
.woodtide-chat-header {
    background: linear-gradient(135deg, #0a1628 0%, #1a2838 100%);
    color: #c9a961;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #c9a961;
}

.woodtide-chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.woodtide-chat-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #c9a961;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.woodtide-chat-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #c9a961;
}

.woodtide-chat-header-text p {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: rgba(201, 169, 97, 0.7);
}

.woodtide-chat-close {
    background: transparent;
    border: none;
    color: #c9a961;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.woodtide-chat-close:hover {
    background: rgba(201, 169, 97, 0.1);
}

/* Chat Messages Container */
.woodtide-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Individual Message */
.woodtide-chat-message {
    display: flex;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.woodtide-chat-message.bot {
    align-items: flex-start;
}

.woodtide-chat-message.user {
    flex-direction: row-reverse;
}

.woodtide-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.woodtide-message-avatar.bot {
    background: linear-gradient(135deg, #0a1628 0%, #1a2838 100%);
    color: #c9a961;
}

.woodtide-message-avatar.user {
    background: #c9a961;
    color: #0a1628;
}

.woodtide-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.woodtide-message-content.bot {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.woodtide-message-content.user {
    background: #0a1628;
    color: white;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.woodtide-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px;
}

.woodtide-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c9a961;
    animation: typing 1.4s infinite;
}

.woodtide-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.woodtide-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-8px);
    }
}

/* Chat Input Area */
.woodtide-chat-input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    max-height: 400px;
    overflow-y: auto;
}

.woodtide-chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.woodtide-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.woodtide-chat-input:focus {
    border-color: #c9a961;
}

.woodtide-chat-input::placeholder {
    color: #999;
}

.woodtide-chat-send-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0a1628 0%, #1a2838 100%);
    border: 2px solid #c9a961;
    color: #c9a961;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 18px;
}

.woodtide-chat-send-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(201, 169, 97, 0.3);
}

.woodtide-chat-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Quick Reply Buttons */
.woodtide-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.woodtide-quick-reply-button {
    padding: 8px 16px;
    background: white;
    border: 2px solid #c9a961;
    color: #0a1628;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.woodtide-quick-reply-button:hover {
    background: #c9a961;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(201, 169, 97, 0.2);
}

/* Form Elements (for EmailJS mode) */
.woodtide-form-field {
    margin-bottom: 12px;
}

.woodtide-form-field label {
    display: block;
    font-size: 13px;
    color: #555;
    margin-bottom: 6px;
    font-weight: 500;
}

.woodtide-form-field input,
.woodtide-form-field select,
.woodtide-form-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.woodtide-form-field input:focus,
.woodtide-form-field select:focus,
.woodtide-form-field textarea:focus {
    border-color: #c9a961;
}

.woodtide-form-field textarea {
    resize: vertical;
    min-height: 80px;
}

.woodtide-submit-button {
    width: 100%;
    padding: 10px 18px;
    background: linear-gradient(135deg, #0a1628 0%, #1a2838 100%);
    border: 2px solid #c9a961;
    color: #c9a961;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 8px;
}

.woodtide-submit-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(201, 169, 97, 0.3);
}

.woodtide-submit-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Success/Error Messages */
.woodtide-status-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 12px;
    animation: slideIn 0.3s ease;
}

.woodtide-status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.woodtide-status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Desktop - Keep button visible even when chat is open */
@media (min-width: 481px) {
    .woodtide-chat-button.chat-open {
        opacity: 1;
        pointer-events: all;
        transform: scale(1);
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .woodtide-chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100vw;
        width: 100dvw;
        height: 100vh; /* Fallback for older browsers */
        height: 100dvh; /* Dynamic viewport height - adjusts for keyboard */
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        transform-origin: bottom right;
    }

    /* When chat is open on mobile, ensure proper layout */
    .woodtide-chat-window.open {
        display: flex;
        flex-direction: column;
        overflow: hidden; /* Prevent scroll on the window itself */
    }

    /* Header fixed at top */
    .woodtide-chat-header {
        flex-shrink: 0;
        position: relative;
        z-index: 2;
    }

    /* Messages area should be scrollable and flexible */
    .woodtide-chat-messages {
        flex: 1 1 auto;
        min-height: 0; /* Important for flexbox scrolling */
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        position: relative;
    }

    /* Input area stays at bottom */
    .woodtide-chat-input-area {
        flex: 0 0 auto;
        flex-shrink: 0;
        position: relative;
        background: white;
        z-index: 2;
        padding-bottom: max(16px, env(safe-area-inset-bottom, 16px)); /* iOS safe area */
    }

    .woodtide-chat-button {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    /* Hide chat button on mobile when chat is open */
    .woodtide-chat-button.chat-open {
        opacity: 0;
        pointer-events: none;
        transform: scale(0.8);
    }

    .woodtide-message-content {
        max-width: 85%;
    }

    /* Ensure header doesn't get hidden */
    .woodtide-chat-header {
        flex-shrink: 0;
    }
}

/* Date Picker Styling */
.woodtide-date-picker {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    cursor: pointer;
}

.woodtide-date-picker:focus {
    border-color: #c9a961;
}

.woodtide-date-use-btn {
    padding: 10px 16px;
    background: #c9a961;
    color: #0a1628;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.woodtide-date-use-btn:hover {
    background: #b08951;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(201, 169, 97, 0.3);
}

/* Scrollbar Styling */
.woodtide-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.woodtide-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.woodtide-chat-messages::-webkit-scrollbar-thumb {
    background: #c9a961;
    border-radius: 3px;
}

.woodtide-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #b08951;
}

/* AI Mode Message Styles (used by chat-widget-ai.js) */
.woodtide-chat-bot-message {
    display: block !important; /* Override flex from parent class */
    background: white;
    color: #0a1628;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-bottom-left-radius: 4px;
}

.woodtide-chat-user-message {
    display: block !important; /* Override flex from parent class */
    background: #0a1628;
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    margin-left: auto;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.5;
    border-bottom-right-radius: 4px;
}

.woodtide-chat-typing {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 12px 16px;
}

.woodtide-chat-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c9a961;
    animation: typing 1.4s infinite;
}

/* Privacy Policy Modal */
.woodtide-privacy-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 22, 40, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.woodtide-privacy-modal-overlay.active {
    display: flex;
}

.woodtide-privacy-modal {
    background: white;
    max-width: 1400px;
    height: 90vh;
    width: 98%;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(10, 22, 40, 0.4);
    display: flex;
    flex-direction: column;
}

.woodtide-privacy-modal-header {
    background: linear-gradient(135deg, #0a1628 0%, #1a2838 100%);
    color: #c9a961;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #c9a961;
    flex-shrink: 0;
}

.woodtide-privacy-modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.woodtide-privacy-modal-close {
    background: transparent;
    border: 1px solid rgba(201, 169, 97, 0.3);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: #c9a961;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    line-height: 1;
    transition: all 0.3s;
}

.woodtide-privacy-modal-close:hover {
    background: rgba(201, 169, 97, 0.1);
    border-color: #c9a961;
}

.woodtide-privacy-modal-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.woodtide-privacy-modal-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Mobile Responsive for Privacy Modal */
@media (max-width: 768px) {
    .woodtide-privacy-modal-overlay {
        padding: 1rem;
    }

    .woodtide-privacy-modal {
        max-height: 95vh;
    }
}
