/* CSS variables for consistent theming */
:root {
    --primary-color: #F8E5EB; /* Soft pink */
    --primary-dark: #EFD0D9;
    --secondary-color: #E8F1EB; /* Muted green */
    --secondary-dark: #CDE2D3;
    --text-main: #333333;
    --text-muted: #555555;
    --bg-color: #FFFFFF;
    --border-radius: 16px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.08);
    --transition: 0.3s ease;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Nunito', sans-serif;
    color: var(--text-main);
    background-color: transparent; /* Allows WordPress background to show if desired, though iframe is usually white */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.chat-container {
    width: 100%;
    max-width: 100%; /* For iframe, we want it to fill the container */
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
}

.chat-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.chat-header h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #4A4A4A;
}

.chat-header p {
    margin: 8px 0 0 0;
    font-size: 0.95rem;
    color: #666666;
    font-weight: 600;
    font-style: italic;
}

.chat-window {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

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

.message {
    display: flex;
    max-width: 85%;
    animation: fadeIn 0.3s ease-in-out;
}

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

.user-message {
    align-self: flex-end;
}

.assistant-message {
    align-self: flex-start;
}

.bubble {
    padding: 14px 18px;
    border-radius: var(--border-radius);
    line-height: 1.5;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
    word-wrap: break-word;
}

.user-message .bubble {
    background-color: #F8F8F8;
    color: var(--text-main);
    border-bottom-right-radius: 4px;
}

.assistant-message .bubble {
    background-color: var(--secondary-color);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

.assistant-message .bubble p {
    margin: 0 0 10px 0;
}
.assistant-message .bubble p:last-child {
    margin: 0;
}
.assistant-message .bubble ul, 
.assistant-message .bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.input-area {
    display: flex;
    align-items: center;
    padding: 16px;
    background-color: #FAFAFA;
    border-top: 1px solid #EEEEEE;
    gap: 12px;
}

#user-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #DDDDDD;
    border-radius: 20px;
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    outline: none;
    transition: var(--transition);
    max-height: 100px; /* Allow growing slightly */
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
}

#user-input:focus {
    border-color: var(--secondary-dark);
    box-shadow: 0 0 0 3px rgba(205, 226, 211, 0.4);
}

#send-button {
    background-color: var(--primary-dark);
    color: #5A4A4F;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

#send-button:hover {
    background-color: #E2B9C5;
    transform: scale(1.05);
}

#send-button:active {
    transform: scale(0.95);
}

.medical-disclaimer {
    padding: 12px 20px;
    font-size: 0.8rem;
    color: #777777;
    text-align: center;
    background-color: #FDF9FA;
    border-top: 1px solid #F0F0F0;
    line-height: 1.4;
}

/* Loading Dots */
.loading-indicator {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    background-color: var(--secondary-color);
    border-radius: var(--border-radius);
    border-bottom-left-radius: 4px;
    margin-bottom: 10px;
}

.loading-indicator.hidden {
    display: none;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: #8CABA3;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

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

@media (max-width: 600px) {
    .chat-header h1 {
        font-size: 1.2rem;
    }
    .chat-header p {
        font-size: 0.85rem;
    }
    .message {
        max-width: 90%;
    }
    .bubble {
        padding: 12px 16px;
    }
}
