/* ===== CSS Variables & Themes (tweakCN-style) ===== */
:root {
    /* ===== tweakCN-style Theme Variables (Dark Mode Default) ===== */
    --background: oklch(0.145 0 0);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.18 0.005 285);
    --card-foreground: oklch(0.985 0 0);
    --popover: oklch(0.18 0.005 285);
    --popover-foreground: oklch(0.985 0 0);
    --primary: oklch(0.75 0.15 85);
    --primary-foreground: oklch(0.145 0 0);
    --secondary: oklch(0.25 0.01 285);
    --secondary-foreground: oklch(0.985 0 0);
    --muted: oklch(0.25 0.01 285);
    --muted-foreground: oklch(0.65 0 0);
    --accent: oklch(0.75 0.15 85);
    --accent-foreground: oklch(0.145 0 0);
    --destructive: oklch(0.577 0.245 27.325);
    --destructive-foreground: oklch(1 0 0);
    --border: oklch(0.3 0.01 285);
    --input: oklch(0.3 0.01 285);
    --ring: oklch(0.75 0.15 85);

    /* Legacy variable mappings for compatibility */
    --bg-primary: var(--background);
    --bg-secondary: var(--card);
    --bg-card: var(--card);
    --bg-hover: oklch(0.22 0.01 285);
    --text-primary: var(--foreground);
    --text-secondary: var(--muted-foreground);
    --text-muted: oklch(0.5 0 0);
    --border-color: var(--border);
    --accent-primary: var(--accent);
    --accent-secondary: oklch(0.6 0.12 85);
    --accent-glow: oklch(0.75 0.15 85 / 0.3);

    /* Religion-specific colors (oklch) */
    --islam-primary: oklch(0.6 0.15 160);
    --islam-secondary: oklch(0.45 0.12 160);
    --christianity-primary: oklch(0.6 0.12 260);
    --christianity-secondary: oklch(0.5 0.1 260);
    --hinduism-primary: oklch(0.7 0.18 50);
    --hinduism-secondary: oklch(0.55 0.15 50);
    --judaism-primary: oklch(0.65 0.15 240);
    --judaism-secondary: oklch(0.55 0.12 240);
    --sikhism-primary: oklch(0.75 0.18 80);
    --sikhism-secondary: oklch(0.6 0.15 80);
    --buddhism-primary: oklch(0.6 0.15 300);
    --buddhism-secondary: oklch(0.5 0.12 300);

    /* Shadows */
    --shadow-sm: 0 2px 8px oklch(0 0 0 / 0.3);
    --shadow-md: 0 4px 20px oklch(0 0 0 / 0.4);
    --shadow-lg: 0 8px 40px oklch(0 0 0 / 0.5);
    --shadow-glow: 0 0 40px var(--accent-glow);

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-arabic: 'Amiri', 'Traditional Arabic', serif;
    --font-hebrew: 'Frank Ruhl Libre', 'David', serif;
    --font-devanagari: 'Noto Sans Devanagari', sans-serif;
    --font-gurmukhi: 'Noto Sans Gurmukhi', sans-serif;
    --font-pali: 'Noto Serif', serif;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;
}

/* ===== Light Theme (tweakCN-style) ===== */
[data-theme="light"] {
    --background: oklch(0.985 0 0);
    --foreground: oklch(0.145 0 0);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.145 0 0);
    --popover: oklch(1 0 0);
    --popover-foreground: oklch(0.145 0 0);
    --primary: oklch(0.55 0.15 85);
    --primary-foreground: oklch(1 0 0);
    --secondary: oklch(0.95 0.01 285);
    --secondary-foreground: oklch(0.145 0 0);
    --muted: oklch(0.95 0.01 285);
    --muted-foreground: oklch(0.45 0 0);
    --accent: oklch(0.55 0.15 85);
    --accent-foreground: oklch(1 0 0);
    --destructive: oklch(0.577 0.245 27.325);
    --destructive-foreground: oklch(1 0 0);
    --border: oklch(0.87 0.01 285);
    --input: oklch(0.87 0.01 285);
    --ring: oklch(0.55 0.15 85);

    /* Legacy variable mappings */
    --bg-primary: var(--background);
    --bg-secondary: var(--card);
    --bg-card: var(--card);
    --bg-hover: oklch(0.93 0.01 285);
    --text-primary: var(--foreground);
    --text-secondary: var(--muted-foreground);
    --text-muted: oklch(0.55 0 0);
    --border-color: var(--border);
    --accent-primary: var(--accent);
    --accent-secondary: oklch(0.45 0.12 85);
    --accent-glow: oklch(0.55 0.15 85 / 0.2);

    /* Light shadows */
    --shadow-sm: 0 2px 8px oklch(0 0 0 / 0.06);
    --shadow-md: 0 4px 20px oklch(0 0 0 / 0.08);
    --shadow-lg: 0 8px 40px oklch(0 0 0 / 0.12);
    --shadow-glow: 0 0 40px oklch(0.55 0.15 85 / 0.15);
}

/* ===== CSS Reset ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ===== Typography ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: 1rem;
}

h6 {
    font-size: 0.875rem;
}

p {
    color: var(--text-secondary);
    line-height: 1.7;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-secondary);
}

/* ===== Multi-Script Typography ===== */
.text-arabic {
    font-family: var(--font-arabic);
    direction: rtl;
    text-align: right;
    line-height: 2.2;
    font-size: 1.8rem;
}

.text-hebrew {
    font-family: var(--font-hebrew);
    direction: rtl;
    text-align: right;
    line-height: 2;
    font-size: 1.6rem;
}

.text-devanagari {
    font-family: var(--font-devanagari);
    line-height: 2;
    font-size: 1.5rem;
}

.text-gurmukhi {
    font-family: var(--font-gurmukhi);
    line-height: 2;
    font-size: 1.5rem;
}

.text-pali {
    font-family: var(--font-pali);
    font-style: italic;
    line-height: 1.8;
    font-size: 1.2rem;
}

/* ===== Layout Utilities ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-sm {
    max-width: 800px;
}

.container-lg {
    max-width: 1400px;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.gap-lg {
    gap: var(--space-lg);
}

.gap-xl {
    gap: var(--space-xl);
}

.grid {
    display: grid;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* ===== Card Component ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: var(--space-xl);
    transition: all var(--transition-normal);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.card-glass {
    background: rgba(26, 26, 36, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

[data-theme="light"] .card-glass {
    background: rgba(255, 255, 255, 0.8);
}

/* ===== Button Component ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--bg-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-full);
}

/* ===== Religion Cards ===== */
.religion-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    text-align: center;
    padding: var(--space-2xl);
}

.religion-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--religion-color, var(--accent-primary)), transparent);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.religion-card:hover::before {
    opacity: 1;
}

.religion-card[data-religion="islam"] {
    --religion-color: var(--islam-primary);
}

.religion-card[data-religion="christianity"] {
    --religion-color: var(--christianity-primary);
}

.religion-card[data-religion="hinduism"] {
    --religion-color: var(--hinduism-primary);
}

.religion-card[data-religion="judaism"] {
    --religion-color: var(--judaism-primary);
}

.religion-card[data-religion="sikhism"] {
    --religion-color: var(--sikhism-primary);
}

.religion-card[data-religion="buddhism"] {
    --religion-color: var(--buddhism-primary);
}

.religion-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: linear-gradient(135deg, var(--religion-color, var(--accent-primary)), transparent);
    border-radius: var(--radius-full);
    opacity: 0.9;
}

.religion-name {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.religion-book {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ===== Navigation Header ===== */
.nav-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-md) 0;
}

[data-theme="light"] .nav-header {
    background: rgba(248, 249, 252, 0.9);
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: var(--space-lg);
    list-style: none;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent-primary);
    background: rgba(201, 165, 92, 0.1);
}

/* ===== Verse/Content Card ===== */
.verse-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
    position: relative;
}

.verse-card:hover {
    background: var(--bg-hover);
    border-color: rgba(201, 165, 92, 0.3);
    box-shadow: var(--shadow-glow);
}

.verse-number {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--bg-primary);
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: var(--radius-full);
}

.verse-content {
    padding-left: 60px;
}

.verse-original {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.verse-translation {
    color: var(--text-secondary);
    line-height: 1.8;
}

.verse-audio-btn {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.verse-card:hover .verse-audio-btn {
    opacity: 1;
}

/* ===== Audio Player (Fixed Bottom) ===== */
.audio-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(18, 18, 26, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    padding: var(--space-md) var(--space-xl);
    transform: translateY(100%);
    transition: transform var(--transition-normal);
    z-index: 1000;
}

.audio-player.visible {
    transform: translateY(0);
}

.audio-player-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

.audio-info {
    flex: 1;
    min-width: 0;
}

.audio-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.audio-progress {
    flex: 2;
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    cursor: pointer;
    position: relative;
}

.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    width: 0%;
}

.progress-bar:hover .progress-fill {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.audio-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 45px;
}

/* ===== Loading Spinner ===== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
    color: var(--text-secondary);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
    margin-bottom: var(--space-lg);
}

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

/* ===== Dropdown/Select ===== */
.select-wrapper {
    position: relative;
}

.select {
    appearance: none;
    width: 100%;
    padding: var(--space-md) var(--space-xl);
    padding-right: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.select:hover,
.select:focus {
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 20px rgba(201, 165, 92, 0.15);
}

.select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ===== Badge ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: rgba(201, 165, 92, 0.15);
    color: var(--accent-primary);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-secondary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    .container {
        padding: 0 var(--space-md);
    }

    .grid-cols-2,
    .grid-cols-3 {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .nav-links {
        display: none;
    }

    .audio-player-content {
        flex-wrap: wrap;
    }

    .audio-progress {
        width: 100%;
        order: 3;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .religion-card {
        padding: var(--space-xl);
    }

    .religion-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .verse-content {
        padding-left: 50px;
    }

    .verse-number {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.animate-fade-in {
    animation: fadeIn var(--transition-normal) ease-out;
}

.animate-slide-up {
    animation: slideUp var(--transition-normal) ease-out;
}

/* Staggered animation for grid items */
.stagger-animation>* {
    animation: slideUp var(--transition-slow) ease-out backwards;
}

.stagger-animation>*:nth-child(1) {
    animation-delay: 0ms;
}

.stagger-animation>*:nth-child(2) {
    animation-delay: 100ms;
}

.stagger-animation>*:nth-child(3) {
    animation-delay: 200ms;
}

.stagger-animation>*:nth-child(4) {
    animation-delay: 300ms;
}

.stagger-animation>*:nth-child(5) {
    animation-delay: 400ms;
}

.stagger-animation>*:nth-child(6) {
    animation-delay: 500ms;
}