/* ==========================================================================
   MAHABA - DESIGN SYSTEM & STYLESHEET
   ========================================================================== */

/* --- Variables & Themes --- */
:root {
    /* Color Palette - Dark Mode (Default Spiritual Theme) */
    --bg-primary: #0a0f14;
    --bg-secondary: #121a22;
    --bg-tertiary: #19232e;
    --border-color: rgba(255, 255, 255, 0.07);
    --border-focus: rgba(212, 175, 55, 0.4);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Brand Colors */
    --emerald-primary: #10b981;
    --emerald-deep: #064e3b;
    --emerald-trans: rgba(16, 185, 129, 0.15);
    
    --gold-primary: #d4af37;
    --gold-light: #f3e5ab;
    --gold-dark: #aa8410;
    --gold-trans: rgba(212, 175, 55, 0.15);
    
    --blue-primary: #3b82f6;
    --blue-trans: rgba(59, 130, 246, 0.15);
    
    --purple-primary: #8b5cf6;
    --purple-trans: rgba(139, 92, 246, 0.15);

    --danger: #ef4444;
    --danger-trans: rgba(239, 68, 68, 0.15);
    --success: #10b981;
    
    /* Shadows & Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
    --shadow-gold: 0 0 15px rgba(212, 175, 55, 0.3);
    --shadow-emerald: 0 0 15px rgba(16, 185, 129, 0.3);
    
    --glass-bg: rgba(18, 26, 34, 0.75);
    --glass-blur: blur(16px);
    
    /* Layout Constants */
    --app-max-width: 480px;
    --header-height: 70px;
    --nav-height: 70px;
    --border-radius-sm: 8px;
    --border-radius-md: 16px;
    --border-radius-lg: 24px;
    
    --font-serif: 'Cinzel', serif;
    --font-sans: 'Outfit', sans-serif;
}

/* Light Theme overrides */
[data-theme="light"] {
    --bg-primary: #f7f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f3f6;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-focus: rgba(16, 185, 129, 0.4);
    
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    
    --emerald-deep: #d1fae5;
    --emerald-trans: rgba(16, 185, 129, 0.1);
    --gold-trans: rgba(212, 175, 55, 0.1);
    --blue-trans: rgba(59, 130, 246, 0.1);
    --purple-trans: rgba(139, 92, 246, 0.1);
    
    --glass-bg: rgba(255, 255, 255, 0.85);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
}

/* --- Base Reset & Core Styles --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Background Ambient Glows */
.glow-bg {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.3;
    transition: opacity 0.5s ease;
}
.bg-glow-1 {
    top: -50px;
    right: -50px;
    background-color: var(--emerald-primary);
}
.bg-glow-2 {
    bottom: 50px;
    left: -100px;
    background-color: var(--gold-primary);
}
[data-theme="light"] .glow-bg {
    opacity: 0.15;
}

/* --- SPA Shell Container --- */
.app-container {
    width: 100%;
    max-width: var(--app-max-width);
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    position: relative;
    box-shadow: var(--shadow-lg);
}

/* --- Header Component --- */
.app-header {
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 700;
    color: var(--gold-primary);
    background: var(--emerald-trans);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--gold-primary);
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

.logo-text h1 {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.5px;
}
.logo-subtitle {
    font-size: 10px;
    color: var(--gold-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* --- Bottom Nav Component --- */
.app-nav {
    height: var(--nav-height);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}

.nav-item {
    background: none;
    border: none;
    outline: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    flex: 1;
    height: 100%;
    justify-content: center;
    transition: color 0.2s ease, transform 0.2s ease;
}

.nav-item i {
    width: 22px;
    height: 22px;
    stroke-width: 2px;
    transition: transform 0.2s ease;
}

.nav-item:active i {
    transform: scale(0.85);
}

.nav-item.active {
    color: var(--gold-primary);
}
.nav-item.active i {
    color: var(--emerald-primary);
    filter: drop-shadow(0 0 4px var(--emerald-trans));
}

/* --- Main Layout & Sections --- */
.app-main {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 30px;
}

.page-section {
    display: none;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.page-section.active {
    display: block;
}

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

/* --- Typography & Global Elements --- */
h2 {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-title {
    margin: 24px 0 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge-gold {
    background: var(--gold-trans);
    color: var(--gold-primary);
    border: 1px solid rgba(212, 175, 55, 0.3);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
}

/* --- Buttons --- */
button {
    font-family: var(--font-sans);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

.btn-icon {
    background: none;
    border: none;
    outline: none;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: 50%;
}
.btn-icon:hover, .btn-icon:active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-primary {
    background: linear-gradient(135deg, var(--emerald-primary), #059669);
    color: white;
    border: none;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 24px;
    border-radius: var(--border-radius-md);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}
.btn-primary:active {
    transform: scale(0.97);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.1);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-weight: 500;
    font-size: 14px;
    padding: 12px 24px;
    border-radius: var(--border-radius-md);
}
.btn-secondary:active {
    background: var(--bg-secondary);
}

.btn-icon-toggle {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 50%;
}
.btn-icon-toggle.active {
    color: var(--gold-primary);
    border-color: var(--gold-primary);
    background: var(--gold-trans);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}
.btn-back i {
    width: 16px;
    height: 16px;
}

/* --- PAGE: HOME COMPONENTS --- */
.hero-card {
    position: relative;
    padding: 24px;
    border-radius: var(--border-radius-lg);
    background: linear-gradient(135deg, #0f3421, #061c10);
    border: 1px solid rgba(212, 175, 55, 0.2);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
[data-theme="light"] .hero-card {
    background: linear-gradient(135deg, #10b981, #047857);
    border: none;
}
.hero-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 80% 20%, rgba(212, 175, 55, 0.15) 0%, transparent 60%);
    pointer-events: none;
}
.hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.quote-text {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--gold-light);
    font-style: italic;
}
.quote-author {
    font-size: 12px;
    color: var(--text-secondary);
    align-self: flex-end;
}
[data-theme="light"] .quote-text {
    color: #ffffff;
}
[data-theme="light"] .quote-author {
    color: rgba(255, 255, 255, 0.8);
}

/* Daily Progress Banner */
.progress-banner {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
}

.progress-metric {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.metric-circle {
    width: 64px;
    height: 64px;
    position: relative;
}

.circle-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.circle-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 3.5;
}

.circle-fill {
    fill: none;
    stroke: var(--emerald-primary);
    stroke-width: 3.5;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}

.metric-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-sans);
}

.metric-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    text-align: center;
}

.progress-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.progress-status {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}

.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--gold-trans);
    color: var(--gold-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    width: fit-content;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.streak-badge i {
    width: 14px;
    height: 14px;
    fill: var(--gold-primary);
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:active {
    transform: translateY(-2px);
    border-color: var(--gold-primary);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.feature-icon i {
    width: 20px;
    height: 20px;
}

.bg-gold-trans { background: var(--gold-trans); color: var(--gold-primary); }
.bg-green-trans { background: var(--emerald-trans); color: var(--emerald-primary); }
.bg-blue-trans { background: var(--blue-trans); color: var(--blue-primary); }
.bg-purple-trans { background: var(--purple-trans); color: var(--purple-primary); }

.feature-card h3 {
    font-size: 14px;
    font-weight: 600;
}
.feature-card p {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
}
.feature-link {
    font-size: 11px;
    font-weight: 600;
    color: var(--gold-primary);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
}
.feature-link i {
    width: 12px;
    height: 12px;
}

/* --- PAGE: LITANIES COMPONENTS --- */
.page-hero {
    margin-bottom: 20px;
}
.page-hero h2 {
    font-size: 1.6rem;
    margin-bottom: 6px;
}
.page-hero p {
    font-size: 13px;
    color: var(--text-secondary);
}

.litanies-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.litany-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.litany-card:active {
    border-color: var(--emerald-primary);
    background: var(--bg-tertiary);
}

.litany-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.litany-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.litany-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.litany-title-row h3 {
    font-size: 15px;
    font-weight: 600;
}
.litany-desc {
    font-size: 12px;
    color: var(--text-muted);
}
.litany-arrow {
    color: var(--gold-primary);
}
.litany-arrow i {
    width: 20px;
    height: 20px;
}

/* --- PAGE: TASBIH COMPONENTS --- */
.tasbih-selector-container {
    margin-bottom: 24px;
}

.field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: block;
}

.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.form-select {
    width: 100%;
    padding: 14px 16px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    outline: none;
    appearance: none;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    cursor: pointer;
}
.form-select:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 2px var(--border-focus);
}

.select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.tasbih-counter-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
}

.tasbih-counter-outer {
    position: relative;
    width: 250px;
    height: 250px;
}

.tasbih-ring {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.tasbih-ring-bg {
    fill: none;
    stroke: var(--bg-secondary);
    stroke-width: 4;
}

.tasbih-ring-fill {
    fill: none;
    stroke: linear-gradient(135deg, var(--gold-primary), var(--emerald-primary)); /* Wait, SVGs need gradient definitions, we will color via CSS or standard stroke */
    stroke: var(--gold-primary);
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
}

.tasbih-tap-btn {
    position: absolute;
    top: 15px; left: 15px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md), inset 0 2px 10px rgba(255, 255, 255, 0.05);
    transition: transform 0.05s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.tasbih-tap-btn:active {
    transform: scale(0.96);
    border-color: var(--gold-primary);
    box-shadow: var(--shadow-sm), 0 0 15px var(--gold-trans);
}

.tasbih-tap-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.tasbih-target-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.tasbih-count-value {
    font-size: 54px;
    font-weight: 700;
    font-family: var(--font-sans);
    line-height: 1.1;
    color: var(--text-primary);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tasbih-action-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--emerald-primary);
    letter-spacing: 2px;
    margin-top: 6px;
}

.tasbih-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 0 10px;
}

.tasbih-options {
    display: flex;
    gap: 12px;
}

.tasbih-info-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px;
    margin-top: 24px;
    box-shadow: var(--shadow-sm);
}
.tasbih-info-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--gold-primary);
}
.tasbih-info-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* --- PAGE: ENSEIGNEMENTS COMPONENTS --- */
.tabs-header {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 4px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    padding: 10px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: var(--border-radius-sm);
    text-align: center;
}
.tab-btn.active {
    background: var(--bg-tertiary);
    color: var(--gold-primary);
    box-shadow: var(--shadow-sm);
}

.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

.lessons-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lesson-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.lesson-card:active {
    border-color: var(--gold-primary);
    transform: translateY(-2px);
}

.lesson-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.lesson-card-header h3 {
    font-size: 15px;
    font-weight: 600;
}
.lesson-card-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--emerald-trans);
    color: var(--emerald-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.lesson-card-icon i {
    width: 14px;
    height: 14px;
}

.lesson-card p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.lesson-card-meta {
    font-size: 11px;
    color: var(--gold-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}
.lesson-card-meta i {
    width: 12px;
    height: 12px;
}

/* --- PAGE: CONTESTS COMPONENTS --- */
.contest-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contest-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.contest-card:active {
    transform: translateY(-2px);
    border-color: var(--gold-primary);
}

.contest-card-image {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--bg-tertiary);
}

.contest-card-image.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 12px;
}

.contest-card-body {
    padding: 16px;
}

.contest-card-header {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.contest-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-primary);
}

.contest-status.active { background: rgba(16, 185, 129, 0.2); color: var(--emerald-primary); }
.contest-status.closed { background: rgba(248, 113, 113, 0.2); color: #fca5a5; }
.contest-status.draft { background: rgba(245, 158, 11, 0.18); color: var(--gold-primary); }

.contest-date {
    font-size: 10px;
    color: var(--text-muted);
}

.contest-card h3 {
    font-size: 16px;
    margin: 0 0 8px;
}

.contest-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.contest-footer {
    margin-top: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.contest-link {
    color: var(--gold-primary);
    font-weight: 600;
}

.contest-gallery {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.contest-detail-image {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.contest-detail-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.contest-detail-description {
    line-height: 1.6;
    color: var(--text-secondary);
}

/* --- PAGE: QUIZ COMPONENTS --- */
.quiz-lobby-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.quiz-select-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.quiz-lobby-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-sm);
}

.quiz-lobby-card .card-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.quiz-lobby-card .card-icon i {
    width: 22px;
    height: 22px;
}

.quiz-lobby-card h3 {
    font-size: 16px;
    font-weight: 600;
}
.quiz-lobby-card p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}
.quiz-lobby-card .btn-primary {
    margin-top: 6px;
    align-self: flex-start;
}

/* Quiz Game Panel */
.quiz-game-view {
    animation: fadeIn 0.3s ease;
}

.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.quiz-progress-bar-container {
    flex: 1;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.quiz-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--emerald-primary), var(--success));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.quiz-counter {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.quiz-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 24px 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

.question-container h3 {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 20px;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 14px 16px;
    text-align: left;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.option-btn:hover:not([disabled]), .option-btn:active:not([disabled]) {
    border-color: var(--gold-primary);
    background: var(--bg-secondary);
}

/* Quiz option evaluation states */
.option-btn.correct {
    background: var(--emerald-trans) !important;
    border-color: var(--emerald-primary) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.option-btn.incorrect {
    background: var(--danger-trans) !important;
    border-color: var(--danger) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.quiz-explanation {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    animation: slideUp 0.3s ease;
}

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

.quiz-explanation .explanation-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gold-trans);
    color: var(--gold-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
}
.quiz-explanation .explanation-icon i {
    width: 16px;
    height: 16px;
}

.explanation-content h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}
.explanation-content p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.quiz-explanation .btn-primary {
    align-self: flex-end;
}

/* Quiz Results Panel */
.quiz-result-view {
    animation: fadeIn 0.4s ease;
}

.result-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 30px 24px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.result-badge-container {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px auto;
}

.result-badge-glow {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--gold-primary);
    border-radius: 50%;
    filter: blur(8px);
    opacity: 0.3;
    animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 0.2; }
    50% { transform: scale(1.15); opacity: 0.4; }
}

.result-icon-circle {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 50%;
    background: var(--gold-trans);
    border: 2px solid var(--gold-primary);
    color: var(--gold-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.result-icon-circle i {
    width: 36px;
    height: 36px;
}

.result-card h2 {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    margin-bottom: 8px;
    color: var(--gold-primary);
}

#result-score-text {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
}

.result-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- MODALS --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 1000;
    animation: modalBgFade 0.3s ease forwards;
}

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

.modal-container {
    width: 100%;
    max-width: var(--app-max-width);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

.modal-header h3 {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
    overflow-x: auto;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
}
.modal-tabs::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome/Safari */
}

.modal-tab-btn {
    background: none;
    border: none;
    outline: none;
    padding: 10px 14px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.modal-tab-btn.active {
    color: var(--gold-primary);
    border-bottom-color: var(--gold-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}
.modal-body.scrollable {
    max-height: 60vh;
}

.modal-content-panel {
    display: none;
    animation: fadeIn 0.25s ease;
}
.modal-content-panel.active {
    display: block;
}

/* Litany Content panels styling */
.arabic-text {
    font-size: 24px;
    line-height: 2;
    text-align: right;
    font-family: 'Times New Roman', serif;
    color: var(--text-primary);
    direction: rtl;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
}

.trans-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--gold-light);
    font-style: italic;
    padding: 10px;
}
[data-theme="light"] .trans-text {
    color: var(--gold-dark);
}

.trad-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
    padding: 10px;
}

.rules-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rules-container ul {
    list-style-type: none;
    padding-left: 0;
}

.rules-container li {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
}
.rules-container li::before {
    content: "•";
    color: var(--gold-primary);
    position: absolute;
    left: 6px;
    font-size: 16px;
}

/* Lesson detail text editor styling */
.lesson-rich-text h3 {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    color: var(--gold-primary);
    margin: 16px 0 8px 0;
}
.lesson-rich-text h3:first-of-type {
    margin-top: 0;
}
.lesson-rich-text p {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.lesson-rich-text ul {
    list-style-type: none;
    margin-bottom: 12px;
}
.lesson-rich-text li {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    position: relative;
    padding-left: 18px;
    margin-bottom: 6px;
}
.lesson-rich-text li::before {
    content: "◈";
    color: var(--emerald-primary);
    position: absolute;
    left: 4px;
    font-size: 10px;
}

.modal-footer {
    display: flex;
    justify-content: center;
}
.modal-footer button {
    width: 100%;
}

/* Utility Hidden state */
.hidden {
    display: none !important;
}

/* Media Queries for Desktop layout */
@media (min-width: 481px) {
    body {
        background-color: var(--bg-tertiary);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px 0;
    }
    .app-container {
        height: 840px;
        min-height: 840px;
        border-radius: var(--border-radius-lg);
        overflow: hidden;
    }
    .app-header {
        position: absolute;
        width: 100%;
    }
    .app-nav {
        position: absolute;
        width: 100%;
        bottom: 0;
    }
    .app-main {
        margin-top: var(--header-height);
        margin-bottom: var(--nav-height);
        height: calc(100% - var(--header-height) - var(--nav-height));
        overflow-y: auto;
    }
    .modal-overlay {
        position: absolute;
        border-radius: var(--border-radius-lg);
    }
}

/* ==========================================================================
   PWA & MOBILE APP INSTALL STYLES
   ========================================================================== */
.pwa-header-btn {
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: var(--gold-primary);
    animation: pulseGlow 2.5s infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4); }
    50% { box-shadow: 0 0 12px 2px rgba(212, 175, 55, 0.3); }
}

.pwa-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(135deg, rgba(18, 26, 34, 0.95), rgba(6, 78, 59, 0.35));
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: var(--border-radius-md);
    padding: 12px 14px;
    margin-bottom: 16px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.pwa-banner-icon img {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(212, 175, 55, 0.4);
}

.pwa-banner-text h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--gold-light);
    margin: 0 0 2px;
}

.pwa-banner-text p {
    font-size: 11px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.3;
}

.pwa-banner-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.pwa-guide-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.pwa-guide-step:last-child {
    border-bottom: none;
}

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gold-primary);
    color: #000;
    font-weight: 700;
    font-size: 13px;
}

.step-desc strong {
    color: var(--text-primary);
    font-size: 13px;
    display: block;
    margin-bottom: 4px;
}

.step-desc p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}
