/* === GitaGPT — Spiritual Theme — Elder-Friendly === */

:root {
    --bg-deep: #3A0A0A;
    --bg-primary: #4A0E0E;
    --bg-card: #5C1A1A;
    --gold: #D4A847;
    --gold-light: #E8C76A;
    --cream: #F5E6C8;
    --cream-dim: #D4C4A0;
    --saffron: #FF6B00;
    --glow: #FFD700;
    --white-soft: rgba(255, 255, 255, 0.9);
    --font-sans: 'Noto Sans Devanagari', sans-serif;
    --font-serif: 'Noto Serif Devanagari', serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 18px; /* Base size bumped for elders */
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--cream);
    line-height: 1.7;
    -webkit-text-size-adjust: 100%;
}

.hidden { display: none !important; }

/* === Splash Screen === */
.splash {
    position: fixed;
    inset: 0;
    background: var(--bg-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: splashFade 0.6s ease-out 2.5s forwards;
}

.splash-content {
    text-align: center;
    position: relative;
}

.om-symbol {
    font-family: var(--font-serif);
    font-size: 6rem;
    color: var(--gold);
    animation: omGlow 2s ease-in-out infinite alternate;
    margin-bottom: 1rem;
}

.splash-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.15) 0%, transparent 70%);
    animation: glowPulse 2s ease-in-out infinite alternate;
    pointer-events: none;
}

.splash-title {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    color: var(--gold);
    font-weight: 700;
    letter-spacing: 0.05em;
}

.splash-subtitle {
    font-size: 1.1rem;
    color: var(--cream-dim);
    margin-top: 0.5rem;
    letter-spacing: 0.05em;
}

@keyframes omGlow {
    from { text-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
    to { text-shadow: 0 0 40px rgba(255, 215, 0, 0.6), 0 0 80px rgba(255, 215, 0, 0.2); }
}

@keyframes glowPulse {
    from { transform: translate(-50%, -50%) scale(0.8); opacity: 0.5; }
    to { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
}

@keyframes splashFade {
    to { opacity: 0; pointer-events: none; }
}

/* === App Container === */
.app {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    padding: 0 1.25rem;
    padding-bottom: env(safe-area-inset-bottom, 0); /* iPhone notch */
}

.app.visible {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* === Header === */
.header {
    padding: 1rem 0 0.75rem;
    text-align: center;
    position: sticky;
    top: 0;
    background: var(--bg-deep);
    z-index: 10;
}

.header-title {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.nav {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-card);
    border-radius: 14px;
    padding: 5px;
}

.nav-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--cream-dim);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.6rem 0.75rem;
    border-radius: 11px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.nav-btn.active {
    background: var(--saffron);
    color: #fff;
    font-weight: 600;
}

/* === Screens === */
.screen {
    flex: 1;
    padding: 1rem 0;
}

/* === Home Screen === */
.home-prompt {
    text-align: center;
    margin: 2rem 0 1.5rem;
}

.prompt-text {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--gold-light);
    font-weight: 600;
}

.prompt-sub {
    font-size: 1rem;
    color: var(--cream-dim);
    margin-top: 0.5rem;
}

/* === Mic Button === */
.mic-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1.5rem 0;
}

.mic-btn {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--saffron), #E85D00);
    border: 3px solid var(--gold);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.mic-btn:active {
    transform: scale(0.95);
}

.mic-btn.listening {
    animation: micPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(255, 107, 0, 0.4);
}

.mic-icon {
    width: 36px;
    height: 36px;
}

.mic-pulse {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2px solid var(--saffron);
    opacity: 0;
    pointer-events: none;
}

.mic-btn.listening .mic-pulse {
    animation: pulseRing 1.5s ease-out infinite;
}

@keyframes micPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 0, 0.4); }
    50% { box-shadow: 0 0 0 18px rgba(255, 107, 0, 0); }
}

@keyframes pulseRing {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.5); opacity: 0; }
}

.mic-status {
    font-size: 1rem;
    color: var(--gold-light);
    margin-top: 0.75rem;
    min-height: 1.4em;
    text-align: center;
}

/* === Text Input === */
.text-input-container {
    margin: 0.5rem 0 1.5rem;
}

.query-form {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid rgba(212, 168, 71, 0.3);
    border-radius: 14px;
    padding: 6px 6px 6px 16px;
    align-items: center;
}

.query-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--cream);
    font-family: var(--font-sans);
    font-size: 1.1rem;
    padding: 0.6rem 0;
}

.query-input::placeholder {
    color: var(--cream-dim);
    opacity: 0.6;
}

.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 11px;
    background: var(--saffron);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.send-btn:active {
    background: #E85D00;
}

/* === Loading === */
.loading {
    text-align: center;
    padding: 2rem 0;
}

.loading-glow {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
    animation: glowPulse 1.5s ease-in-out infinite alternate;
}

.loading-text {
    color: var(--cream-dim);
    font-size: 1rem;
}

/* === Shloka Result === */
.shloka-result {
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.shloka-card {
    background: var(--bg-card);
    border: 1px solid rgba(212, 168, 71, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.shloka-ref {
    font-size: 0.9rem;
    color: var(--saffron);
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.shloka-sanskrit {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    color: var(--gold);
    line-height: 1.9;
    margin-bottom: 1.25rem;
    border-left: 3px solid var(--gold);
    padding-left: 1rem;
}

.shloka-meaning {
    font-size: 1.1rem;
    color: var(--cream);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.shloka-interpretation {
    font-size: 1rem;
    color: var(--cream-dim);
    line-height: 1.8;
    padding-top: 1rem;
    border-top: 1px solid rgba(212, 168, 71, 0.15);
}

/* === Shabdarth (word-by-word) === */
.shloka-shabdarth {
    margin-bottom: 1.25rem;
}

.shabdarth-label {
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 0.6rem;
    letter-spacing: 0.05em;
}

.shabdarth-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.shabdarth-pair {
    background: rgba(212, 168, 71, 0.1);
    border: 1px solid rgba(212, 168, 71, 0.2);
    border-radius: 8px;
    padding: 0.35rem 0.65rem;
    font-size: 0.95rem;
    color: var(--cream);
}

/* === Bhavarth === */
.shloka-bhavarth {
    margin-bottom: 1rem;
}

.bhavarth-label {
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

/* === Guidance === */
.shloka-guidance {
    color: var(--cream-dim);
    font-style: italic;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(212, 168, 71, 0.1);
    line-height: 1.8;
}

.shloka-footer {
    text-align: right;
    margin-top: 1rem;
    font-family: var(--font-serif);
    font-size: 0.95rem;
    color: var(--gold);
    opacity: 0.7;
}

.ask-another-btn {
    display: block;
    width: 100%;
    background: none;
    border: 1px solid rgba(212, 168, 71, 0.3);
    color: var(--gold-light);
    font-family: var(--font-sans);
    font-size: 1.05rem;
    padding: 0.9rem;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.2s;
}

.ask-another-btn:active {
    background: rgba(212, 168, 71, 0.1);
}

/* === Amrit Screen === */
.screen-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.screen-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    color: var(--gold);
    font-weight: 700;
}

.screen-subtitle {
    font-size: 1rem;
    color: var(--cream-dim);
    margin-top: 0.3rem;
}

.amrit-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: 2rem;
}

.amrit-card {
    background: var(--bg-card);
    border: 1px solid rgba(212, 168, 71, 0.2);
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.amrit-card:active {
    transform: scale(0.98);
    border-color: var(--gold);
}

.amrit-card-ref {
    font-size: 0.85rem;
    color: var(--saffron);
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.amrit-card-text {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    color: var(--gold-light);
}

/* Expanded amrit shloka */
.amrit-expanded {
    animation: slideUp 0.3s ease-out;
}

.amrit-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: none;
    color: var(--gold-light);
    font-family: var(--font-sans);
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

/* === Journey Screen === */
.journey-stats {
    display: flex;
    justify-content: space-around;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.journey-stat {
    text-align: center;
    flex: 1;
    background: var(--bg-card);
    border-radius: 14px;
    padding: 0.9rem 0.5rem;
    border: 1px solid rgba(212, 168, 71, 0.15);
}

.stat-value {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    color: var(--gold);
    font-weight: 700;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--cream-dim);
    margin-top: 0.2rem;
}

/* Journey Progress Bar */
.journey-progress-container {
    margin-bottom: 1.25rem;
}

.journey-progress-bar {
    height: 10px;
    background: var(--bg-card);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(212, 168, 71, 0.15);
}

.journey-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--saffron), var(--gold));
    border-radius: 5px;
    transition: width 0.5s ease;
    width: 0%;
}

.journey-progress-text {
    text-align: center;
    font-size: 0.85rem;
    color: var(--cream-dim);
    margin-top: 0.4rem;
}

/* Chapter Map — 18 lamps in grid */
.chapter-map {
    margin-bottom: 1.5rem;
}

.chapter-map-title {
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--gold);
    text-align: center;
    margin-bottom: 0.75rem;
}

.chapter-lamps {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

.lamp {
    text-align: center;
    background: var(--bg-card);
    border: 1px solid rgba(212, 168, 71, 0.1);
    border-radius: 10px;
    padding: 0.5rem 0.25rem;
    transition: all 0.3s ease;
}

.lamp.lit {
    background: rgba(212, 168, 71, 0.15);
    border-color: var(--gold);
}

.lamp.current {
    background: rgba(255, 107, 0, 0.15);
    border-color: var(--saffron);
    animation: currentGlow 2s ease-in-out infinite alternate;
}

@keyframes currentGlow {
    from { box-shadow: 0 0 4px rgba(255, 107, 0, 0.2); }
    to { box-shadow: 0 0 12px rgba(255, 107, 0, 0.4); }
}

.lamp-flame {
    font-size: 1.2rem;
    line-height: 1;
}

.lamp-num {
    font-size: 0.75rem;
    color: var(--cream-dim);
    margin-top: 0.15rem;
}

.lamp.lit .lamp-num { color: var(--gold); }
.lamp.current .lamp-num { color: var(--saffron); font-weight: 600; }

/* Journey chapter badge */
.journey-chapter-badge {
    background: var(--bg-card);
    border: 1px solid rgba(212, 168, 71, 0.2);
    border-radius: 10px;
    padding: 0.7rem 1rem;
    margin-bottom: 0.75rem;
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--gold-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chapter-progress-mini {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--cream-dim);
    background: rgba(212, 168, 71, 0.1);
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
}

/* Chapter milestone celebration */
.chapter-milestone {
    text-align: center;
    background: rgba(212, 168, 71, 0.1);
    border: 1px solid rgba(212, 168, 71, 0.3);
    border-radius: 14px;
    padding: 1.25rem;
    margin-top: 1rem;
    animation: slideUp 0.4s ease-out;
}

.milestone-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.milestone-text {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    color: var(--gold);
    font-weight: 600;
}

/* Next shloka button */
.journey-next-btn {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, var(--saffron), #E85D00);
    border: none;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 1.15rem;
    font-weight: 600;
    padding: 1rem;
    border-radius: 14px;
    cursor: pointer;
    margin-top: 1rem;
    transition: transform 0.2s, opacity 0.2s;
}

.journey-next-btn:active {
    transform: scale(0.98);
}

.journey-next-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.journey-shloka {
    padding-bottom: 2rem;
}

/* === Footer === */
.footer {
    text-align: center;
    padding: 1rem 0 1.5rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0));
    font-family: var(--font-serif);
    font-size: 0.9rem;
    color: var(--gold);
    opacity: 0.5;
}

/* === Error Toast === */
.error-toast {
    position: fixed;
    bottom: 2rem;
    left: 1rem;
    right: 1rem;
    max-width: 540px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid rgba(255, 107, 0, 0.5);
    color: var(--cream);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    z-index: 50;
    text-align: center;
    animation: toastIn 0.3s ease-out, toastOut 0.3s ease-in 2.7s forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateY(10px); }
}

/* === Install Banner (Add to Home Screen) === */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid rgba(212, 168, 71, 0.3);
    padding: 1rem 1.25rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    z-index: 60;
    animation: toastIn 0.3s ease-out;
}

.install-text {
    font-size: 1rem;
    color: var(--cream);
    line-height: 1.5;
}

.install-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.install-btn {
    background: var(--saffron);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1.2rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.install-dismiss {
    background: none;
    color: var(--cream-dim);
    border: none;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.6rem;
}

/* === Mobile-First Responsive === */

/* Small phones (< 360px) */
@media (max-width: 359px) {
    html { font-size: 16px; }
    .mic-btn { width: 76px; height: 76px; }
    .mic-icon { width: 30px; height: 30px; }
    .shloka-card { padding: 1.25rem; }
    .shabdarth-pair { font-size: 0.85rem; padding: 0.25rem 0.5rem; }
}

/* Short screens (landscape or small height) */
@media (max-height: 600px) {
    .home-prompt { margin: 0.75rem 0; }
    .mic-container { margin: 0.75rem 0; }
    .mic-btn { width: 70px; height: 70px; }
    .mic-icon { width: 28px; height: 28px; }
}

/* Tablets and larger */
@media (min-width: 768px) {
    html { font-size: 20px; }
    .app { padding: 0 2rem; }
    .shloka-card { padding: 2rem; }
    .mic-btn { width: 100px; height: 100px; }
    .mic-icon { width: 40px; height: 40px; }
}
