/* ==================== CSS Variables - Modern Theme ==================== */
:root {
    /* Primary Colors - Emerald & Gold Theme */
    --primary: #059669;
    --primary-light: #34d399;
    --primary-dark: #047857;
    --accent-gold: #f59e0b;
    --accent-gold-light: #fbbf24;
    --accent-gold-dark: #d97706;
    
    /* Background Colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.9);
    
    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    /* Border & Shadow */
    --border-color: rgba(148, 163, 184, 0.2);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(5, 150, 105, 0.3);
    
    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.5);
    
    /* Quran Page */
    --quran-bg: #ffffff;
    --quran-text: #1a1a1a;
    --quran-border: #059669;
    
    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
}

/* Dark Mode */
.dark-mode {
    --bg-primary: #020617;
    --bg-secondary: #0f172a;
    --bg-tertiary: #1e293b;
    --bg-card: rgba(15, 23, 42, 0.9);
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --border-color: rgba(148, 163, 184, 0.1);
    --shadow-glow: 0 0 20px rgba(52, 211, 153, 0.2);
    
    --glass-bg: rgba(15, 23, 42, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    --quran-bg: #0f172a;
    --quran-text: #e2e8f0;
    --quran-border: #34d399;
}

/* ==================== Base Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Cairo', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ==================== Loading Screen ==================== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s ease;
}

.loader-container {
    text-align: center;
    animation: fadeInUp 0.8s ease;
}

.islamic-pattern {
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    border-radius: 50%;
    position: relative;
    animation: pulse-glow 2s ease-in-out infinite;
}

.islamic-pattern::before {
    content: '﷽';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: white;
    font-family: 'Amiri', serif;
}

.loader-text {
    font-family: 'Amiri', serif;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.loader-subtext {
    color: var(--text-muted);
    font-size: 1rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(5, 150, 105, 0.4); }
    50% { box-shadow: 0 0 40px rgba(245, 158, 11, 0.4); }
}

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

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================== Offline Indicator ==================== */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, var(--error) 0%, #dc2626 100%);
    color: white;
    padding: 0.75rem;
    text-align: center;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    animation: slideDown 0.3s ease;
}

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

/* ==================== Header ==================== */
.header {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    height: 70px;
    max-width: 1600px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.02);
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: var(--shadow-glow);
}

.logo-text h1 {
    font-family: 'Amiri', serif;
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-top: -5px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    width: 42px;
    height: 42px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.icon-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: var(--primary);
}

.icon-btn:hover::before {
    opacity: 1;
}

.icon-btn:hover i {
    color: white;
    position: relative;
    z-index: 1;
}

.icon-btn i {
    transition: color 0.3s ease;
}

.font-controls {
    display: flex;
    gap: 0.25rem;
}

/* ==================== Main Container ==================== */
.main-container {
    display: flex;
    min-height: calc(100vh - 70px);
    background: var(--bg-primary);
    position: relative;
}

/* ==================== Sidebar ==================== */
.sidebar {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    width: 380px;
    position: fixed;
    top: 70px;
    right: 0;
    height: calc(100vh - 70px);
    z-index: 100;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.05);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.sidebar-header h2 {
    font-family: 'Amiri', serif;
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-tertiary);
    padding: 0.25rem;
    border-radius: 10px;
}

.tab-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.9rem;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.sidebar-search {
    margin-top: 1rem;
    position: relative;
}

.sidebar-search input {
    width: 100%;
    padding: 0.8rem 2.5rem 0.8rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: 'Cairo', sans-serif;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.sidebar-search i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.surah-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.surah-list::-webkit-scrollbar {
    width: 6px;
}

.surah-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.surah-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.surah-item:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
    transform: translateX(-5px);
    box-shadow: var(--shadow-md);
}

.surah-item:hover .surah-name-ar,
.surah-item:hover .surah-meta,
.surah-item:hover .surah-number {
    color: white;
}

.surah-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    border-color: var(--accent-gold);
    box-shadow: var(--shadow-glow);
}

.surah-item.active .surah-name-ar,
.surah-item.active .surah-meta,
.surah-item.active .surah-number {
    color: white;
}

.surah-number {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-dark) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 10px;
    flex-shrink: 0;
}

.surah-name-ar {
    font-family: 'Amiri', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.surah-info-card {
    flex: 1;
}

.surah-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
    transition: color 0.3s ease;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.meta-item i {
    font-size: 0.75rem;
    color: var(--primary);
}

.surah-item:hover .meta-item i,
.surah-item.active .meta-item i {
    color: white;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.progress-bar-container {
    text-align: center;
}

.progress-bar {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent-gold) 100%);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==================== Content Area ==================== */
.content {
    flex: 1;
    margin-right: 380px;
    background: var(--bg-primary);
    min-height: calc(100vh - 70px);
    padding: 2rem;
    transition: margin 0.4s ease;
}

.content-header {
    background: var(--bg-card);
    padding: 1.5rem 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.surah-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.surah-badge {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
}

.surah-title h2 {
    font-family: 'Amiri', serif;
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.surah-title p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.content-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.control-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Cairo', sans-serif;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.control-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    color: white;
    border-color: var(--accent-gold);
}

.save-surah-btn-header {
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-dark) 100%);
    border: none;
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Cairo', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.save-surah-btn-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.save-surah-btn-header.saved {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

.reciter-select {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 10px;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
}

.reciter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

/* ==================== Welcome Message ==================== */
.welcome-message {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.welcome-icon {
    font-size: 5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.welcome-message h3 {
    font-family: 'Amiri', serif;
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.welcome-message p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.quick-stats {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    min-width: 120px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==================== Verses Container ==================== */
.verses-container {
    max-width: 900px;
    margin: 0 auto;
}

.verses-wrapper {
    font-family: 'Scheherazade New', 'Amiri', serif;
    font-size: 2.2rem;
    line-height: 3;
    text-align: justify;
    color: var(--quran-text);
    padding: 3rem;
    background: var(--quran-bg);
    direction: rtl;
    position: relative;
    min-height: 600px;
    border-radius: 16px;
    border: 2px solid var(--quran-border);
    box-shadow: var(--shadow-xl);
}

.surah-header-mushaf {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
}

.side-text {
    font-family: 'Amiri', serif;
    font-size: 1rem;
    color: var(--primary);
    font-weight: 600;
}

.verse-item {
    display: inline;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
    padding: 0.2rem 0.3rem;
    border-radius: 4px;
}

.verse-item:hover {
    background: rgba(5, 150, 105, 0.1);
}

.verse-item.playing {
    background: linear-gradient(90deg, rgba(5, 150, 105, 0.2) 0%, rgba(245, 158, 11, 0.2) 100%);
    border-radius: 4px;
    animation: highlight-pulse 2s ease-in-out infinite;
}

@keyframes highlight-pulse {
    0%, 100% { background: rgba(5, 150, 105, 0.15); }
    50% { background: rgba(5, 150, 105, 0.3); }
}

.verse-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    margin: 0 0.3rem;
    border-radius: 50%;
    font-family: 'Cairo', sans-serif;
    vertical-align: middle;
    cursor: pointer;
    transition: all 0.3s ease;
}

.verse-number:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-glow);
}

.verse-item.playing .verse-number {
    transform: scale(1.15);
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-dark) 100%);
    animation: rotate-scale 1s ease-in-out;
}

@keyframes rotate-scale {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
    100% { transform: scale(1.15) rotate(360deg); }
}

/* Bookmark indicator on verse */
.verse-number::after {
    content: '';
    position: absolute;
    top: -8px;
    right: 2px;
    width: 10px;
    height: 16px;
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-light) 100%);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
    opacity: 0;
    transition: all 0.3s ease;
}

.verse-item.bookmarked .verse-number::after {
    opacity: 1;
}

/* ==================== Audio Player ==================== */
.audio-player {
    position: fixed;
    bottom: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1000px;
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(200%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    padding: 1rem 2rem;
    z-index: 1000;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.audio-player.active {
    bottom: 20px;
}

.player-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    justify-content: space-between;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 200px;
}

.player-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
}

.player-text {
    display: flex;
    flex-direction: column;
}

.player-text span:first-child {
    font-family: 'Amiri', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.player-text span:last-child {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.player-controls-main {
    flex: 1;
    max-width: 600px;
}

.player-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.control-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.play-btn {
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    color: white;
    font-size: 1.3rem;
    border: none;
    box-shadow: var(--shadow-glow);
}

.play-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 0 30px rgba(5, 150, 105, 0.5);
}

.tiny-btn, .small-btn {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
}

.speed-control select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
}

.player-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar-wrapper {
    flex: 1;
}

#progress-bar {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 3px;
    cursor: pointer;
}

#progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s ease;
}

#progress-bar::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.close-player {
    background: var(--bg-tertiary);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.close-player:hover {
    background: var(--error);
    color: white;
}

/* ==================== Modals ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
}

.modal-header h3 {
    font-family: 'Amiri', serif;
    font-size: 1.4rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.close-modal {
    background: var(--bg-tertiary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    background: var(--error);
    color: white;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Search Modal */
.search-box {
    position: relative;
    margin-bottom: 1rem;
}

.search-box input {
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: 'Cairo', sans-serif;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.search-box i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 1.2rem;
}

.search-shortcut {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.search-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-chip {
    padding: 0.4rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.filter-chip:hover,
.filter-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-hint {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.search-hint i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary);
    opacity: 0.5;
}

.search-result-item {
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-result-item:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateX(-5px);
}

.search-result-item:hover .result-surah,
.search-result-item:hover .result-text {
    color: white;
}

.result-surah {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-text {
    font-family: 'Amiri', serif;
    font-size: 1.3rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Bookmarks Modal */
.bookmarks-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.bookmark-tab {
    padding: 0.5rem 1.2rem;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.bookmark-tab.active {
    background: var(--primary);
    color: white;
}

.bookmarks-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.bookmark-item {
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bookmark-item:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateX(-5px);
}

.bookmark-item:hover * {
    color: white;
}

.bookmark-info {
    flex: 1;
}

.bookmark-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.bookmark-text {
    font-family: 'Amiri', serif;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.delete-bookmark {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.delete-bookmark:hover {
    background: var(--error);
    color: white;
}

/* Tafsir Modal */
.tafsir-modal-content {
    max-width: 800px;
}

.tafsir-options {
    margin-bottom: 1.5rem;
}

.tafsir-select-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tafsir-select-group label {
    color: var(--text-secondary);
    font-weight: 600;
}

.premium-select {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.premium-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.tafsir-content {
    background: var(--bg-tertiary);
    border-radius: 16px;
    padding: 2rem;
    max-height: 50vh;
    overflow-y: auto;
}

.tafsir-hint {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.tafsir-hint i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.tafsir-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.tafsir-verse-text {
    font-family: 'Scheherazade New', serif;
    font-size: 1.8rem;
    color: var(--primary);
    line-height: 1.8;
    text-align: center;
    margin-bottom: 1rem;
}

.tafsir-text {
    font-family: 'Cairo', sans-serif;
    font-size: 1.1rem;
    line-height: 2;
    color: var(--text-primary);
    text-align: justify;
}

/* ==================== Toast Notifications ==================== */
#toast-container {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 250px;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-20px) translateX(-50%);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateX(-50%);
    }
}

.toast.success {
    border-right: 4px solid var(--success);
}

.toast.error {
    border-right: 4px solid var(--error);
}

.toast.info {
    border-right: 4px solid var(--info);
}

.toast i {
    font-size: 1.2rem;
}

.toast.success i { color: var(--success); }
.toast.error i { color: var(--error); }
.toast.info i { color: var(--info); }

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

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

/* ==================== Responsive Design ==================== */
@media (max-width: 1200px) {
    .sidebar {
        width: 340px;
    }
    
    .content {
        margin-right: 340px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(100%);
        width: 100%;
        max-width: 400px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .content {
        margin-right: 0;
    }
    
    .header-controls {
        gap: 0.25rem;
    }
    
    .icon-btn {
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 0.75rem 1rem;
    }
    
    .logo-text h1 {
        font-size: 1.4rem;
    }
    
    .logo-subtitle {
        display: none;
    }
    
    .content {
        padding: 1rem;
    }
    
    .content-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .surah-info {
        justify-content: center;
    }
    
    .content-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .verses-wrapper {
        padding: 1.5rem;
        font-size: 1.8rem;
    }
    
    .player-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .player-controls-main {
        width: 100%;
    }
    
    .welcome-message h3 {
        font-size: 1.8rem;
    }
    
    .quick-stats {
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .logo-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .logo-text h1 {
        font-size: 1.2rem;
    }
    
    .icon-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .verses-wrapper {
        padding: 1rem;
        font-size: 1.6rem;
    }
    
    .verse-number {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }
    
    .modal-content {
        margin: 0.5rem;
        max-height: 95vh;
    }
    
    .welcome-icon {
        font-size: 3rem;
    }
    
    .welcome-message h3 {
        font-size: 1.5rem;
    }
}

/* Print Styles */
@media print {
    .header,
    .sidebar,
    .audio-player,
    .icon-btn,
    .control-btn {
        display: none !important;
    }
    
    .content {
        margin: 0;
        padding: 0;
    }
    
    .verses-wrapper {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* ==================== Enhanced Mobile Styles ==================== */

/* Extra Small Devices (320px - 480px) */
@media (max-width: 480px) {
    /* Header improvements */
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }

    .header-content {
        padding: 0.5rem;
        height: 60px;
    }

    .logo {
        gap: 0.5rem;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .logo-text h1 {
        font-size: 1rem;
    }

    .header-controls {
        gap: 0.25rem;
    }

    .icon-btn {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }

    .font-controls {
        display: none; /* Hide font controls on very small screens */
    }

    /* Sidebar mobile improvements */
    .sidebar {
        top: 60px;
        height: calc(100vh - 60px);
        width: 100%;
        max-width: 100%;
    }

    .sidebar-header {
        padding: 1rem;
    }

    .sidebar-header h2 {
        font-size: 1.1rem;
    }

    .filter-tabs {
        gap: 0.25rem;
    }

    .tab-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .sidebar-search input {
        padding: 0.6rem 2rem 0.6rem 0.75rem;
        font-size: 0.9rem;
    }

    .surah-item {
        padding: 0.75rem;
        margin-bottom: 0.4rem;
    }

    .surah-number {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    .surah-name-ar {
        font-size: 1.1rem;
    }

    .surah-meta {
        font-size: 0.7rem;
        gap: 0.5rem;
    }

    /* Content area */
    .content {
        padding: 0.75rem;
        margin-top: 60px;
    }

    .content-header {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .surah-badge {
        width: 40px;
        height: 40px;
    }

    .surah-title h2 {
        font-size: 1.3rem;
    }

    .content-controls {
        gap: 0.5rem;
    }

    .control-btn,
    .save-surah-btn-header {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .reciter-select {
        min-width: 140px;
        font-size: 0.8rem;
        padding: 0.5rem;
    }

    /* Verses display */
    .verses-wrapper {
        padding: 1rem;
        font-size: 1.4rem;
        line-height: 2.2;
    }

    .surah-header-mushaf {
        padding-bottom: 0.75rem;
        margin-bottom: 1rem;
    }

    .side-text {
        font-size: 0.8rem;
    }

    .bismillah {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    .verse-number {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
        margin: 0 0.15rem;
    }

    /* Audio player mobile */
    .audio-player {
        bottom: -100px;
        padding: 0.75rem 1rem;
        width: 95%;
    }

    .audio-player.active {
        bottom: 10px;
    }

    .player-content {
        gap: 0.75rem;
    }

    .player-info {
        min-width: auto;
        gap: 0.5rem;
    }

    .player-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .player-text span:first-child {
        font-size: 0.95rem;
    }

    .player-text span:last-child {
        font-size: 0.75rem;
    }

    .player-controls {
        gap: 0.5rem;
    }

    .control-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .play-btn {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .player-progress {
        gap: 0.5rem;
    }

    .player-progress span {
        font-size: 0.75rem;
    }

    /* Modals mobile */
    .modal-content {
        margin: 0.5rem;
        max-height: 90vh;
        border-radius: 16px;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-header h3 {
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .search-box input {
        padding: 0.75rem 2.5rem 0.75rem 0.75rem;
        font-size: 1rem;
    }

    .search-shortcut {
        display: none;
    }

    .search-filters {
        gap: 0.4rem;
    }

    .filter-chip {
        padding: 0.3rem 0.8rem;
        font-size: 0.8rem;
    }

    /* Welcome message */
    .welcome-message {
        padding: 2rem 1rem;
    }

    .welcome-icon {
        font-size: 3rem;
        margin-bottom: 1rem;
    }

    .welcome-message h3 {
        font-size: 1.4rem;
    }

    .welcome-message p {
        font-size: 0.95rem;
    }

    .quick-stats {
        gap: 0.5rem;
        margin-top: 1.5rem;
    }

    .stat-card {
        padding: 0.75rem;
        min-width: 80px;
    }

    .stat-card i {
        font-size: 1.5rem;
    }

    .stat-number {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    /* Toast notifications */
    #toast-container {
        top: 70px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: 90%;
    }

    .toast {
        min-width: auto;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    /* Loading screen */
    .loader-text {
        font-size: 1.8rem;
    }

    .loader-subtext {
        font-size: 0.9rem;
    }

    .islamic-pattern {
        width: 80px;
        height: 80px;
    }

    .islamic-pattern::before {
        font-size: 2rem;
    }
}

/* Very Small Devices (less than 360px) */
@media (max-width: 360px) {
    .logo-text h1 {
        font-size: 0.9rem;
    }

    .icon-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .verses-wrapper {
        font-size: 1.3rem;
        padding: 0.75rem;
    }

    .verse-number {
        width: 24px;
        height: 24px;
        font-size: 0.65rem;
    }

    .control-btn {
        width: 32px;
        height: 32px;
    }

    .play-btn {
        width: 44px;
        height: 44px;
    }

    .reciter-select {
        min-width: 120px;
        font-size: 0.75rem;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .icon-btn:hover {
        transform: none;
    }

    .surah-item:hover {
        transform: none;
    }

    .control-btn:hover {
        transform: none;
    }

    .verse-item:hover {
        background: transparent;
    }

    /* Larger touch targets */
    .icon-btn,
    .control-btn,
    .verse-number,
    .surah-item,
    .tab-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        position: relative;
    }

    .content {
        margin-top: 0;
    }

    .sidebar {
        top: 70px;
        height: calc(100vh - 70px);
    }

    .verses-wrapper {
        font-size: 1.4rem;
        padding: 1rem;
    }

    .audio-player {
        bottom: -80px;
    }

    .audio-player.active {
        bottom: 5px;
    }
}

/* iOS Safe Area Support */
@supports (padding-top: env(safe-area-inset-top)) {
    .header {
        padding-top: env(safe-area-inset-top);
    }

    .sidebar {
        top: calc(70px + env(safe-area-inset-top));
        height: calc(100vh - 70px - env(safe-area-inset-top));
    }

    .content {
        margin-top: calc(70px + env(safe-area-inset-top));
    }

    .audio-player.active {
        bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .verse-number {
        border: 2px solid currentColor;
    }

    .surah-item {
        border: 2px solid var(--border-color);
    }

    .icon-btn,
    .control-btn {
        border: 2px solid currentColor;
    }
}

/* Focus styles for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Selection styles */
::selection {
    background: rgba(5, 150, 105, 0.3);
    color: var(--text-primary);
}

.dark-mode ::selection {
    background: rgba(52, 211, 153, 0.3);
}
