﻿* {
    box-sizing: border-box;
}

:root {
    --primary: #ffb703;
    --secondary: #7c4dff;
    --sky: #dff6ff;
    --sky-deep: #bfe8ff;
    --peach: #ffd9c9;
    --mint: #d8f5d2;
    --gold: #f5c75c;
    --purple: #c39dfd;
    --text: #1d2b4f;
    --text-soft: #58708c;
    --white: #fff;
    --bg: #fffaf3;
    --section: #f5f7ff;
    --card: #ffffff;
    --shadow: 0 20px 40px rgba(77, 92, 130, 0.12);
    --line: #e9eef8;
    --nav: rgba(255, 255, 255, 0.88);
    --danger: #ff6b6b;
}

body.dark-mode {
    --primary: #f6c770;
    --secondary: #9b7bff;
    --sky: #1f2b46;
    --sky-deep: #1b2438;
    --peach: #4b2f2d;
    --mint: #1d3b2d;
    --gold: #7d5b12;
    --purple: #3d2d62;
    --text: #edf4ff;
    --text-soft: #b9cce1;
    --white: #152238;
    --bg: #0d1729;
    --section: #111d2f;
    --card: #17253d;
    --shadow: 0 20px 40px rgba(3, 7, 18, 0.4);
    --line: #263958;
    --nav: rgba(15, 22, 35, 0.88);
    --danger: #ff8d8d;
}

html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Cairo", sans-serif;
    line-height: 1.7;
    direction: rtl;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input { font: inherit; }
button { cursor: pointer; border: none; background: none; }
.container { width: min(1160px, calc(100% - 40px)); margin: 0 auto; }
.section { padding: 90px 0; }

.header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--nav);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 86px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.logo-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), #ffcc70);
    box-shadow: 0 14px 28px rgba(255, 183, 3, 0.28);
    font-size: 1.8rem;
}

.logo-title, .logo-subtitle { display: block; }
.logo-title { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.logo-subtitle { font-size: 0.75rem; color: var(--text-soft); }

.nav-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-link {
    padding: 10px 16px;
    border-radius: 999px;
    font-weight: 700;
    color: var(--text-soft);
    transition: 0.25s ease;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255, 183, 3, 0.14);
    color: var(--text);
}

.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid var(--line);
    font-size: 1.2rem;
    transition: 0.25s ease;
}
.icon-button:hover { transform: translateY(-2px); }
.mobile-menu-btn { display: none; }

.hero {
    position: relative;
    overflow: hidden;
    padding: 70px 0 90px;
    background: radial-gradient(circle at 20% 20%, rgba(255, 183, 3, 0.18), transparent 28%), linear-gradient(180deg, #fff9f0 0%, var(--bg) 100%);
}
body.dark-mode .hero { background: linear-gradient(180deg, rgba(15, 24, 35, 0.96), rgba(13, 23, 41, 1)); }

.hero-content {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 40px;
    align-items: center;
}

.welcome-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(124, 77, 255, 0.08);
    color: var(--secondary);
    font-weight: 700;
    border: 1px solid rgba(124, 77, 255, 0.18);
    border-radius: 999px;
    padding: 8px 16px;
}

.hero-text h1 {
    margin: 18px 0 16px;
    font-size: clamp(2.5rem, 4vw, 4.4rem);
    line-height: 1.2;
    font-family: "Fredoka", "Cairo", sans-serif;
}
.hero-text h1 span { display: block; color: var(--secondary); }
.hero-text p {
    max-width: 560px;
    margin: 0;
    color: var(--text-soft);
    font-size: 1.08rem;
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 28px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 22px;
    border-radius: 16px;
    font-weight: 800;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 24px rgba(117, 82, 176, 0.18);
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), #ffca73);
    color: #2a1a00;
}
.btn-secondary {
    background: var(--card);
    border: 1px solid var(--line);
    color: var(--text);
}

.hero-illustration {
    position: relative;
    width: min(100%, 520px);
    min-height: 430px;
    margin-inline: auto;
}

.cloud {
    position: absolute;
    font-size: 2.8rem;
    opacity: 0.7;
    animation: float 5s ease-in-out infinite;
}
.cloud-1 { top: 20px; left: 24px; }
.cloud-2 { top: 90px; right: 12px; animation-delay: 1.2s; }

.hero-book {
    position: absolute;
    left: 50%;
    top: 110px;
    width: 260px;
    height: 220px;
    transform: translateX(-50%) rotate(-4deg);
    background: linear-gradient(135deg, #9ec8ff, #d3e9ff);
    border-radius: 26px;
    box-shadow: var(--shadow);
    border: 10px solid rgba(255, 255, 255, 0.9);
    display: flex;
    padding: 16px;
    gap: 12px;
}
.book-page {
    flex: 1;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.7);
    display: grid;
    place-items: center;
    font-size: 3.5rem;
}
.hero-character {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 5rem;
    animation: bob 3s ease-in-out infinite;
}
.floating-star {
    position: absolute;
    font-size: 2rem;
    animation: twinkle 2.8s ease-in-out infinite;
}
.star-1 { top: 160px; left: 40px; }
.star-2 { bottom: 120px; right: 50px; animation-delay: 0.8s; }
.star-3 { bottom: 80px; left: 90px; animation-delay: 1.5s; }

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
}
.section-label {
    display: inline-block;
    color: var(--secondary);
    font-weight: 800;
    margin-bottom: 8px;
}
.section-heading h2 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 1.3;
}
.view-all { color: var(--text-soft); font-weight: 700; }

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
}
.category-card {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    align-items: center;
    gap: 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 22px 18px;
    box-shadow: var(--shadow);
    transition: transform 0.25s ease;
}
.category-card:hover { transform: translateY(-4px); }
.category-blue { background: linear-gradient(135deg, rgba(117, 201, 255, 0.15), rgba(255, 255, 255, 0.7)); }
.category-green { background: linear-gradient(135deg, rgba(108, 222, 176, 0.15), rgba(255, 255, 255, 0.7)); }
.category-purple { background: linear-gradient(135deg, rgba(193, 163, 255, 0.17), rgba(255, 255, 255, 0.7)); }
.category-gold { background: linear-gradient(135deg, rgba(245, 199, 92, 0.15), rgba(255, 255, 255, 0.7)); }
.category-icon {
    width: 62px;
    height: 62px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
    display: grid;
    place-items: center;
    font-size: 2rem;
}
.category-info h3 { margin: 0 0 4px; font-size: 1.2rem; }
.category-info p { margin: 0 0 8px; color: var(--text-soft); font-size: 0.9rem; }
.category-count { color: var(--text-soft); font-weight: 700; font-size: 0.8rem; }
.category-arrow { font-size: 1.5rem; color: var(--text); }

.books-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
}
.book-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 26px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.book-cover {
    position: relative;
    height: 220px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    padding: 18px 18px 14px;
    font-size: 2.8rem;
}
.cover-blue { background: linear-gradient(135deg, #8ec5ff, #d8ecff); }
.cover-green { background: linear-gradient(135deg, #9ae6b4, #d7f9e8); }
.cover-purple { background: linear-gradient(135deg, #d8c6ff, #f0e6ff); }
.cover-orange { background: linear-gradient(135deg, #ffd7ab, #fff0d4); }
.cover-gold { background: linear-gradient(135deg, #f7d57b, #fff2bc); }
.cover-pink { background: linear-gradient(135deg, #ffc7d6, #ffe6ee); }
.book-emoji { font-size: 3rem; }
.book-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 6px 11px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    font-size: 0.72rem;
    font-weight: 800;
}
.book-badge.english {
    background: rgba(124, 77, 255, 0.12);
    color: var(--secondary);
}
.favorite-btn {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.9);
    font-size: 1.4rem;
    color: var(--text);
}
.favorite-btn.active {
    background: rgba(255, 107, 107, 0.14);
    color: var(--danger);
}
.book-info { padding: 18px 18px 20px; }
.book-category {
    display: inline-block;
    color: var(--secondary);
    font-size: 0.8rem;
    font-weight: 800;
    background: rgba(124, 77, 255, 0.08);
    border-radius: 999px;
    padding: 6px 10px;
}
.book-info h3 { margin: 14px 0 10px; font-size: 1.5rem; }
.book-info p { margin: 0 0 16px; color: var(--text-soft); }
.book-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-soft);
    font-weight: 700;
}
.book-footer a { color: var(--text); font-weight: 800; }

.age-section { background: rgba(124, 77, 255, 0.03); }
.age-box {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 30px;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 30px;
    box-shadow: var(--shadow);
    padding: 30px;
}
.age-content h2 { margin: 0 0 8px; font-size: clamp(2rem, 3vw, 2.8rem); }
.age-content p { margin: 0; color: var(--text-soft); }
.age-options {
    display: flex;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
}
.age-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 140px;
    min-height: 150px;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 183, 3, 0.08), rgba(255, 255, 255, 0.8));
    padding: 18px 12px;
    transition: transform 0.25s ease;
}
.age-card:hover { transform: translateY(-4px); }
.age-card span { font-size: 2.6rem; }
.age-card strong { font-size: 1.7rem; margin-top: 8px; }
.age-card small { color: var(--text-soft); }

.footer {
    background: #1a2337;
    color: #dfe8f5;
    padding-top: 56px;
}
.footer-content {
    display: grid;
    grid-template-columns: 1.3fr 0.8fr 0.9fr;
    gap: 30px;
}
.footer-brand p, .footer-links a { color: rgba(223, 232, 245, 0.8); }
.footer-brand .logo { margin-bottom: 16px; }
.footer-links h4 { margin: 0 0 16px; font-size: 1.2rem; }
.footer-links a { display: block; margin-bottom: 10px; }
.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin-top: 28px;
    text-align: center;
    padding: 18px 0 22px;
    color: rgba(223, 232, 245, 0.7);
}

.page-header { padding: 60px 0 34px; }
.page-header h1 { margin: 0 0 10px; font-size: clamp(2.2rem, 4vw, 3.3rem); }
.page-header p { margin: 0; color: var(--text-soft); max-width: 700px; }

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    margin: 20px 0 28px;
}
.filter-group { display: flex; flex-wrap: wrap; gap: 10px; }
.filter-btn {
    padding: 10px 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text-soft);
    font-weight: 700;
}
.filter-btn.active {
    background: linear-gradient(135deg, var(--primary), #ffd98f);
    border-color: transparent;
    color: #2e2000;
}
.search-box { min-width: min(340px, 100%); }
.search-box input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
}
.empty-state {
    grid-column: 1 / -1;
    background: var(--card);
    border: 1px dashed var(--line);
    border-radius: 22px;
    padding: 34px 20px;
    text-align: center;
    color: var(--text-soft);
}

.detail-layout { padding: 30px 0 80px; }
.book-detail {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 28px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 24px;
}
.detail-cover {
    position: relative;
    min-height: 420px;
    border-radius: 26px;
    display: flex;
    align-items: end;
    justify-content: center;
    padding: 24px;
    font-size: 5rem;
}
.detail-info h1 { margin: 0 0 8px; font-size: clamp(2rem, 2.8vw, 2.8rem); }
.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
}
.detail-meta span {
    background: rgba(124, 77, 255, 0.08);
    color: var(--secondary);
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 800;
}
.detail-info p { color: var(--text-soft); margin: 0 0 20px; }
.rating-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    font-weight: 800;
    color: var(--text);
}
.read-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary), #ffd98f);
    border-radius: 16px;
    font-weight: 900;
    color: #2a1a00;
}

.quran-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}
.quran-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 22px;
}
.quran-number {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 183, 3, 0.15);
    color: #7d5b12;
    font-weight: 800;
}
.quran-card h3 { margin: 16px 0 8px; font-size: 1.5rem; }
.quran-card p { margin: 0; color: var(--text-soft); }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}
@keyframes bob {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-8px); }
}
@keyframes twinkle {
    0%, 100% { opacity: 0.5; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.08); }
}
