/**
 * GURBANI KHOJ — Pixel-Perfect iOS UI Replica v26
 * Deep-dive comparison fix — exact match to reference screenshots
 */

/* ═══════════════════════════════════════════════════════════
   GOOGLE FONTS
   ═══════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800&family=Noto+Sans+Gurmukhi:wght@300;400;500;600;700&display=optional');

/* ═══════════════════════════════════════════════════════════
   CSS VARIABLES
   ═══════════════════════════════════════════════════════════ */
:root {
    --bg-page: #f5f1eb;
    --bg-card: #ffffff;
    --bg-secondary: #f0ece6;
    --text-primary: #1c1c1e;
    --text-secondary: #6e6e73;
    --text-tertiary: #8e8e93;
    --ios-blue: #007aff;
    --ios-blue-light: rgba(0, 122, 255, 0.12);
    --gold-accent: #c8a96a;
    --border-light: rgba(0, 0, 0, 0.05);
    --border-input: rgba(0, 0, 0, 0.1);
    --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.04), 0 1px 4px rgba(0, 0, 0, 0.02);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.06);
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    --font-gurmukhi: 'Noto Sans Gurmukhi', 'Raavi', sans-serif;
    --safe-top: max(env(safe-area-inset-top, 24px), 24px);
    --safe-bottom: max(env(safe-area-inset-bottom, 16px), 16px);
    --nav-h: 60px;
    --tab-h: 80px;
}

[data-theme="dark"] {
    --bg-page: #121214;
    --bg-card: #1c1c1e;
    --bg-secondary: #2c2c2e;
    --text-primary: #ffffff;
    --text-secondary: #a1a1a6;
    --text-tertiary: #767680;
    --border-light: rgba(255, 255, 255, 0.06);
    --border-input: rgba(255, 255, 255, 0.1);
    --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.2);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* ═══════════════════════════════════════════════════════════
   RESET
   ═══════════════════════════════════════════════════════════ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    font-family: var(--font-ui);
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

button { font-family: var(--font-ui); border: none; background: none; cursor: pointer; outline: none; }
a { text-decoration: none; }

/* ═══════════════════════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════════════════════ */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    max-width: 430px;
    margin: 0 auto;
    background: var(--bg-page);
    position: relative;
}

/* ═══════════════════════════════════════════════════════════
   TOP NAVIGATION BAR
   ═══════════════════════════════════════════════════════════ */
.gk-nav {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    z-index: 300;
    height: calc(var(--nav-h) + var(--safe-top));
    padding-top: var(--safe-top);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 16px;
    padding-right: 16px;
    background: var(--bg-page);
    border-bottom: none;
}

/* Icon buttons (round) */
.gk-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
    flex-shrink: 0;
    transition: transform 0.15s ease;
}
.gk-icon-btn:active { transform: scale(0.9); }
.gk-icon-btn svg { width: 20px; height: 20px; }

.gk-back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--ios-blue);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
    flex-shrink: 0;
}
.gk-back-btn svg { width: 18px; height: 18px; }

.filter-btn {
    display: none !important;
}

body.has-results .filter-btn {
    display: flex !important;
}

.gk-title {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.gk-title-main {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* "Gurbani" normal weight, "Khoj" in blue — matching reference */
.gk-title-main {
    color: var(--text-primary);
}

/* The actual color split is done via the JS/HTML structure: span inside the div */
.gk-nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gk-title-gurmukhi {
    font-family: var(--font-gurmukhi);
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ═══════════════════════════════════════════════════════════
   SEARCH BAR
   ═══════════════════════════════════════════════════════════ */
.search-section {
    padding: calc(var(--nav-h) + var(--safe-top) + 10px) 16px 0;
}

.search-bar-thin {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-input);
    border-radius: 14px;
    padding: 11px 14px;
    gap: 8px;
    box-shadow: var(--shadow-soft);
    cursor: text;
}

.search-icon-thin {
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.search-input-thin {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-ui);
    font-size: 16px;
    color: var(--text-primary);
    caret-color: var(--ios-blue);
}

.search-input-thin::placeholder { color: var(--text-tertiary); }

.clear-btn-thin {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-tertiary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.clear-btn-thin svg { width: 10px; height: 10px; }

.mic-btn-thin {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ios-blue);
    flex-shrink: 0;
}
.mic-btn-thin svg { width: 20px; height: 20px; }

/* Source Filter Chips */
.source-filters {
    display: flex;
    gap: 8px;
    padding: 12px 0 0;
    overflow-x: auto;
    scrollbar-width: none;

}
.source-filters::-webkit-scrollbar { display: none; }

.source-chip {
    padding: 7px 16px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
    flex-shrink: 0;
    transition: box-shadow 0.2s ease, color 0.2s ease;
}


.source-chip.active {
    background: var(--ios-blue);
    color: #fff;
    border-color: var(--ios-blue);
}

/* ═══════════════════════════════════════════════════════════
   MAIN SCROLL ZONE
   ═══════════════════════════════════════════════════════════ */
.main-content {
    flex: 1;
    padding: 0 16px;
    padding-top: 12px;
    padding-bottom: calc(var(--tab-h) + var(--safe-bottom) + 20px);
    overflow-y: auto;

}

/* ═══════════════════════════════════════════════════════════
   WELCOME STATE
   ═══════════════════════════════════════════════════════════ */
.welcome-state { display: none; }
.welcome-state.active { display: block; }

/* ─── Hero Banner Card ──────────────────────────────────────── */
.hero-banner-card {
    width: 100%;
    height: 188px;
    border-radius: 22px;
    overflow: hidden;
    position: relative;
    margin-bottom: 22px;
    background: #f5f1eb url('../assets/darbar-sahib-day.webp') center 40% / cover no-repeat;
    box-shadow: var(--shadow-card);
}

/* Gradient overlay: warm cream overlay on the left to read dark text */
.hero-banner-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(245, 241, 235, 0.95) 0%,
        rgba(245, 241, 235, 0.6) 45%,
        rgba(245, 241, 235, 0) 80%
    );
}

.hero-card-content {
    position: absolute;
    inset: 0;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    z-index: 2;
}

.hero-ek-onkar {
    font-family: var(--font-gurmukhi);
    font-size: 44px;
    color: #d4af37;
    font-weight: 500;
    line-height: 1;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.2));
}

.hero-card-title {
    font-size: 19px;
    font-weight: 700;
    color: #1c1c1e !important;
    line-height: 1.3;
    margin-bottom: 4px;
}

.hero-card-title span {
    color: #007aff !important;
}

.hero-card-subtitle {
    font-size: 12px;
    color: #6e6e73 !important;
    letter-spacing: 0.5px;
}

/* Dark mode overrides for hero banner */
[data-theme="dark"] .hero-banner-card {
    background-color: #121214;
    background-image: url('../assets/darbar-sahib-evening.webp');
}
[data-theme="dark"] .hero-banner-card::before {
    background: linear-gradient(
        90deg,
        rgba(18, 18, 20, 0.95) 0%,
        rgba(18, 18, 20, 0.6) 45%,
        rgba(18, 18, 20, 0) 80%
    ) !important;
}
[data-theme="dark"] .hero-card-title {
    color: #ffffff !important;
}
[data-theme="dark"] .hero-card-title span {
    color: #5eaeff !important;
}
[data-theme="dark"] .hero-card-subtitle {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* ─── Quick Search Section ──────────────────────────────────── */
.welcome-suggestions { margin-bottom: 20px; }

.suggestions-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.suggestions-label {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.view-all-link {
    font-size: 14px;
    font-weight: 600;
    color: var(--ios-blue);
}

/* Flex layout — 4 per row naturally, row-2 (3 items) auto-centers */
.quick-search-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.quick-card {
    flex: 0 0 calc(33.333% - 7px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 6px 11px;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
    transition: transform 0.15s ease;
}

.quick-card:active { transform: scale(0.94); }

/* The icon wrapper: ROUNDED SQUARE (iOS app icon style), NOT circle */
.card-icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: 12px; /* Rounded square */
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon { width: 22px; height: 22px; }
.card-icon-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
}

.color-blue   { background: rgba(0, 122, 255, 0.12); color: #007aff; }
.color-orange { background: rgba(255, 149, 0, 0.12); color: #ff9500; }
.color-green  { background: rgba(52, 199, 89, 0.12); color: #34c759; }
.color-pink   { background: rgba(255, 45, 85, 0.12); color: #ff2d55; }
.color-purple { background: rgba(175, 82, 222, 0.12); color: #af52de; }
.color-red    { background: rgba(255, 59, 48, 0.12); color: #ff3b30; }
.color-purple-dark { background: rgba(88, 86, 214, 0.12); color: #5856d6; }

.card-title-punjabi {
    font-family: var(--font-gurmukhi);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.3;
}

/* Row 2 centering: 3 cards centered in 4-col grid.
   We use a hidden spacer as 1st item to push 3 cards to columns 2,3,4 — but that leaves them right-aligned.
   Better: CSS grid-column trick to center 3 of 4 */
.quick-card-spacer {
    /* invisible spacer sits at col 1 in row 2, pushing cards 2,3,4 visually centered */
    visibility: hidden;
    pointer-events: none;
}

/* ─── Action Bars ───────────────────────────────────────────── */
.action-bars-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.action-bar-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
    transition: transform 0.15s ease;
}
.action-bar-item:active { transform: scale(0.97); }

.action-bar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.action-bar-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ios-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.action-bar-icon-circle svg { width: 20px; height: 20px; }

.action-bar-text { text-align: left; }

.action-bar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.action-bar-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.action-bar-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
}

/* ═══════════════════════════════════════════════════════════
   BOTTOM TAB BAR
   ═══════════════════════════════════════════════════════════ */
.gk-bottom-tabbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    height: calc(var(--tab-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 350;
}

.tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    padding: 8px 0;
    color: var(--text-tertiary);
    transition: color 0.2s ease;
}
.tab-btn.active { color: var(--ios-blue); }
.tab-icon { width: 24px; height: 24px; }
.tab-btn span { font-size: 10px; font-weight: 500; }

/* Central raised ੴ tab button */
.tab-crest-btn {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-14px);
    flex-shrink: 0;
}

.crest-gold-frame {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid var(--gold-accent);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}
.crest-gold-frame:active { transform: scale(0.92); }

.crest-symbol {
    font-family: var(--font-gurmukhi);
    font-size: 24px;
    color: var(--gold-accent);
    line-height: 1;
}

/* ═══════════════════════════════════════════════════════════
   RESULTS STATE TRANSITIONS
   ═══════════════════════════════════════════════════════════ */
body.has-results #menuBtn,
body.has-results #notificationBtn,
body.has-results #gkTitle {
    display: none;
}

body.has-results .gk-back-btn {
    display: flex;
}

/* In results: move search bar INTO nav bar */
body.has-results .search-section {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    padding: var(--safe-top) 56px 0;
    height: calc(var(--nav-h) + var(--safe-top));
    display: flex;
    align-items: center;
    z-index: 310;
    background: var(--bg-page);
    pointer-events: none;
}

body.has-results .search-bar-thin {
    pointer-events: auto;
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    box-shadow: none;
    width: 100%;
}

body.has-results .mic-btn-thin,
body.has-results .keyboard-btn-thin {
    display: none;
}

body.has-results .source-filters {
    display: none;
    position: absolute;
    top: calc(var(--nav-h) + var(--safe-top));
    left: 0;
    width: 100%;
    background: var(--bg-page);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    pointer-events: auto;
    z-index: 299;
}

body.has-results .source-filters.visible-search {
    display: flex;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { transform: translateY(-6px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

body.has-results .main-content {
    padding-top: calc(var(--nav-h) + var(--safe-top) + 8px);
}

/* ═══════════════════════════════════════════════════════════
   RESULTS VIEW
   ═══════════════════════════════════════════════════════════ */
.results-view { display: none; }
.results-view.active { display: block; animation: fadeIn 0.25s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Sub tabs */
.results-sub-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 14px;
    margin-top: 4px;
}

.sub-tab {
    flex: 1;
    padding: 10px 4px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s ease, color 0.2s ease;
}


.sub-tab.active {
    color: var(--ios-blue);
    font-weight: 600;
    border-bottom-color: var(--ios-blue);
}

/* Results Found Banner */
.results-info-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(130deg, #0e4a90 0%, #1968c2 100%);
    border-radius: 16px;
    padding: 14px 14px;
    color: #fff;
    margin-bottom: 14px;
    box-shadow: 0 4px 16px rgba(14, 74, 144, 0.25);
    overflow: hidden;
}

.banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.banner-icon-wrapper {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-icon { width: 20px; height: 20px; color: #fff; }
.banner-text { display: flex; flex-direction: column; gap: 2px; }
.banner-title { font-size: 14px; font-weight: 700; }
.banner-subtitle { font-size: 11px; opacity: 0.85; }

.banner-thumbnail {
    width: 72px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    opacity: 0.85;
}

/* Result Cards */
.results-list { display: flex; flex-direction: column; gap: 12px; }

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 14px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: cardIn 0.3s ease backwards;
    transition: transform 0.15s ease;
}
.result-card:active { transform: scale(0.98); }

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

.result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.result-gurmukhi-title {
    font-family: var(--font-gurmukhi);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    margin-right: 8px;
}

.result-bookmark-btn {
    color: var(--text-tertiary);
    transition: color 0.2s ease;
    padding: 2px;
}
.result-bookmark-btn.active { color: var(--ios-blue); }
.result-bookmark-btn svg { width: 18px; height: 18px; }

.result-gurmukhi {
    font-family: var(--font-gurmukhi);
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    word-break: break-word;
}

.search-highlight, mark {
    background: #ffe082 !important;
    color: #1a1a1a !important;
    font-weight: 700 !important;
    border-radius: 4px;
    padding: 1px 4px;
    display: inline-block;
}

/* Dark mode: high contrast bright gold background with solid black text */
[data-theme="dark"] .search-highlight,
[data-theme="dark"] mark {
    background: #ffd54f !important;
    color: #000000 !important;
    font-weight: 700 !important;
    border-radius: 4px;
    padding: 1px 4px;
    display: inline-block;
    box-shadow: 0 0 10px rgba(255, 213, 79, 0.4);
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.result-source-text { font-weight: 500; }
.result-meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-tertiary); }

.load-more {
    display: none;
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    border-radius: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--ios-blue);
    font-size: 15px;
    font-weight: 600;
    box-shadow: var(--shadow-soft);
}
.load-more.visible { display: block; }

/* ═══════════════════════════════════════════════════════════
   LOADING / EMPTY STATES
   ═══════════════════════════════════════════════════════════ */
.loading-state, .empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}
.loading-state.active, .empty-state.active { display: flex; }

.loader {
    width: 60px;
    height: 60px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.loader-ring {
    position: absolute;
    inset: 0;
    border: 3px solid rgba(0,0,0,0.06);
    border-top-color: var(--ios-blue);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader-icon {
    font-family: var(--font-gurmukhi);
    font-size: 22px;
    color: var(--gold-accent);
}

.loading-state p { font-size: 14px; color: var(--text-secondary); }
.empty-icon { font-size: 44px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════════════
   SPEAK TO SEARCH PANEL — EXACT REFERENCE MATCH
   ═══════════════════════════════════════════════════════════ */
.voice-panel {
    position: fixed;
    inset: 0;
    z-index: 500;
    /* Exact warm cream background matching home page */
    background: #f5f1eb;
    display: none;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

.voice-panel.active {
    display: flex;
    animation: vpSlideUp 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes vpSlideUp {
    from { transform: translateY(100%); opacity: 0.6; }
    to { transform: translateY(0); opacity: 1; }
}

/* Header row with back, title, settings */
.voice-header {
    width: 100%;
    max-width: 430px;
    padding: calc(var(--safe-top) + 10px) 16px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 20;
}

.voice-back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}
.voice-back-btn svg { width: 18px; height: 18px; }

.voice-settings-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}
.voice-settings-btn svg { width: 20px; height: 20px; }

.voice-header-title {
    text-align: center;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.voice-header-subtitle {
    font-family: var(--font-gurmukhi);
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ═══ ARCH DOME — The main visual of voice page ═══════════════
   Full-screen arch drawn with CSS/SVG, just like the reference:
  • Outer arch outline (off-white cream rounded frame)
  • Inner secondary arch line (dashed lighter)
  • Two hanging lanterns from top corners of arch
   ═══════════════════════════════════════════════════════════ */
.voice-arch-decor {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    overflow: visible;
}

/* Main arch SVG — positioned to take up most of voice panel */
.voice-arch-main-svg {
    position: absolute;
    /* Start below the header */
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    width: 96%;
    max-width: 400px;
    height: auto;
    opacity: 0.9;
}

/* Lanterns hang from upper area of the panel */
.hanging-lantern {
    position: absolute;
    top: 95px; /* Just below header */
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.lantern-left { left: 2%; }
.lantern-right { right: 2%; }

.lantern-svg { width: 38px; height: 100px; }

/* ─── Mic Trigger Area (inside arch) ─────────────────────── */
.voice-mic-section {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    margin-top: 0;
}

.voice-mic-container {
    width: 148px;
    height: 148px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main mic circle: Beige/cream background like reference (NOT white) */
.voice-mic {
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background: #eedcc0; /* Warm beige cream from reference */
    border: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c8961a; /* Gold/amber mic color */
    z-index: 10;
    position: relative;
}

.voice-mic svg { width: 42px; height: 42px; }

/* Blue dashed spinning ring — absolute inside container */
.voice-mic-dashed-ring {
    position: absolute;
    width: 132px;
    height: 132px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px dashed rgba(0, 122, 255, 0.7);
    animation: ringRotate 15s linear infinite;
    z-index: 8;
}

@keyframes ringRotate { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* Soft pulse glow — absolute inside container */
.voice-mic-pulse {
    position: absolute;
    width: 160px;
    height: 160px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 122, 255, 0.08) 0%, transparent 70%);
    animation: micGlow 2s ease-in-out infinite alternate;
    z-index: 6;
}

@keyframes micGlow {
    from { transform: translate(-50%, -50%) scale(0.9); opacity: 0.6; }
    to { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

/* ─── Status Text ─────────────────────────────────────────── */
.voice-status-section {
    text-align: center;
    padding: 0 28px;
    z-index: 10;
    position: relative;
    margin-bottom: 22px;
}

.voice-status {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.voice-hint {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.voice-transcript-preview {
    font-family: var(--font-gurmukhi);
    font-size: 18px;
    font-weight: 600;
    color: var(--ios-blue);
    margin-top: 12px;
    min-height: 28px;
}

/* ─── Waveform visualizer ─────────────────────────────────── */
.voice-visualizer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 42px;
    margin-bottom: 20px;
    z-index: 10;
    position: relative;
}

.wave-bar {
    width: 3px;
    background: linear-gradient(to top, var(--ios-blue) 0%, #af52de 100%);
    border-radius: 4px;
    animation: wavePulse 1.1s ease-in-out infinite alternate;
    animation-delay: var(--delay);
}

@keyframes wavePulse {
    0% { height: 5px; opacity: 0.6; }
    100% { height: 34px; opacity: 1; }
}

/* ─── Example pill ─────────────────────────────────────────── */
.voice-example-pill {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 13px;
    z-index: 10;
    position: relative;
    margin-bottom: 32px;
}

.example-label { color: var(--text-secondary); }

.example-text {
    font-family: var(--font-gurmukhi);
    color: var(--text-primary);
    font-weight: 600;
    margin-left: 4px;
}

/* ─── Close / Cancel X button ─────────────────────────────── */
.voice-close-circle-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-card);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    z-index: 10;
    position: relative;
    margin-bottom: calc(var(--safe-bottom) + 10px);
}

.voice-close-circle-btn svg { width: 22px; height: 22px; }

/* ═══════════════════════════════════════════════════════════
   GURMUKHI KEYBOARD
   ═══════════════════════════════════════════════════════════ */
.keyboard-overlay {
    position: fixed;
    inset: 0;
    z-index: 600;
    display: none;
}

.keyboard-overlay.active {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.keyboard-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.2);
}

.keyboard-sheet {
    position: relative;
    background: #d1d3d8;
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
    padding: 6px 4px calc(8px + var(--safe-bottom));
    box-shadow: 0 -8px 24px rgba(0,0,0,0.12);
    z-index: 10;
    animation: kbSlideUp 0.22s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes kbSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.keyboard-header {
    padding: 4px 8px 8px;
    display: flex;
    justify-content: center;
}

.keyboard-preview-area {
    font-family: var(--font-gurmukhi);
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(255,255,255,0.6);
    border-radius: 8px;
    width: 100%;
    text-align: center;
    min-height: 36px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keyboard-body { display: flex; flex-direction: column; gap: 6px; }

.kb-row { display: flex; justify-content: center; gap: 4px; }

.kb-key {
    flex: 1;
    height: 44px;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.25);
    font-family: var(--font-gurmukhi);
    font-size: 18px;
    font-weight: 500;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}
.kb-key:active, .kb-key.pressed { background: #aeaeb2; }
.kb-key.action { background: #aeaeb2; }
.kb-key.space-key { flex: 4; font-family: var(--font-ui); font-size: 14px; }
.kb-key.backspace-key { flex: 1.5; }
.kb-key.search-action { flex: 1.5; background: var(--ios-blue); color: #fff; }

/* ═══════════════════════════════════════════════════════════
   HISTORY / KIRTAN OVERLAYS
   ═══════════════════════════════════════════════════════════ */
.history-overlay {
    position: fixed;
    inset: 0;
    z-index: 700;
}

.history-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
}

.history-sheet {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    background: var(--bg-card);
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
    padding: 20px;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.1);
    z-index: 10;
}

.sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border-input);
    border-radius: 2px;
    margin: 0 auto 16px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.history-title-modal { font-size: 17px; font-weight: 700; }
.history-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.history-empty {
    text-align: center;
    padding: 40px 0;
    color: var(--text-secondary);
}

.history-clear-all {
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    border-radius: 12px;
    color: #ff3b30;
    font-weight: 600;
    font-size: 15px;
    border: 1px solid rgba(255,59,48,0.15);
}

.live-kirtan-overlay {
    position: fixed;
    inset: 0;
    z-index: 700;
    display: none;
}

.live-kirtan-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
}

.live-kirtan-panel {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    background: var(--bg-card);
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
    padding: 20px;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.12);
    z-index: 10;
}

.live-kirtan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.live-kirtan-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════ */
.toast {
    position: fixed;
    bottom: calc(var(--tab-h) + var(--safe-bottom) + 16px);
    left: 50%;
    transform: translate(-50%, 20px);
    background: rgba(30,30,30,0.88);
    color: #fff;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), visibility 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ═══════════════════════════════════════════════════════════
   KEY PREVIEW BUBBLE
   ═══════════════════════════════════════════════════════════ */
@keyframes kbPreviewPop {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Legacy compatibility */
.guru-bg-container { display: none !important; }

/* Theme Toggle Sun/Moon Icon Visibility */
.theme-toggle .sun-icon {
    display: block;
}
.theme-toggle .moon-icon {
    display: none;
}
[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}
[data-theme="dark"] .theme-toggle .moon-icon {
    display: block;
}

/* Welcome screen horizontal scrolling sections */
.welcome-section {
    margin-top: 10px;
    margin-bottom: 24px;
    padding: 0 20px;
}
.welcome-section .suggestions-header-row {
    padding: 0;
    margin-bottom: 12px;
}
.horizontal-scroll-list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 4px 12px 4px;
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Hide scrollbar for clean iOS look */
}
.horizontal-scroll-list::-webkit-scrollbar {
    display: none;
}
.scroll-card {
    flex: 0 0 240px;
    scroll-snap-align: start;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.scroll-card:active {
    transform: scale(0.96);
}
.scroll-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.scroll-card-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #c8a96a; /* Gold tint */
}
.scroll-card-source {
    font-size: 11px;
    color: var(--text-secondary);
}
.scroll-card-text {
    font-family: var(--font-gurmukhi);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.scroll-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-secondary);
}


.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════
   PREMIUM THEME TOGGLE ANIMATION
   ═══════════════════════════════════════════════════════════ */
.theme-toggle {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.3s ease;
}
.theme-toggle svg {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}
.theme-toggle .sun-icon {
    transform: rotate(0deg) scale(1);
    opacity: 1;
    color: #ff9500;
}
.theme-toggle .moon-icon {
    transform: rotate(-90deg) scale(0);
    opacity: 0;
    color: #a2a2d0;
    position: absolute;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    transform: rotate(90deg) scale(0);
    opacity: 0;
}
[data-theme="dark"] .theme-toggle .moon-icon {
    transform: rotate(0deg) scale(1);
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════
   DAILY RARE SUGGESTIONS OVERLAY STYLES
   ═══════════════════════════════════════════════════════════ */
.daily-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.daily-suggest-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.2s ease;
}

.daily-suggest-card:active {
    transform: scale(0.97);
}

.daily-suggest-card.today-card {
    border: 1.5px solid #c8a96a; /* Gold highlight for today */
    background: linear-gradient(to bottom, var(--bg-card), var(--bg-page-secondary, rgba(200, 169, 106, 0.03)));
}

.daily-suggest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.daily-suggest-date {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #c8a96a;
}

.daily-suggest-card.today-card .daily-suggest-date {
    color: #ff9500;
}

.daily-suggest-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    background: var(--border-light);
    color: var(--text-secondary);
}

.daily-suggest-card.today-card .daily-suggest-badge {
    background: rgba(200, 169, 106, 0.15);
    color: #c8a96a;
}

.daily-suggest-text {
    font-family: var(--font-gurmukhi);
    font-size: 17px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.45;
}

.daily-suggest-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-light);
    padding-top: 8px;
}

.daily-suggest-writer {
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════
   RAAG SELECTION GRID & DETAILS OVERLAY
   ═══════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════
   RAAG FULL-SCREEN PAGE  (replaces bottom-sheet popup)
═══════════════════════════════════════════════════════════ */

.raag-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
    overflow: hidden;
}

.raag-fullscreen.raag-open {
    transform: translateX(0);
}

/* Each view is a flex column that fills the screen */
.raag-fs-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: absolute;
    inset: 0;
    background: var(--bg-primary);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s ease;
}

.raag-fs-detail {
    transform: translateX(100%);
}
.raag-fs-detail.detail-open {
    transform: translateX(0);
}

/* ─── Header ─── */
.raag-fs-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px calc(14px + env(safe-area-inset-top, 0px));
    padding-top: calc(env(safe-area-inset-top, 14px) + 14px);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    min-height: 62px;
}

.raag-fs-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    cursor: pointer;
    color: var(--text-primary);
    flex-shrink: 0;
    transition: background 0.15s;
}
.raag-fs-back:active { background: var(--border-light); }
.raag-fs-back svg { width: 18px; height: 18px; }

.raag-fs-header-text { flex: 1; min-width: 0; }

.raag-fs-title {
    font-family: var(--font-gurmukhi);
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.raag-fs-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    display: block;
    margin-top: 2px;
}

/* Description banner */
.raag-detail-info-banner {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
    padding: 10px 20px 6px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, rgba(255,249,196,0.12) 0%, transparent 100%);
}
[data-theme="dark"] .raag-detail-info-banner {
    background: linear-gradient(135deg, rgba(200,169,106,0.08) 0%, transparent 100%);
}

/* ─── Scrollable content area ─── */
.raag-fs-content {
    flex: 1;
    overflow-y: auto;

    padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px));
}

/* ─── Raag Grid (2 column) ─── */
.raag-fs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.raag-list-item {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-align: left;
}
.raag-list-item:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.raag-list-name-pa {
    font-family: var(--font-gurmukhi);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.raag-list-name-en {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 1px;
}
.raag-list-shabads {
    font-size: 11px;
    color: #c8a96a;
    font-weight: 700;
    margin-top: 4px;
}
.raag-list-time {
    font-size: 10px;
    color: var(--text-tertiary);
}

/* ─── Shabad groups inside raag detail ─── */
.raag-detail-groups {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.raag-group-section { display: flex; flex-direction: column; }

.raag-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0 10px;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 12px;
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 2;
}

.raag-group-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2.5px solid rgba(200,169,106,0.5);
    flex-shrink: 0;
    background: linear-gradient(135deg, #f5f1eb, #e8d4a0);
}

.raag-group-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5f1eb, #e8d4a0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-gurmukhi);
    font-size: 22px;
    color: #c8a96a;
    flex-shrink: 0;
    border: 2.5px solid rgba(200,169,106,0.3);
}

.raag-group-info { flex: 1; min-width: 0; }
.raag-group-name-pa {
    font-family: var(--font-gurmukhi);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.raag-group-name-en {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.raag-group-count {
    font-size: 12px;
    font-weight: 700;
    color: #c8a96a;
    background: rgba(200,169,106,0.1);
    border-radius: 20px;
    padding: 3px 10px;
    flex-shrink: 0;
}

/* Shabad cards — ONE per shabad */
.raag-shabad-cards { display: flex; flex-direction: column; gap: 10px; }

.raag-shabad-card {
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    overflow: hidden;
}
.raag-shabad-card:active {
    transform: scale(0.97);
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}
.raag-shabad-card::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-right: 2px solid rgba(200,169,106,0.6);
    border-top: 2px solid rgba(200,169,106,0.6);
    transform: translateY(-50%) rotate(45deg);
}

.raag-shabad-text {
    font-family: var(--font-gurmukhi);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.5;
    padding-right: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.raag-shabad-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}
.raag-shabad-ang {
    font-weight: 700;
    color: #c8a96a;
    background: rgba(200,169,106,0.12);
    border-radius: 6px;
    padding: 2px 8px;
}
.raag-shabad-line-count {
    color: var(--text-tertiary);
}

/* Pastel gradients for shabad cards */
.pastel-gradient-1 {
    background: linear-gradient(135deg, rgba(255,249,196,0.55) 0%, rgba(255,255,255,0.98) 100%);
    border: 1px solid rgba(255,235,59,0.25);
}
.pastel-gradient-2 {
    background: linear-gradient(135deg, rgba(200,230,201,0.55) 0%, rgba(255,255,255,0.98) 100%);
    border: 1px solid rgba(76,175,80,0.22);
}
.pastel-gradient-3 {
    background: linear-gradient(135deg, rgba(187,222,251,0.55) 0%, rgba(255,255,255,0.98) 100%);
    border: 1px solid rgba(33,150,243,0.22);
}
.pastel-gradient-4 {
    background: linear-gradient(135deg, rgba(248,187,208,0.55) 0%, rgba(255,255,255,0.98) 100%);
    border: 1px solid rgba(233,30,99,0.22);
}
.pastel-gradient-5 {
    background: linear-gradient(135deg, rgba(225,190,231,0.55) 0%, rgba(255,255,255,0.98) 100%);
    border: 1px solid rgba(156,39,176,0.22);
}
[data-theme="dark"] .pastel-gradient-1,
[data-theme="dark"] .pastel-gradient-2,
[data-theme="dark"] .pastel-gradient-3,
[data-theme="dark"] .pastel-gradient-4,
[data-theme="dark"] .pastel-gradient-5 {
    background: linear-gradient(135deg, rgba(30,28,40,0.98) 0%, rgba(20,18,28,1) 100%);
    border: 1px solid rgba(255,255,255,0.07);
}


.raag-list-item {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.raag-list-item:active {
    transform: scale(0.96);
}

.raag-list-name-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.raag-list-name-pa {
    font-family: var(--font-gurmukhi);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.raag-list-name-en {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

.raag-list-shabads {
    font-size: 11px;
    color: #c8a96a;
    font-weight: 600;
}

.raag-list-time {
    font-size: 10px;
    color: var(--text-tertiary);
}

/* Raag Details View styling */
.raag-detail-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: slideInLeft 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideInLeft {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.raag-detail-header-row {
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 12px;
}

.raag-detail-back {
    display: flex;
    align-items: center;
    background: var(--border-light);
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}

.raag-detail-title-main {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.raag-detail-info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px 14px;
}

.raag-detail-meta {
    font-size: 12px;
    font-weight: 600;
    color: #c8a96a;
    margin-bottom: 4px;
}

.raag-detail-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Grouped Shabads list in Raag Details */
.raag-detail-shabads {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 8px;
}

.raag-group-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.raag-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 12px 0 8px;
    border-bottom: 1px solid var(--border-light);
}

.raag-group-header + .raag-shabad-card {
    margin-top: 4px;
}

.raag-group-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.raag-shabad-card {
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    transition: transform 0.15s ease;
}

.raag-shabad-card:active {
    transform: scale(0.97);
}

/* Light pastel gradient classes */
.pastel-gradient-1 {
    background: linear-gradient(135deg, rgba(255,249,196,0.22) 0%, rgba(255,255,255,0.95) 100%);
    border: 1px solid rgba(255, 235, 59, 0.18);
}
.pastel-gradient-2 {
    background: linear-gradient(135deg, rgba(200,230,201,0.22) 0%, rgba(255,255,255,0.95) 100%);
    border: 1px solid rgba(76, 175, 80, 0.18);
}
.pastel-gradient-3 {
    background: linear-gradient(135deg, rgba(187,222,251,0.22) 0%, rgba(255,255,255,0.95) 100%);
    border: 1px solid rgba(33, 150, 243, 0.18);
}
.pastel-gradient-4 {
    background: linear-gradient(135deg, rgba(248,187,208,0.22) 0%, rgba(255,255,255,0.95) 100%);
    border: 1px solid rgba(233, 30, 99, 0.18);
}
.pastel-gradient-5 {
    background: linear-gradient(135deg, rgba(225,190,231,0.22) 0%, rgba(255,255,255,0.95) 100%);
    border: 1px solid rgba(156, 39, 176, 0.18);
}

[data-theme="dark"] .pastel-gradient-1,
[data-theme="dark"] .pastel-gradient-2,
[data-theme="dark"] .pastel-gradient-3,
[data-theme="dark"] .pastel-gradient-4,
[data-theme="dark"] .pastel-gradient-5 {
    background: linear-gradient(135deg, rgba(25, 25, 35, 0.95) 0%, rgba(15, 15, 22, 0.98) 100%);
    border: 1px solid rgba(255,255,255,0.06);
}

.raag-shabad-text {
    font-family: var(--font-gurmukhi);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.raag-shabad-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-secondary);
}

.raag-shabad-ang {
    font-weight: 600;
    color: #c8a96a;
}


/* -----------------------------------------------------------
   MAGIC OFFLINE DOWNLOAD BUTTON
----------------------------------------------------------- */

.offline-magic-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px 8px;
    gap: 8px;
}

.offline-magic-btn {
    position: relative;
    width: 88px;
    height: 88px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
.offline-magic-btn:active { transform: scale(0.93); transition: transform 0.1s; }

/* The SVG ring is absolutely positioned behind the inner content */
.offline-ring-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* start from top */
}

.offline-ring-bg {
    fill: none;
    stroke: var(--border-light);
    stroke-width: 7;
}

.offline-ring-track {
    fill: none;
    stroke: url(#offlineRingGrad);
    stroke-width: 7;
    stroke-linecap: round;
    stroke-dasharray: 326.7; /* 2p  52 */
    stroke-dashoffset: 326.7; /* fully hidden = 0% */
    transition: stroke-dashoffset 0.4s ease, stroke 0.3s ease;
}

/* Inner button content */
.offline-btn-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg-card);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1.5px solid var(--border-light);
    color: var(--text-primary);
    gap: 2px;
}

.offline-pct-text {
    font-size: 16px;
    font-weight: 800;
    color: #c8a96a;
    font-variant-numeric: tabular-nums;
}

/* Done state ring glow */
.offline-magic-btn.offline-done .offline-ring-track {
    stroke: #4caf50;
    filter: drop-shadow(0 0 4px rgba(76, 175, 80, 0.5));
}
.offline-magic-btn.offline-done .offline-btn-inner {
    border-color: rgba(76, 175, 80, 0.3);
    background: linear-gradient(135deg, rgba(76,175,80,0.06), var(--bg-card));
}

/* Downloading state - animated shimmer on ring */
.offline-magic-btn.offline-busy .offline-ring-track {
    stroke: #c8a96a;
    filter: drop-shadow(0 0 3px rgba(200,169,106,0.4));
}

.offline-magic-label {
    font-family: var(--font-gurmukhi);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

.offline-magic-sub {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 500;
}

/* -----------------------------------------------------------
   OFFLINE CREST BUTTON (replaces ? in nav bar)
----------------------------------------------------------- */
.offline-crest-btn {
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    position: relative;
}

.crest-ring-svg {
    position: absolute;
    inset: -3px;
    width: calc(100% + 6px);
    height: calc(100% + 6px);
    transform: rotate(-90deg);
    pointer-events: none;
}

.crest-ring-bg {
    fill: none;
    stroke: rgba(200,169,106,0.18);
    stroke-width: 4;
}

.crest-ring-track {
    fill: none;
    stroke: url(#crestGrad);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 163.4;    /* 2p  26 */
    stroke-dashoffset: 163.4;   /* 0% filled */
    transition: stroke-dashoffset 0.5s ease;
}

.crest-inner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1.5px solid var(--gold-accent);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.crest-idle {
    font-family: var(--font-gurmukhi);
    font-size: 22px;
    color: var(--gold-accent);
    line-height: 1;
}

.crest-pct {
    font-size: 13px;
    font-weight: 800;
    color: #c8a96a;
    font-variant-numeric: tabular-nums;
}

.crest-check {
    width: 22px;
    height: 22px;
}

/* Done state */
.offline-crest-btn.crest-done .crest-inner {
    border-color: #4caf50;
    box-shadow: 0 0 10px rgba(76,175,80,0.25), 0 4px 12px rgba(0,0,0,0.08);
}
.offline-crest-btn.crest-done .crest-ring-track {
    stroke: #4caf50;
    filter: drop-shadow(0 0 3px rgba(76,175,80,0.4));
}

/* Busy state pulse */
.offline-crest-btn.crest-busy .crest-inner {
    border-color: #c8a96a;
    animation: crest-pulse 1.5s ease-in-out infinite;
}
@keyframes crest-pulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(200,169,106,0.3), 0 4px 12px rgba(0,0,0,0.08); }
    50%      { box-shadow: 0 0 0 6px rgba(200,169,106,0), 0 4px 12px rgba(0,0,0,0.08); }
}

/* -----------------------------------------------------------
   OFFLINE STATUS SHEET (long-press popup)
----------------------------------------------------------- */
.offline-status-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.offline-status-backdrop.sheet-open {
    opacity: 1;
    pointer-events: auto;
}

.offline-status-sheet {
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    z-index: 3001;
    background: var(--bg-primary);
    border-radius: 24px 24px 0 0;
    padding: 0 0 calc(env(safe-area-inset-bottom) + 16px);
    transform: translateY(100%);
    transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.18);
}
.offline-status-sheet.sheet-open {
    transform: translateY(0);
}

.offline-status-handle {
    width: 40px; height: 4px;
    background: var(--border-light);
    border-radius: 99px;
    margin: 12px auto 8px;
}

.offline-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 20px 12px;
}
.offline-status-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 15px; font-weight: 700;
    color: var(--text-primary);
}
.offline-status-close {
    border: none; background: none;
    font-size: 16px; color: var(--text-secondary);
    cursor: pointer; padding: 4px 8px;
    border-radius: 8px;
}

/* Big ring in status sheet */
.offline-status-ring-wrap {
    position: relative;
    width: 140px; height: 140px;
    margin: 8px auto 16px;
}
.offline-status-ring-svg {
    width: 100%; height: 100%;
    transform: rotate(-90deg);
}
.osr-bg    { fill: none; stroke: var(--border-light); stroke-width: 10; }
.osr-track {
    fill: none;
    stroke: url(#osrGrad);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 364.4;    /* 2p  58 */
    stroke-dashoffset: 364.4;
    transition: stroke-dashoffset 0.6s ease;
}
.offline-status-ring-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}
.osr-pct-big {
    font-size: 26px;
    font-weight: 900;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.osr-sub {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
    padding: 0 8px;
}

/* Stats grid */
.offline-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 0 16px 16px;
}
.offline-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 10px 4px;
    display: flex; flex-direction: column;
    align-items: center; gap: 4px;
}
.osc-value {
    font-size: 15px; font-weight: 800;
    color: #c8a96a;
}
.osc-label {
    font-size: 9px; font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-align: center;
}

/* Action buttons */
.offline-status-actions {
    display: flex; gap: 10px;
    padding: 0 16px;
}
.offline-action-download {
    flex: 1;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    background: linear-gradient(135deg, #c8a96a, #e0c070);
    color: #fff;
    border: none; border-radius: 14px;
    padding: 14px;
    font-size: 14px; font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(200,169,106,0.35);
    transition: transform 0.15s, opacity 0.15s;
}
.offline-action-download:active { transform: scale(0.97); opacity: 0.9; }
.offline-action-clear {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 14px 18px;
    font-size: 13px; font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s;
}
.offline-action-clear:active { background: var(--border-light); }
/* --- Two-Stage Loading & Load More CSS --- */
.raag-preview-loading {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
}
.shabad-card-skeleton {
    background: var(--surface-card);
    border-radius: 12px;
    padding: 16px;
    height: 70px;
    animation: skeleton-pulse 1.5s infinite ease-in-out;
}
.skel-line {
    background: var(--border-light);
    border-radius: 4px;
    height: 12px;
    margin-bottom: 8px;
}
.skel-line-long { width: 85%; }
.skel-line-short { width: 40%; height: 10px; opacity: 0.7; }
@keyframes skeleton-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.9; }
    100% { opacity: 0.6; }
}
.raag-load-more-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.raag-load-more-btn:active {
    background: var(--border-light);
    transform: scale(0.98);
}

/* -----------------------------------------------------------
   OFFLINE PROGRESS BOTTOM SHEET
----------------------------------------------------------- */
.offline-progress-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.offline-progress-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.offline-progress-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-radius: 24px 24px 0 0;
    z-index: 10001;
    padding: 16px 24px 32px;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.offline-progress-sheet.show {
    transform: translateY(0);
}

.offline-progress-header {
    text-align: center;
    margin-bottom: 24px;
}
.offline-progress-header h2 {
    font-family: var(--font-english);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}
.offline-progress-header p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.offline-progress-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.progress-source {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.progress-source-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ps-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.ps-status {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.progress-source.active .ps-status {
    color: #c8a96a;
}
.progress-source.done .ps-status {
    color: #4caf50;
}

.ps-bar-bg {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}
.ps-bar-fill {
    height: 100%;
    background: #c8a96a;
    width: 0%;
    border-radius: 4px;
    transition: width 0.3s linear;
}
.progress-source.done .ps-bar-fill {
    background: #4caf50;
}

.offline-stats {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 12px;
    font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════
   DARK MODE OVERRIDES FOR QUICK SEARCH CARDS
   ═══════════════════════════════════════════════════════════ */
[data-theme="dark"] .quick-card,
html.dark .quick-card,
body.dark-mode .quick-card,
html[data-theme="dark"] .quick-card {
    background: #1C1C1E !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .card-title-punjabi,
html.dark .card-title-punjabi,
body.dark-mode .card-title-punjabi,
html[data-theme="dark"] .card-title-punjabi {
    color: #F2F2F7 !important;
}

[data-theme="dark"] .quick-card--gold,
body.dark-mode .quick-card--gold,
html.dark .quick-card--gold {
    background: linear-gradient(140deg, #2A2215 0%, #201A10 100%) !important;
    border-color: rgba(212, 148, 58, 0.3) !important;
}

[data-theme="dark"] .quick-card--green,
body.dark-mode .quick-card--green,
html.dark .quick-card--green {
    background: linear-gradient(140deg, #0C2616 0%, #081B0E 100%) !important;
    border-color: rgba(48, 209, 88, 0.3) !important;
}

[data-theme="dark"] .quick-card--purple,
body.dark-mode .quick-card--purple,
html.dark .quick-card--purple {
    background: linear-gradient(140deg, #1D1C2E 0%, #151422 100%) !important;
    border-color: rgba(88, 86, 214, 0.3) !important;
}

[data-theme="dark"] .quick-card--blue,
body.dark-mode .quick-card--blue,
html.dark .quick-card--blue {
    background: linear-gradient(140deg, #0C1D2C 0%, #081420 100%) !important;
    border-color: rgba(0, 122, 255, 0.3) !important;
}

[data-theme="dark"] .quick-card--rose,
body.dark-mode .quick-card--rose,
html.dark .quick-card--rose {
    background: linear-gradient(140deg, #2C1515 0%, #200E0E 100%) !important;
    border-color: rgba(255, 107, 107, 0.3) !important;
}
