/* AI Booking Agent Chat Widget Styles */

/* Reset & Base */
#aiba-chat-widget * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Widget Container */
#aiba-chat-widget {
    position: fixed;
    z-index: 999999;
}

#aiba-chat-widget.aiba-bottom-left {
    bottom: 20px;
    left: 20px;
}

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

/* Toggle Button */
.aiba-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
    color: #fff;
}

.aiba-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.aiba-toggle-btn svg {
    width: 28px;
    height: 28px;
}

.aiba-toggle-btn .hidden {
    display: none;
}

/* Chat Window */
.aiba-chat-window {
    position: absolute;
    bottom: 80px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 620px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.2s, transform 0.2s, width 0.2s, height 0.2s;
}

.aiba-bottom-left .aiba-chat-window {
    left: 0;
}

.aiba-bottom-right .aiba-chat-window {
    right: 0;
}

.aiba-chat-window.hidden {
    display: none;
}

/* Chat Header */
.aiba-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    color: #fff;
}

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

.aiba-header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: background 0.2s;
}

.aiba-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages */
.aiba-chat-messages {
    flex: 1 1 auto;
    min-height: 120px;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
}

/* Message Bubbles */
.aiba-message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.aiba-message.user {
    align-items: flex-end;
}

.aiba-message.assistant {
    align-items: flex-start;
}

.aiba-message-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
}

.aiba-message.user .aiba-message-bubble {
    background: var(--aiba-color, #0073aa);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.aiba-message.assistant .aiba-message-bubble {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Typing Indicator */
.aiba-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.aiba-typing span {
    width: 8px;
    height: 8px;
    background: #aaa;
    border-radius: 50%;
    animation: aiba-typing 1.4s infinite ease-in-out;
}

.aiba-typing span:nth-child(1) { animation-delay: 0s; }
.aiba-typing span:nth-child(2) { animation-delay: 0.2s; }
.aiba-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes aiba-typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Input Area */
.aiba-chat-input-area {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #eee;
    max-height: 65%;
    overflow-y: auto;
    flex-shrink: 0;
}

.aiba-input-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Text Input */
.aiba-text-input-wrap {
    display: flex;
    gap: 8px;
}

.aiba-text-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.aiba-text-input:focus {
    border-color: var(--aiba-color, #0073aa);
}

.aiba-send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--aiba-color, #0073aa);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.aiba-send-btn:hover {
    opacity: 0.9;
}

.aiba-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.aiba-send-btn svg {
    width: 20px;
    height: 20px;
}

/* Option Buttons */
.aiba-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.aiba-option-btn {
    padding: 10px 16px;
    background: #fff;
    border: 1px solid var(--aiba-color, #0073aa);
    border-radius: 20px;
    color: var(--aiba-color, #0073aa);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.aiba-option-btn:hover {
    background: var(--aiba-color, #0073aa);
    color: #fff;
}

.aiba-option-btn.selected {
    background: var(--aiba-color, #0073aa);
    color: #fff;
}

/* Date Picker */
.aiba-date-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aiba-date-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.aiba-date-row label {
    min-width: 80px;
    font-size: 13px;
    color: #666;
}

.aiba-date-row input[type="date"] {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.aiba-confirm-btn {
    padding: 12px 24px;
    background: var(--aiba-color, #0073aa);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 8px;
}

.aiba-confirm-btn:hover {
    opacity: 0.9;
}

/* Guest Counter */
.aiba-guest-counter {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aiba-guest-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.aiba-guest-label {
    font-size: 14px;
    color: #333;
}

.aiba-guest-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aiba-guest-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 50%;
    background: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.aiba-guest-btn:hover {
    border-color: var(--aiba-color, #0073aa);
    color: var(--aiba-color, #0073aa);
}

.aiba-guest-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.aiba-guest-count {
    min-width: 30px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

/* Results List */
.aiba-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
    padding: 4px;
}

.aiba-result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.aiba-result-item:hover {
    border-color: var(--aiba-color, #0073aa);
}

.aiba-result-item.selected {
    border-color: var(--aiba-color, #0073aa);
    background: rgba(0, 115, 170, 0.05);
}

.aiba-result-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.aiba-result-item.selected .aiba-result-checkbox {
    border-color: var(--aiba-color, #0073aa);
    background: var(--aiba-color, #0073aa);
}

.aiba-result-item.selected .aiba-result-checkbox::after {
    content: '✓';
    color: #fff;
    font-size: 12px;
}

.aiba-result-info {
    flex: 1;
}

.aiba-result-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.aiba-result-details {
    font-size: 12px;
    color: #666;
}

.aiba-result-excerpt {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
    line-height: 1.4;
}

/* Contact Form */
.aiba-contact-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aiba-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.aiba-form-group label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.aiba-form-group input,
.aiba-form-group select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.aiba-form-group input:focus,
.aiba-form-group select:focus {
    outline: none;
    border-color: var(--aiba-color, #0073aa);
}

.aiba-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Yes/No Buttons */
.aiba-yes-no {
    display: flex;
    gap: 12px;
}

.aiba-yes-btn,
.aiba-no-btn {
    flex: 1;
    padding: 12px 24px;
    border: 2px solid;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.aiba-yes-btn {
    background: var(--aiba-color, #0073aa);
    border-color: var(--aiba-color, #0073aa);
    color: #fff;
}

.aiba-yes-btn:hover {
    opacity: 0.9;
}

.aiba-no-btn {
    background: #fff;
    border-color: #ddd;
    color: #666;
}

.aiba-no-btn:hover {
    border-color: #999;
    color: #333;
}

/* Links in messages */
.aiba-message-bubble a {
    color: inherit;
    text-decoration: underline;
}

.aiba-message.assistant .aiba-message-bubble a {
    color: var(--aiba-color, #0073aa);
}

/* Result Links */
.aiba-result-link {
    color: var(--aiba-color, #0073aa);
    text-decoration: none;
    transition: opacity 0.2s;
}

.aiba-result-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.aiba-result-name .aiba-result-link {
    color: var(--aiba-color, #0073aa);
    font-weight: 600;
}

/* Results Section Header */
.aiba-results-section {
    padding: 8px 0 4px 0;
    color: #333;
    font-size: 13px;
}

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

.aiba-chat-messages::-webkit-scrollbar-track,
.aiba-results::-webkit-scrollbar-track {
    background: transparent;
}

.aiba-chat-messages::-webkit-scrollbar-thumb,
.aiba-results::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.aiba-chat-messages::-webkit-scrollbar-thumb:hover,
.aiba-results::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Success Message */
.aiba-success-message {
    text-align: center;
    padding: 20px;
}

.aiba-success-message svg {
    width: 48px;
    height: 48px;
    color: #28a745;
    margin-bottom: 12px;
}

.aiba-success-message p {
    margin: 0;
    line-height: 1.6;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .aiba-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
    }
    
    #aiba-chat-widget.aiba-bottom-left,
    #aiba-chat-widget.aiba-bottom-right {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }
    
    .aiba-bottom-left .aiba-chat-window,
    .aiba-bottom-right .aiba-chat-window {
        left: 0;
        right: 0;
    }
    
    .aiba-form-row {
        grid-template-columns: 1fr;
    }
}

/* === Inline checkbox selection (rentals/services/tours shown in chat) === */
.aiba-inline-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 6px 0 2px;
}

.aiba-inline-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.aiba-inline-item:hover {
    border-color: var(--aiba-color, #0073aa);
}

.aiba-inline-item.selected {
    border-color: var(--aiba-color, #0073aa);
    background: rgba(0, 115, 170, 0.06);
}

.aiba-inline-cb {
    width: 18px;
    height: 18px;
    margin: 2px 0 0 0;
    accent-color: var(--aiba-color, #0073aa);
    flex-shrink: 0;
    cursor: pointer;
}

.aiba-inline-info {
    flex: 1;
    min-width: 0;
}

.aiba-inline-name {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    margin-bottom: 2px;
    word-break: break-word;
}

.aiba-inline-details {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.aiba-inline-excerpt {
    font-size: 12px;
    color: #4b5563;
    margin-top: 4px;
    line-height: 1.4;
}

.aiba-finalize {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#aiba-send-selections:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* === Header action buttons (expand + minimize) === */
.aiba-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.aiba-header-actions .aiba-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    font-size: 26px;
    line-height: 1;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.95;
    transition: background 0.15s, opacity 0.15s;
}

.aiba-header-actions .aiba-header-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    opacity: 1;
}

#aiba-expand svg {
    display: block;
}

/* When chat is expanded, swap to a "shrink" visual cue via opacity tint */
.aiba-chat-window.aiba-expanded #aiba-expand {
    background: rgba(255, 255, 255, 0.18);
}

/* === Expanded chat window (larger, but not full-screen) === */
.aiba-chat-window.aiba-expanded {
    width: 560px;
    height: 720px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 100px);
}

@media (max-width: 640px) {
    .aiba-chat-window.aiba-expanded {
        width: calc(100vw - 24px);
        height: calc(100vh - 100px);
    }
}

/* === Form: SMS opt-in + agreement checkboxes === */
.aiba-form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0 0;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    line-height: 1.4;
}

.aiba-form-checkbox input[type="checkbox"] {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: var(--aiba-color, #0073aa);
    flex-shrink: 0;
}

.aiba-form-checkbox-required {
    background: #fff8e1;
    border: 1px solid #f3d27a;
    border-radius: 6px;
    padding: 8px 10px;
    margin: 14px 0 8px;
}

.aiba-required-star {
    color: #c00;
    font-weight: 700;
}

/* === Submit button breathing room === */
.aiba-contact-form .aiba-confirm-btn {
    margin-top: 16px;
}

.aiba-form-bottom-spacer {
    height: 18px;
}

.aiba-contact-form {
    padding-bottom: 6px;
}

/* End-Chat header button */
.aiba-end-chat-btn {
    width: auto !important;
    padding: 0 10px;
    font-size: 13px !important;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.aiba-end-chat-btn:hover {
    background: rgba(255, 255, 255, 0.28) !important;
}
