:root {
    --bg-color: #faf9f7;
    --text-primary: #2d2c2a;
    --text-secondary: #6b6965;
    --border-color: #e5e3dd;
    --primary-color: #4a4843;
    --accent-color: #f0eee6;
    --error-color: #d32f2f;
    --user-msg-bg: #4a4843;
    --user-msg-text: #fff;
    --form-bg: #fff;
    --input-shadow: rgba(0,0,0,0.03);
    --input-shadow-focus: rgba(0,0,0,0.06);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

[data-theme="dark"] {
    --bg-color: #1a1918;
    --text-primary: #e8e6e1;
    --text-secondary: #9e9c97;
    --border-color: #363431;
    --primary-color: #8c8982;
    --accent-color: #2b2a28;
    --user-msg-bg: #403e3a;
    --user-msg-text: #e8e6e1;
    --form-bg: #242220;
    --input-shadow: rgba(0,0,0,0.2);
    --input-shadow-focus: rgba(0,0,0,0.4);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 3rem;
    flex-shrink: 0;
    transition: margin-bottom 0.5s ease;
}

.header-text {
    text-align: center;
    flex-grow: 1;
    transition: text-align 0.5s ease;
}

.header.chat-active .header-text {
    text-align: left;
}

.theme-control-container {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin-top: 1rem;
    gap: 0.25rem;
}

.theme-helper {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-toggle:hover {
    color: var(--text-primary);
    background: var(--accent-color);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.moon-icon {
    display: none;
}

[data-theme="dark"] .sun-icon {
    display: none;
}

[data-theme="dark"] .moon-icon {
    display: block;
}

.logo {
    font-size: 1.5rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.tagline {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.hero-section {
    text-align: center;
    margin-bottom: 3rem;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.hero-section.hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transform: translateY(-20px);
}

.headline {
    font-size: 2.25rem;
    font-weight: 400;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.sub-headline {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
}

.chat-container {
    flex-grow: 1;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    padding-bottom: 2rem;
    scrollbar-width: none;
}
.chat-container::-webkit-scrollbar { 
    display: none;
}

.chat-container.active {
    display: flex;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    max-width: 85%;
    animation: fadeIn 0.4s ease forwards;
}

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

.message.user {
    align-self: flex-end;
    background-color: var(--user-msg-bg);
    color: var(--user-msg-text);
    padding: 1rem 1.25rem;
    border-radius: 1.25rem;
    border-bottom-right-radius: 0.25rem;
    font-size: 1rem;
}

.message.bot {
    align-self: flex-start;
    padding: 0;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.message-content {
    margin-bottom: 0.75rem;
}

.message-content p {
    margin-bottom: 0.75rem;
}
.message-content p:last-child {
    margin-bottom: 0;
}

.verses-section {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
}

.verses-title {
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.verses-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.verse-reference {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.verse-id {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    display: inline-block;
    align-self: flex-start;
    background-color: var(--accent-color);
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
}

.sanskrit-text {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-primary);
    text-align: center;
    padding: 1.25rem;
    background-color: var(--accent-color);
    border-radius: 0.5rem;
    font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
    margin-top: 0.25rem;
}

.share-container {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.share-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.share-btn:hover:not(:disabled) {
    background: var(--accent-color);
    color: var(--text-primary);
    border-color: #d0cec7;
}

.share-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.share-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.image-preview {
    max-width: 100%;
    border-radius: 0.75rem;
    margin-top: 0.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.input-area {
    margin-top: auto;
    background: var(--bg-color);
    padding-top: 1rem;
    flex-shrink: 0;
}

.suggested-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
    transition: opacity 0.3s ease;
}

.suggested-prompts.hidden {
    display: none;
}

.prompt-chip {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.prompt-chip:hover {
    background-color: var(--accent-color);
    color: var(--text-primary);
    border-color: #d0cec7;
}

.chat-form {
    position: relative;
    display: flex;
    align-items: flex-end;
    background-color: var(--form-bg);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 0.5rem;
    box-shadow: 0 4px 20px var(--input-shadow);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.chat-form:focus-within {
    border-color: #c9c7c0;
    box-shadow: 0 4px 20px var(--input-shadow-focus);
}

.user-input {
    flex-grow: 1;
    border: none;
    background: transparent;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    outline: none;
    max-height: 150px;
    color: var(--text-primary);
    line-height: 1.5;
}

.user-input::placeholder {
    color: #a09e99;
}

.send-btn {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0.25rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    background-color: #33322f;
    transform: scale(1.05);
}

.send-btn:disabled {
    background-color: var(--border-color);
    color: #a09e99;
    cursor: not-allowed;
}

.error-message {
    color: var(--error-color);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 0.75rem;
    min-height: 1.2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.error-message.visible {
    opacity: 1;
}

.typing-indicator {
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem 0;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

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

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

@media (max-width: 600px) {
    body {
        height: 100dvh;
        min-height: 100dvh;
    }

    .app-container {
        height: 100dvh;
        min-height: 100dvh;
        padding: max(1rem, env(safe-area-inset-top)) 1rem max(0.5rem, env(safe-area-inset-bottom)) 1rem;
    }
    
    .header {
        margin-bottom: 1.5rem;
    }

    .main-content {
        justify-content: flex-start;
    }

    .hero-section {
        margin-bottom: 1rem;
    }
    
    .headline {
        font-size: 1.5rem;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }
    
    .sub-headline {
        font-size: 0.95rem;
        line-height: 1.4;
    }
    
    .message.bot {
        font-size: 16px;
    }

    .message.user {
        max-width: 90%;
        font-size: 15px;
        padding: 0.85rem 1.15rem;
    }

    .sanskrit-text {
        font-size: 18px;
        padding: 1rem;
    }

    .verses-title, .verse-id {
        font-size: 12px;
    }

    .share-btn {
        font-size: 13px;
        padding: 0.4rem 0.8rem;
    }
    
    .suggested-prompts {
        margin-bottom: 0.5rem;
        flex-direction: column;
        align-items: stretch;
        overflow-x: visible;
        padding-bottom: 0.25rem;
    }
    
    .prompt-chip {
        font-size: 13px;
        width: 100%;
        padding: 0.65rem 1rem; /* Slightly reduced padding to ensure all 5 prompts fit */
        white-space: normal;
    }

    .input-area {
        margin-top: auto;
        padding-top: 0.5rem;
    }
}
