/* Itinerary Chatbox Styles */

/* Chatbox Container - Force to be positioned relative to viewport */
.itinerary-chatbox {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 56px;
    height: 56px;
    max-width: 56px;
    background: white !important;
    border-radius: 50%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
    z-index: 999999 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    overflow: hidden;
    top: auto !important;
    left: auto !important;
}

/* Force chatbox on all page types */
body .itinerary-chatbox,
html .itinerary-chatbox,
.single .itinerary-chatbox,
.single-post .itinerary-chatbox,
.single-post .itinerary-chatbox,
main .itinerary-chatbox,
article .itinerary-chatbox {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    top: auto !important;
    left: auto !important;
}

.itinerary-chatbox.expanded {
    width: 90%;
    max-width: 400px;
    height: auto;
    border-radius: 16px;
    overflow: visible;
}

.itinerary-chatbox.minimized {
    width: 56px;
    height: 56px;
    max-width: 56px;
    overflow: hidden;
    border-radius: 50%;
}

/* Chatbox Header */
.chatbox-header {
    background: linear-gradient(135deg, #8b7355 0%, #a68b73 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 16px 16px 0 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: relative;
    height: 56px;
}

.itinerary-chatbox.minimized .chatbox-header {
    border-radius: 50%;
    padding: 0;
}

.chatbox-icon {
    font-size: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.itinerary-chatbox.minimized .chatbox-close {
    display: none;
}

.chatbox-title {
    display: none; /* Hide title in minimized view */
}

.itinerary-chatbox:not(.minimized) .chatbox-title {
    display: block; /* Show title when expanded */
}

.itinerary-chatbox:not(.minimized) .chatbox-header {
    justify-content: flex-start; /* Align left when expanded */
}

.chatbox-close {
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.9;
    transition: opacity 0.2s ease;
    line-height: 1;
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
}

.chatbox-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.3);
}

/* Chatbox Body */
.chatbox-body {
    padding: 1.5rem;
    max-height: 500px;
    display: flex;
    flex-direction: column;
}

/* Chat Messages */
.chat-messages {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #8b7355;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a68b73;
}

/* Chat Message */
.chat-message {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    max-width: 85%;
    word-wrap: break-word;
}

.bot-message {
    background: #f0f0f0;
    color: #333;
    align-self: flex-start;
}

.user-message {
    background: linear-gradient(135deg, #8b7355 0%, #a68b73 100%);
    color: white;
    align-self: flex-end;
}

.message-content p {
    margin: 0.25rem 0;
}

.message-content p:first-child {
    margin-top: 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Input Wrapper */
.chat-input-wrapper {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.chat-input-wrapper input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9375rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.chat-input-wrapper input:focus {
    border-color: #8b7355;
}

.chat-input-wrapper button {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #8b7355 0%, #a68b73 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9375rem;
}

.chat-input-wrapper button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 115, 85, 0.3);
}

body[data-theme="dark"] .chat-input-wrapper button,
body[data-theme="dark"] .email-form button {
    background: linear-gradient(135deg, #682b07, #4d4946) !important;
}

body[data-theme="dark"] .chat-input-wrapper button:hover,
body[data-theme="dark"] .email-form button:hover {
    background: linear-gradient(135deg, #8a3d0d, #6b6662) !important;
    box-shadow: 0 6px 16px rgba(104, 43, 7, 0.4) !important;
}

.chat-input-wrapper button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Loading Spinner */
.chat-loading {
    text-align: center;
    padding: 1rem;
}

.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #8b7355;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Email Input Form */
.email-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0;
}

.email-form input {
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9375rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.email-form input:focus {
    border-color: #8b7355;
}

.email-form button {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #8b7355 0%, #a68b73 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9375rem;
}

.email-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 115, 85, 0.3);
}

/* Success Message */
.success-message {
    background: #d1e7dd;
    color: #0f5132;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
}

/* Dark Theme Support */
body[data-theme="dark"] .itinerary-chatbox {
    background: #1e293b;
    color: #e2e8f0;
}

body[data-theme="dark"] .chatbox-header {
    background: linear-gradient(135deg, #682b07 0%, #4d4946 100%) !important;
}

body[data-theme="dark"] .bot-message {
    background: #0f172a;
    color: #cbd5e1;
}

body[data-theme="dark"] .chat-input-wrapper input,
body[data-theme="dark"] .email-form input {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

body[data-theme="dark"] .chat-input-wrapper input:focus,
body[data-theme="dark"] .email-form input:focus {
    border-color: #a68b73;
}

/* Responsive */
@media (max-width: 768px) {
    .itinerary-chatbox {
        right: 10px;
        width: 280px;
        max-width: calc(100vw - 20px);
        max-height: 400px;
    }
    
    .chatbox-body {
        padding: 1rem;
        max-height: 320px;
    }
    
    .chat-messages {
        max-height: 200px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message {
    animation: fadeIn 0.3s ease;
}

