@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Cairo:wght@300;400;600;700;900&display=swap');

:root {
    --bg-primary: #0a0f1e;
    --bg-secondary: #111827;
    --bg-card: #1a2235;
    --bg-card-hover: #1f2d42;
    --text-primary: #f0f4ff;
    --text-secondary: #8899bb;
    --text-muted: #556080;
    --accent: #f0a500;
    --accent-glow: rgba(240, 165, 0, 0.25);
    --accent2: #10b981;
    --accent2-glow: rgba(16, 185, 129, 0.2);
    --border: rgba(255,255,255,0.06);
    --border-hover: rgba(240, 165, 0, 0.3);
    --shadow: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-card: 0 4px 20px rgba(0,0,0,0.3);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-arabic: 'Cairo', sans-serif;
    --font-display: 'Amiri', serif;
}

[data-theme="light"] {
    --bg-primary: #f8f5ef;
    --bg-secondary: #efe9de;
    --bg-card: #ffffff;
    --bg-card-hover: #fdf8f0;
    --text-primary: #1a1208;
    --text-secondary: #5a4a2e;
    --text-muted: #9a8a6e;
    --accent: #c17f24;
    --accent-glow: rgba(193, 127, 36, 0.15);
    --accent2: #0d9968;
    --accent2-glow: rgba(13, 153, 104, 0.15);
    --border: rgba(0,0,0,0.08);
    --border-hover: rgba(193, 127, 36, 0.4);
    --shadow: 0 8px 32px rgba(0,0,0,0.08);
    --shadow-card: 0 4px 20px rgba(0,0,0,0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    direction: rtl;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-arabic);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* ===== NAVBAR ===== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-brand .brand-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 8px 14px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== HERO ===== */
.hero {
    text-align: center;
    padding: 80px 24px 60px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
}

.hero-subtitle {
    font-size: 0.85rem;
    letter-spacing: 4px;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 16px;
    font-weight: 600;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 20px;
}

.hero-title span {
    color: var(--accent);
}

.hero-desc {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 500px;
    margin: 0 auto 40px;
}

/* ===== DAILY CARD ===== */
.daily-section {
    max-width: 600px;
    margin: 0 auto 60px;
    padding: 0 24px;
}

.daily-card {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-card-hover));
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 40px var(--accent-glow);
}

.daily-card::before {
    content: '﷽';
    position: absolute;
    top: -10px;
    right: 20px;
    font-family: var(--font-display);
    font-size: 4rem;
    color: var(--accent);
    opacity: 0.06;
}

.daily-label {
    font-size: 0.75rem;
    letter-spacing: 3px;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.daily-label::before,
.daily-label::after {
    content: '';
    height: 1px;
    width: 30px;
    background: var(--accent);
    opacity: 0.4;
}

.daily-dhikr-text {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 3vw, 1.7rem);
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 12px;
}

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

.dhikr-counter {
    margin-top: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.counter-btn {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 700;
}

.counter-btn:hover { transform: scale(1.1); }
.counter-btn:active { transform: scale(0.95); }

.counter-display {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 60px;
    text-align: center;
}

/* ===== CATEGORIES GRID ===== */
.section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px 60px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-line {
    flex: 1;
    height: 1px;
    background: var(--border);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.cat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.cat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    height: 3px;
    background: var(--cat-color, var(--accent));
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: right;
}

.cat-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--cat-color, var(--accent));
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
}

.cat-card:hover::after {
    transform: scaleX(1);
}

.cat-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    display: block;
}

.cat-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.cat-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.cat-count {
    margin-top: 16px;
    font-size: 0.75rem;
    color: var(--cat-color, var(--accent));
    font-weight: 600;
}

/* ===== CONTENT LIST ===== */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

.content-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
    border-color: var(--border-hover);
}

.content-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.content-body {
    padding: 20px;
}

.content-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.content-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
    backdrop-filter: blur(4px);
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 16px;
    left: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
}

.modal-close:hover { color: var(--text-primary); border-color: var(--accent); }

.modal-video {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--radius) var(--radius) 0 0;
    border: none;
}

.modal-content-body {
    padding: 24px;
}

/* ===== FOOTER ===== */
footer {
    text-align: center;
    padding: 32px 24px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== BACK BTN ===== */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 24px;
    transition: var(--transition);
    padding: 8px 0;
}

.back-btn:hover { color: var(--accent); }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state p { font-size: 1rem; }

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: transform 0.3s ease;
    z-index: 9999;
    white-space: nowrap;
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .navbar { padding: 0 16px; }
    .hero { padding: 50px 16px 40px; }
    .categories-grid { grid-template-columns: 1fr; }
    .content-grid { grid-template-columns: 1fr; }
    .daily-card { padding: 24px 16px; }
}

/* ===== AUDIO PLAYER ===== */
.audio-player {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.audio-player-top {
    display: flex;
    align-items: center;
    gap: 16px;
}

.audio-cover {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
    overflow: hidden;
}

.audio-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.audio-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* Controls */
.audio-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.audio-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.audio-btn:hover { color: var(--accent); transform: scale(1.1); }

.audio-play-btn {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.audio-play-btn:hover { transform: scale(1.08); opacity: 0.9; }

/* Progress */
.audio-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.audio-progress {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.audio-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    width: 0%;
    transition: width 0.1s linear;
    pointer-events: none;
}

.audio-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
}

/* Volume */
.audio-volume {
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio-volume input[type="range"] {
    width: 70px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Card in content grid */
.content-card.is-audio .content-thumb {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    position: relative;
}

.content-card.is-audio .content-thumb::after {
    content: '🎵';
    position: absolute;
    font-size: 2.5rem;
}

/* Modal audio player */
.modal-audio-wrap {
    padding: 32px 24px 8px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Waveform animation */
.waveform {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 30px;
}

.waveform-bar {
    width: 3px;
    background: var(--accent);
    border-radius: 3px;
    opacity: 0.5;
    animation: wave 1.2s ease-in-out infinite;
}

.waveform-bar:nth-child(2) { animation-delay: 0.1s; }
.waveform-bar:nth-child(3) { animation-delay: 0.2s; }
.waveform-bar:nth-child(4) { animation-delay: 0.3s; }
.waveform-bar:nth-child(5) { animation-delay: 0.4s; }
.waveform-bar:nth-child(6) { animation-delay: 0.2s; }
.waveform-bar:nth-child(7) { animation-delay: 0.1s; }

.waveform.playing .waveform-bar { opacity: 1; }
.waveform:not(.playing) .waveform-bar { animation-play-state: paused; }

@keyframes wave {
    0%, 100% { height: 6px; }
    50% { height: 24px; }
}
