/* ================================
   AyurSathi - Ayurvedic Chat UI
   Modern, Natural, Warm Design
   ================================ */

/* CSS Custom Properties - Ayurvedic Color Palette */
:root {
    --primary: #7BAE7F;           /* Herbal Green */
    --primary-dark: #5a8a5e;
    --primary-light: #a5c9a8;
    --accent: #EAAE3B;            /* Turmeric Yellow */
    --accent-dark: #c4912e;
    --background: #FFF8EC;        /* Off-White Sand */
    --background-cream: #FDF5E6;
    --text-primary: #4C3B28;      /* Deep Brown */
    --text-secondary: #6B5B4D;
    --secondary: #C47F39;         /* Clay/Copper */
    --user-bubble: #7BAE7F;       /* Sage Green */
    --user-bubble-dark: #6a9e6e;
    --bot-bubble: #FDF5E6;        /* Warm Cream */
    --bot-bubble-border: #E8DCC8;
    --border-light: #E8DCC8;
    --shadow-soft: rgba(76, 59, 40, 0.08);
    --shadow-medium: rgba(76, 59, 40, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    color: var(--text-primary);
}

/* Decorative Mandala Background */
.mandala-bg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Ccircle cx='100' cy='100' r='90' fill='none' stroke='%237BAE7F' stroke-width='0.3' opacity='0.15'/%3E%3Ccircle cx='100' cy='100' r='70' fill='none' stroke='%237BAE7F' stroke-width='0.3' opacity='0.12'/%3E%3Ccircle cx='100' cy='100' r='50' fill='none' stroke='%237BAE7F' stroke-width='0.3' opacity='0.1'/%3E%3Ccircle cx='100' cy='100' r='30' fill='none' stroke='%237BAE7F' stroke-width='0.3' opacity='0.08'/%3E%3Cpath d='M100 10 Q130 50 100 100 Q70 50 100 10' fill='none' stroke='%23EAAE3B' stroke-width='0.2' opacity='0.1'/%3E%3Cpath d='M190 100 Q150 130 100 100 Q150 70 190 100' fill='none' stroke='%23EAAE3B' stroke-width='0.2' opacity='0.1'/%3E%3Cpath d='M100 190 Q70 150 100 100 Q130 150 100 190' fill='none' stroke='%23EAAE3B' stroke-width='0.2' opacity='0.1'/%3E%3Cpath d='M10 100 Q50 70 100 100 Q50 130 10 100' fill='none' stroke='%23EAAE3B' stroke-width='0.2' opacity='0.1'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

.chat-container {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100vh;
    background: transparent;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ================================
   HEADER - Compact & Refined
   ================================ */
.chat-header {
    background: linear-gradient(135deg, #4a7a4e 0%, var(--primary-dark) 50%, var(--primary) 100%);
    padding: 12px 30px;
    position: relative;
    overflow: hidden;
}

/* Subtle Ayurvedic Pattern Overlay */
.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cpath d='M30 5 Q35 15 30 30 Q25 15 30 5' fill='none' stroke='white' stroke-width='0.5' opacity='0.1'/%3E%3Cpath d='M55 30 Q45 35 30 30 Q45 25 55 30' fill='none' stroke='white' stroke-width='0.5' opacity='0.1'/%3E%3Cpath d='M30 55 Q25 45 30 30 Q35 45 30 55' fill='none' stroke='white' stroke-width='0.5' opacity='0.1'/%3E%3Cpath d='M5 30 Q15 25 30 30 Q15 35 5 30' fill='none' stroke='white' stroke-width='0.5' opacity='0.1'/%3E%3C/svg%3E");
    background-size: 60px 60px;
    pointer-events: none;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    background: white;
    padding: 2px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.header-text {
    display: flex;
    flex-direction: column;
}

.bot-name {
    color: white;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.bot-tagline {
    color: rgba(255, 255, 255, 0.85);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.3px;
}

.refresh-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(180deg);
}

.refresh-btn svg {
    width: 18px;
    height: 18px;
}

/* ================================
   CHAT MESSAGES AREA
   ================================ */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 25px 40px;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* ================================
   MESSAGE BUBBLES
   ================================ */
.message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bot messages - Left aligned */
.message.bot {
    align-self: flex-start;
}

/* User messages - Right aligned */
.message.user {
    align-self: flex-end;
}

.message-label {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.message-content {
    padding: 16px 20px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.65;
    position: relative;
}

/* Bot message styling - Warm Cream */
.message.bot .message-content {
    background: var(--bot-bubble);
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
    border: 1px solid var(--bot-bubble-border);
    box-shadow: 0 2px 12px var(--shadow-soft);
}

/* User message styling - Sage Green */
.message.user .message-content {
    background: linear-gradient(135deg, var(--user-bubble) 0%, var(--user-bubble-dark) 100%);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 3px 15px rgba(123, 174, 127, 0.3);
}

/* Styled content inside bot messages */
.message.bot .message-content h2,
.message.bot .message-content h3,
.message.bot .message-content h4 {
    font-family: 'Playfair Display', Georgia, serif;
    color: var(--secondary);
    margin: 14px 0 8px 0;
    font-weight: 600;
}

.message.bot .message-content h2 {
    font-size: 19px;
}

.message.bot .message-content h3 {
    font-size: 17px;
}

.message.bot .message-content h4 {
    font-size: 16px;
}

.message.bot .message-content ul {
    margin: 10px 0;
    padding-left: 18px;
    list-style-type: none;
}

.message.bot .message-content ul li {
    position: relative;
    padding-left: 8px;
    margin: 8px 0;
}

.message.bot .message-content ul li::before {
    content: '•';
    color: var(--primary);
    font-weight: bold;
    position: absolute;
    left: -12px;
}

.message.bot .message-content li {
    margin: 8px 0;
    line-height: 1.6;
}

.message.bot .message-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.message.bot .message-content em {
    font-style: italic;
    color: var(--text-secondary);
}

.message.bot .message-content p {
    margin: 10px 0;
}

/* Expand Button for Long Messages */
.expand-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 12px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    align-self: flex-start;
    font-weight: 500;
    transition: color 0.2s ease;
}

.expand-btn:hover {
    color: var(--primary-dark);
}

.expand-btn svg {
    transition: transform 0.3s ease;
}

.expand-btn.expanded svg {
    transform: rotate(180deg);
}

/* Lists in Bot Messages */
.message-content ol,
.message-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 8px 0;
}

.message-content strong {
    color: var(--text-primary);
}

/* ================================
   INPUT AREA
   ================================ */
.chat-input-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding: 16px 40px 12px;
    background: linear-gradient(to top, var(--background) 0%, transparent 100%);
    gap: 12px;
}

.disclaimer {
    width: 100%;
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 4px;
    line-height: 1.4;
    opacity: 0.8;
}

.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 28px;
    padding: 4px 8px;
    box-shadow: 0 2px 12px var(--shadow-soft);
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 4px 20px var(--shadow-medium), 0 0 0 3px rgba(123, 174, 127, 0.1);
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    font-size: 15px;
    font-family: 'Nunito', sans-serif;
    outline: none;
    background: transparent;
    color: var(--text-primary);
}

.chat-input::placeholder {
    color: #a8998a;
    font-style: italic;
}

.input-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a8998a;
}

.input-icon-btn svg {
    width: 20px;
    height: 20px;
}

.input-icon-btn:hover {
    background: var(--background);
    color: var(--primary);
}

/* Microphone Button */
.mic-btn {
    background: transparent;
    border: 1px solid var(--primary);
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.mic-btn svg {
    width: 20px;
    height: 20px;
}

.mic-btn:hover {
    background: var(--background);
    color: var(--primary);
    border-color: var(--primary);
}

.mic-btn.listening {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

.send-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    cursor: pointer;
    padding: 14px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 3px 12px rgba(123, 174, 127, 0.35);
}

.send-btn svg {
    width: 20px;
    height: 20px;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(123, 174, 127, 0.45);
}

.send-btn:active {
    transform: scale(0.95);
}

/* ================================
   TYPING INDICATOR
   ================================ */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 16px 20px;
    background: var(--bot-bubble);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    border: 1px solid var(--bot-bubble-border);
    box-shadow: 0 2px 12px var(--shadow-soft);
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--border-light);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        background: var(--border-light);
    }
    40% {
        transform: scale(1);
        background: var(--primary);
    }
}

/* ================================
   QUICK SUGGESTIONS / CHIPS
   ================================ */
.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    max-width: 100%;
}

/* Horizontal scrollable on mobile */
@media (max-width: 600px) {
    .suggestions {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .suggestions::-webkit-scrollbar {
        display: none;
    }
}

.suggestion-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--shadow-soft);
    white-space: nowrap;
}

.suggestion-chip:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(123, 174, 127, 0.3);
}

.suggestion-chip .chip-icon {
    width: 16px;
    height: 16px;
    opacity: 0.8;
}

.suggestion-chip:hover .chip-icon {
    opacity: 1;
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */
@media (max-width: 768px) {
    .chat-messages {
        padding: 20px 24px;
    }
    
    .chat-input-container {
        padding: 12px 24px 16px;
    }
    
    .message {
        max-width: 88%;
    }
    
    .mandala-bg {
        width: 500px;
        height: 500px;
    }
}

@media (max-width: 480px) {
    .chat-messages {
        padding: 16px 16px;
        gap: 14px;
    }
    
    .chat-input-container {
        padding: 10px 16px 14px;
    }
    
    .chat-header {
        padding: 10px 16px;
    }
    
    .bot-name {
        font-size: 18px;
    }
    
    .bot-tagline {
        font-size: 10px;
    }
    
    .header-logo {
        width: 36px;
        height: 36px;
    }
    
    .message-content {
        padding: 14px 16px;
        font-size: 14px;
    }
    
    .input-wrapper {
        padding: 2px 6px;
    }
    
    .chat-input {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .send-btn {
        padding: 12px;
    }
    
    .mandala-bg {
        width: 350px;
        height: 350px;
        opacity: 0.4;
    }
}

/* ================================
   COLLAPSIBLE CONTENT
   ================================ */
.message-content.collapsible[data-collapsed="true"] {
    max-height: 200px;
    overflow: hidden;
    position: relative;
}

.message-content.collapsible[data-collapsed="true"]::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(transparent, var(--bot-bubble));
    pointer-events: none;
}

.message-content.collapsible[data-collapsed="false"] {
    max-height: none;
}

.message-content.collapsible[data-collapsed="false"]::after {
    display: none;
}

/* ================================
   ACCESSIBILITY & UTILITIES
   ================================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for accessibility */
.suggestion-chip:focus,
.refresh-btn:focus,
.send-btn:focus,
.input-icon-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.chat-input:focus {
    outline: none;
}
