* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
}

.clarification-container {
    width: 100%;
    max-width: 480px;
    position: relative;
}

.clarification-card {
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 24px;
    padding: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    width: 100%;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

.clarification-card.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.clarification-header {
    padding: 24px 24px 0 24px;
}

.ai-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(71, 85, 105, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-dot {
    width: 8px;
    height: 8px;
    background: linear-gradient(45deg, #06b6d4, #0ea5e9);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.clarification-content {
    padding: 20px 24px 24px 24px;
}

.clarification-question {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    color: #0f172a;
    margin-bottom: 8px;
}

.clarification-context {
    font-size: 14px;
    font-weight: 400;
    margin-bottom: 24px;
    line-height: 1.5;
}

.poll-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.poll-option {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-color: rgba(14, 165, 233, 0.4);
    border-radius: 16px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    color: #334155;
    text-align: left;
    width: 100%;
}

.poll-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(14, 165, 233, 0.3);
    transform: translateY(-1px);
}

.poll-option.selected {
    background: rgba(14, 165, 233, 0.1);
    border-color: rgba(14, 165, 233, 0.4);
    color: #0c4a6e;
}

.option-text {
    position: relative;
    z-index: 2;
}

.option-highlight {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.poll-option:hover .option-highlight {
    left: 100%;
}

.text-input-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.clarification-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px 20px;
    font-family: inherit;
    font-size: 15px;
    color: #334155;
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.clarification-input::placeholder {
    color: rgba(71, 85, 105, 0.5);
    font-weight: 400;
}

.clarification-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(14, 165, 233, 0.4);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.submit-clarification {
    background: rgba(15, 23, 42, 0.9);
    border: none;
    border-radius: 14px;
    padding: 14px 24px;
    color: white;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    align-self: flex-end;
    min-width: 140px;
}

.submit-clarification:hover {
    background: rgba(15, 23, 42, 1);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.3);
}

.submit-arrow {
    transition: transform 0.3s ease;
    font-weight: 300;
}

.submit-clarification:hover .submit-arrow {
    transform: translateX(2px);
}

/* =================================================================== */
/* CRITICAL: In-Chat Positioning Styles - Required for Chat Integration */
/* =================================================================== */

/* Wrapper for clarification when it appears as a chat message */
.clarification-message-wrapper {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 20px 0 !important;
    box-shadow: none !important;
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
}

/* Ensure clarification card fits properly within chat message flow */
.clarification-message-wrapper .clarification-card {
    margin: 0 auto !important;
    max-width: 480px !important;
    position: relative !important;
    border-radius: 24px !important;
    padding: 0 !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    width: 100% !important;
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
    pointer-events: all !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}
/* Animation for clarification appearing in chat */
.clarification-message-wrapper {
    animation: clarificationSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes clarificationSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
/* === STYLING FOR THE FINAL ANSWER BLOCK === */
.final-clarification-answer {
    margin-top: 16px;
    padding: 16px;
    background-color: rgba(240, 248, 255, 0.7);
    border-left: 4px solid #0ea5e9;
    border-radius: 8px;
  }
  
  /* Styling for the user's selection preview inside the answer block */
  .final-clarification-answer .user-response-preview {
    font-size: 14px;
    color: #555;
    margin-bottom: 12px;
    font-style: italic;
  }
  

/* Ensure all clarification elements maintain their styling within chat */
.clarification-message-wrapper .clarification-header {
    padding: 24px 24px 0 24px !important;
}

.clarification-message-wrapper .clarification-content {
    padding: 20px 24px 24px 24px !important;
}

.clarification-message-wrapper .ai-indicator {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: rgba(71, 85, 105, 0.8) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.clarification-message-wrapper .ai-dot {
    width: 8px !important;
    height: 8px !important;
    background: linear-gradient(45deg, #06b6d4, #0ea5e9) !important;
    border-radius: 50% !important;
    animation: pulse 2s ease-in-out infinite !important;
}

.clarification-message-wrapper .clarification-question {
    font-size: 18px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    color: #0f172a !important;
    margin-bottom: 8px !important;
}

.clarification-message-wrapper .clarification-context {
    font-size: 14px !important;
    font-weight: 400 !important;
    color: rgba(71, 85, 105, 0.7) !important;
    margin-bottom: 24px !important;
    line-height: 1.5 !important;
}

/* Ensure poll options work properly within chat */
.clarification-message-wrapper .poll-options {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}

.clarification-message-wrapper .poll-option {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
    padding: 16px 20px !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
    overflow: hidden !important;
    font-family: inherit !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    color: #334155 !important;
    text-align: left !important;
    width: 100% !important;
}

.clarification-message-wrapper .poll-option:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(14, 165, 233, 0.3) !important;
    transform: translateY(-1px) !important;
}

.clarification-message-wrapper .poll-option.selected {
    background: rgba(14, 165, 233, 0.1) !important;
    border-color: rgba(14, 165, 233, 0.4) !important;
    color: #0c4a6e !important;
}

/* Ensure text input works properly within chat */
.clarification-message-wrapper .text-input-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
}

.clarification-message-wrapper .clarification-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
    padding: 16px 20px !important;
    font-family: inherit !important;
    font-size: 15px !important;
    color: #334155 !important;
    resize: vertical !important;
    min-height: 120px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    outline: none !important;
}

.clarification-message-wrapper .clarification-input:focus {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(14, 165, 233, 0.4) !important;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1) !important;
}

.clarification-message-wrapper .submit-clarification {
    background: rgba(15, 23, 42, 0.9) !important;
    border: none !important;
    border-radius: 14px !important;
    padding: 14px 24px !important;
    color: white !important;
    font-family: inherit !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    align-self: flex-end !important;
    min-width: 140px !important;
}

.clarification-message-wrapper .submit-clarification:hover {
    background: rgba(15, 23, 42, 1) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.3) !important;
}

/* Responsive adjustments for chat integration */
@media (max-width: 640px) {
    .clarification-container {
        max-width: 100%;
    }
    
    .clarification-question {
        font-size: 16px;
    }
    
    .clarification-content {
        padding: 16px 20px 20px 20px;
    }
    
    .poll-option {
        padding: 14px 16px;
        font-size: 14px;
    }

    /* Chat-specific mobile adjustments */
    .clarification-message-wrapper .clarification-card {
        max-width: 100% !important;
        margin: 0 10px !important;
    }
    
    .clarification-message-wrapper .clarification-question {
        font-size: 16px !important;
    }
    
    .clarification-message-wrapper .clarification-content {
        padding: 16px 20px 20px 20px !important;
    }
    
    .clarification-message-wrapper .poll-option {
        padding: 14px 16px !important;
        font-size: 14px !important;
    }
}

/* ADD this entire block for the expert waiting UI */
.expert-waiting-ui {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-size: 15px;
    color: #546e7a;
}
.dots {
    display: flex;
    gap: 5px;
    margin-right: 10px;
}
.dot {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}
.dot:nth-child(1) { animation-delay: 0s; }
.dot:nth-child(2) { animation-delay: 0.3s; }
.dot:nth-child(3) { animation-delay: 0.6s; }
@keyframes pulse {
    0%, 60%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}
