/* ==========================================================================
   FORM CONCIERGE: MAIN CONTAINER
   ========================================================================== */
.sas-concierge-container {
    --sas-bg: #ffffff;
    --sas-bg-soft: #f8fafc;
    --sas-border: #e2e8f0;
    --sas-text: #1e293b;
    --sas-muted: #64748b;
    /* --sas-forms-primary is injected dynamically by the React component via inline styles */
    
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--sas-bg);
    border: 1px solid var(--sas-border);
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto;
    height: 600px; /* Fixed height for the chat experience */
    max-height: 80vh;
    overflow: hidden;
}

/* ==========================================================================
   CHAT WINDOW (MESSAGE HISTORY)
   ========================================================================== */
.sas-concierge-chat-window {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--sas-bg-soft);
}

/* Scrollbar Styling */
.sas-concierge-chat-window::-webkit-scrollbar {
    width: 6px;
}
.sas-concierge-chat-window::-webkit-scrollbar-track {
    background: transparent;
}
.sas-concierge-chat-window::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

/* ==========================================================================
   MESSAGE BUBBLES
   ========================================================================== */
.sas-message-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    max-width: 85%;
    animation: sas-slide-up 0.3s ease-out;
}

.sas-is-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.sas-is-ai {
    align-self: flex-start;
}

.sas-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    flex-shrink: 0;
}

.sas-ai-avatar {
    background: var(--sas-forms-primary);
    color: white;
}

.sas-message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--sas-text);
}

.sas-is-user .sas-message-bubble {
    background: var(--sas-forms-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.sas-is-ai .sas-message-bubble {
    background: white;
    border: 1px solid var(--sas-border);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

/* ==========================================================================
   INPUT AREA & QUICK REPLIES
   ========================================================================== */
.sas-concierge-input-area {
    padding: 16px 24px;
    background: white;
    border-top: 1px solid var(--sas-border);
}

/* Short Dropdowns -> Quick Reply Buttons */
.sas-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.sas-quick-reply-btn {
    background: white;
    color: var(--sas-forms-primary);
    border: 1px solid var(--sas-forms-primary);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sas-quick-reply-btn:hover {
    background: var(--sas-forms-primary);
    color: white;
}

/* Long Lists -> Text Input */
.sas-input-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.sas-input-group input {
    flex-grow: 1;
    padding: 14px 20px;
    border: 1px solid var(--sas-border);
    border-radius: 24px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
    background: var(--sas-bg-soft);
}

.sas-input-group input:focus {
    border-color: var(--sas-forms-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.03);
}

.sas-input-group button {
    background: var(--sas-forms-primary);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.sas-input-group button:hover {
    transform: scale(1.05);
}

/* ==========================================================================
   SYSTEM STATES & ANIMATIONS
   ========================================================================== */
.sas-system-notice, .sas-system-success {
    align-self: center;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    margin: 10px 0;
    animation: sas-fade-in 0.3s;
}

.sas-system-notice {
    background: #f1f5f9;
    color: var(--sas-muted);
}

.sas-system-success {
    background: #ecfdf5;
    color: #16a34a;
    border: 1px solid #d1fae5;
}

/* Typing Indicator Dots */
.sas-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px 20px !important;
    align-items: center;
}

.sas-typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: var(--sas-muted);
    border-radius: 50%;
    animation: sas-bounce 1.4s infinite ease-in-out both;
}

.sas-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.sas-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes sas-bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

@keyframes sas-slide-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes sas-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==========================================================================
   MOBILE RESPONSIVENESS
   ========================================================================== */
@media (max-width: 600px) {
    .sas-concierge-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
        height: 100vh;
        max-height: -webkit-fill-available;
    }
    
    .sas-message-wrapper {
        max-width: 95%;
    }
    
    .sas-input-group button {
        padding: 14px 20px;
    }
}

/* ==========================================================================
   HEADER & BAILOUT BUTTON
   ========================================================================== */
.sas-concierge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: white;
    border-bottom: 1px solid var(--sas-border);
    border-radius: 16px 16px 0 0;
}

.sas-header-title {
    font-weight: 600;
    color: var(--sas-text);
    font-size: 14px;
}

.sas-header-btn {
    background: transparent;
    border: 1px solid var(--sas-border);
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--sas-muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.sas-header-btn:hover {
    background: var(--sas-bg-soft);
    color: var(--sas-text);
    border-color: #cbd5e1;
}