/* ============================================================
   QURAN PAGES – استایل صفحات دسته‌بندی و سوره
   نسخه: 2.0
   شامل: کارت‌های معجزات، صفحه سوره، متن عربی با خط عثمان طه
   ============================================================ */

/* ============================================================
   FONT: Amiri Quran (جایگزین عثمان طه)
   فونت بهینه‌شده گوگل برای متن قرآن کریم
   ============================================================ */

/* بارگذاری فونت از Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Amiri+Quran&display=swap');

/* ============================================================
   بسم الله
   ============================================================ */
.bismillah {
    font-family: 'Amiri Quran', 'Amiri', 'Scheherazade New', serif;
    text-align: center;
    padding: 30px 20px 20px;
    font-size: 2rem;
    font-weight: 400;
    color: var(--gold-deep);
    direction: rtl;
    line-height: 2;
    /* فعال‌سازی لیگاتورها برای اتصال صحیح حروف */
    font-feature-settings: "liga" 1, "calt" 1;
    -webkit-font-feature-settings: "liga" 1, "calt" 1;
    text-rendering: optimizeLegibility;
}

html[data-theme="dark"] .bismillah {
    color: #f0c950;
}

/* ============================================================
   ظرف آیات
   ============================================================ */
.quran-verses {
    padding: 20px 30px 40px;
    direction: rtl;
    text-align: right;
    font-family: 'Amiri Quran', 'Amiri', 'Scheherazade New', 'Noto Naskh Arabic', serif;
    line-height: 2.8;
    font-size: 1.8rem;
    color: var(--text);
    word-spacing: 0.08em;
    letter-spacing: 0;
    font-feature-settings: "liga" 1, "calt" 1, "kern" 1;
    -webkit-font-feature-settings: "liga" 1, "calt" 1, "kern" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   صفحه دسته‌بندی – کارت‌های معجزات
   ============================================================ */
.miracles-grid-page {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    margin: 30px 0 50px;
}

.miracle-card-full {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: all .4s cubic-bezier(.2,.9,.3,1.2);
    box-shadow: 0 4px 16px rgba(0,0,0,.04);
    position: relative;
}

.miracle-card-full:hover {
    transform: translateY(-8px);
    box-shadow:
        0 20px 48px rgba(224,168,46,.18),
        0 4px 16px rgba(0,0,0,.08);
    border-color: var(--gold);
}

.miracle-card-full::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gold), var(--gold-deep));
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .4s;
    z-index: 3;
}

.miracle-card-full:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

.miracle-card-thumb {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: linear-gradient(135deg, #1a2b58, #0a1730);
}

.miracle-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .6s cubic-bezier(.2,.9,.3,1);
}

.miracle-card-full:hover .miracle-card-thumb img {
    transform: scale(1.08);
}

.miracle-card-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    background: linear-gradient(135deg, #1a2b58 0%, #0a1730 100%);
    color: rgba(240,201,80,.4);
}

.miracle-card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--gold), var(--gold-deep));
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .3px;
    box-shadow: 0 4px 12px rgba(224,168,46,.4);
    z-index: 2;
}

.miracle-card-surah {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0,0,0,.7);
    backdrop-filter: blur(8px);
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
    z-index: 2;
}

.miracle-card-body {
    padding: 18px 20px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.miracle-card-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 10px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.miracle-card-desc {
    font-size: .85rem;
    color: var(--text-soft);
    line-height: 1.8;
    margin: 0 0 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.miracle-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: .78rem;
    color: var(--text-mute);
    font-weight: 600;
}

.miracle-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ============================================================
   صفحه دسته‌بندی – هدر
   ============================================================ */
.category-hero {
    background:
        radial-gradient(ellipse 70% 60% at 50% 0%, rgba(224,168,46,.15), transparent 70%),
        linear-gradient(135deg, var(--bg-card) 0%, var(--bg-alt) 100%);
    border-bottom: 1px solid var(--border);
    padding: 50px 0 40px;
    margin-bottom: 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.category-hero-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--gold), var(--gold-deep));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    box-shadow:
        0 20px 40px rgba(224,168,46,.35),
        inset 0 2px 0 rgba(255,255,255,.4);
    animation: floatIcon 4s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

.category-hero-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--text);
    margin: 0 0 12px;
}

.category-hero-desc {
    font-size: 1rem;
    color: var(--text-soft);
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.9;
}

.category-hero-count {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 8px 20px;
    background: var(--gold-soft);
    color: var(--gold-deep);
    border-radius: 24px;
    font-size: .88rem;
    font-weight: 700;
}

/* ============================================================
   صفحه سوره – بخش متن عربی
   ============================================================ */
.quran-text-section {
    margin: 40px 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,.05);
}

.quran-text-header {
    background: linear-gradient(135deg, #1a2b58 0%, #0a1730 100%);
    color: #fff;
    padding: 20px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.quran-text-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 10% 30%, rgba(255,255,255,.5), transparent),
        radial-gradient(1px 1px at 40% 70%, rgba(240,201,80,.6), transparent),
        radial-gradient(1px 1px at 80% 40%, rgba(255,255,255,.4), transparent);
    background-size: 200px 200px;
    pointer-events: none;
}

.quran-text-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: #f9e7b3;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 2;
}

.quran-text-header-meta {
    display: flex;
    gap: 16px;
    font-size: .82rem;
    color: rgba(255,255,255,.7);
    position: relative;
    z-index: 2;
}

.quran-text-header-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================
   بسم الله – با خط عثمان طه
   ============================================================ */
.bismillah {
    font-family: 'Uthman Taha', 'Amiri Quran Fallback', 'Amiri Quran', 'Scheherazade New', 'Times New Roman', serif;
    text-align: center;
    padding: 30px 20px 20px;
    font-size: 2rem;
    font-weight: 400;
    color: var(--gold-deep);
    direction: rtl;
    letter-spacing: 0;
    line-height: 2;
    font-feature-settings: "liga" 1, "calt" 1;
    -webkit-font-feature-settings: "liga" 1, "calt" 1;
    text-rendering: optimizeLegibility;
}

html[data-theme="dark"] .bismillah {
    color: #f0c950;
}

/* ============================================================
   ظرف آیات – با خط عثمان طه
   ============================================================ */
.quran-verses {
    padding: 20px 30px 40px;
    direction: rtl;
    text-align: right;
    font-family: 'Uthman Taha', 'Amiri Quran Fallback', 'Amiri Quran', 'Scheherazade New', 'Noto Naskh Arabic', 'Times New Roman', serif;
    line-height: 2.8;
    font-size: 1.8rem;
    color: var(--text);
    word-spacing: 0.08em;
    letter-spacing: 0;
    font-feature-settings: "liga" 1, "calt" 1, "kern" 1;
    -webkit-font-feature-settings: "liga" 1, "calt" 1, "kern" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   آیه درون متن
   ============================================================ */
.quran-verse {
    display: inline;
    padding: 2px 4px;
    transition: background .3s;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
}

.quran-verse:hover {
    background: var(--gold-soft);
}

/* ============================================================
   شماره آیه
   ============================================================ */
.verse-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    margin: 0 6px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #f5cd5a, #e0a82e);
    color: #fff;
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    font-size: .75rem;
    font-weight: 800;
    vertical-align: middle;
    box-shadow:
        0 2px 6px rgba(224,168,46,.4),
        inset 0 1px 0 rgba(255,255,255,.5);
    border: 1.5px solid rgba(255,255,255,.5);
    /* اعداد داخل دایره همیشه لاتین بمانند تا با فونت عربی قاطی نشوند */
    direction: ltr;
}

/* ============================================================
   دکمه‌های کنترل متن قرآن
   ============================================================ */
.quran-text-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 24px;
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.quran-text-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 24px;
    color: var(--text-soft);
    font-family: inherit;
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .3s;
    text-decoration: none;
}

.quran-text-btn:hover {
    border-color: var(--gold);
    color: var(--gold-deep);
    background: var(--gold-soft);
    transform: translateY(-2px);
}

.quran-text-btn.active {
    background: linear-gradient(135deg, var(--gold), var(--gold-deep));
    color: #fff;
    border-color: var(--gold);
    box-shadow: 0 6px 16px rgba(224,168,46,.35);
}

/* ============================================================
   حالت‌های اندازه متن (با حفظ فونت عثمان طه)
   ============================================================ */
.quran-verses.size-small {
    font-size: 1.35rem;
    line-height: 2.4;
}

.quran-verses.size-large {
    font-size: 2.2rem;
    line-height: 3;
}

/* ============================================================
   ترجمه زیر آیه
   ============================================================ */
.verse-translation {
    display: block;
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    font-size: .82rem;
    color: var(--text-mute);
    margin: 4px 0 12px 0;
    padding: 6px 12px 6px 0;
    border-right: 3px solid var(--gold-soft);
    line-height: 1.9;
    direction: rtl;
    text-align: right;
}

/* ============================================================
   صفحه سوره – هدر سوره
   ============================================================ */
.surah-hero {
    background:
        radial-gradient(ellipse 70% 60% at 50% 0%, rgba(224,168,46,.18), transparent 70%),
        radial-gradient(ellipse 60% 50% at 80% 40%, rgba(109,74,255,.12), transparent 70%),
        linear-gradient(135deg, #0a1730 0%, #1a2b58 50%, #0a1730 100%);
    color: #fff;
    padding: 60px 0 50px;
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    margin: 20px 0 30px;
}

.surah-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(2px 2px at 15% 20%, rgba(255,255,255,.8), transparent),
        radial-gradient(1px 1px at 60% 40%, rgba(255,255,255,.6), transparent),
        radial-gradient(2px 2px at 80% 15%, rgba(240,201,80,1), transparent),
        radial-gradient(1px 1px at 30% 70%, rgba(255,255,255,.7), transparent);
    background-size: 400px 400px;
    animation: starDrift 60s linear infinite;
    pointer-events: none;
}

@keyframes starDrift {
    to { background-position: 400px 400px; }
}

.surah-hero-inner {
    position: relative;
    z-index: 2;
    text-align: center;
}

.surah-hero-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #f5cd5a, #e0a82e);
    color: #fff;
    border-radius: 50%;
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 20px;
    box-shadow:
        0 20px 40px rgba(224,168,46,.45),
        inset 0 2px 0 rgba(255,255,255,.5),
        0 0 60px rgba(240,201,80,.5);
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            0 20px 40px rgba(224,168,46,.45),
            inset 0 2px 0 rgba(255,255,255,.5),
            0 0 60px rgba(240,201,80,.5);
    }
    50% {
        transform: scale(1.05);
        box-shadow:
            0 25px 50px rgba(224,168,46,.55),
            inset 0 2px 0 rgba(255,255,255,.6),
            0 0 90px rgba(240,201,80,.7);
    }
}

.surah-hero-name {
    font-family: 'Uthman Taha', 'Amiri Quran Fallback', 'Vazirmatn', 'Tahoma', serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    margin: 0 0 12px;
    background: linear-gradient(135deg, #fff2c8, #f0c950, #fff2c8);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 2px;
    animation: titleShine 6s ease-in-out infinite;
    line-height: 1.5;
}

@keyframes titleShine {
    0%, 100% { background-position: 0% center; }
    50%      { background-position: 200% center; }
}

.surah-hero-meaning {
    font-size: 1.05rem;
    color: rgba(255,255,255,.75);
    margin: 0 0 24px;
    font-weight: 600;
}

.surah-hero-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.surah-hero-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 24px;
    background: rgba(255,255,255,.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(240,201,80,.3);
    border-radius: 16px;
    min-width: 120px;
}

.surah-hero-stat-value {
    font-size: 1.4rem;
    font-weight: 900;
    color: #f0c950;
}

.surah-hero-stat-label {
    font-size: .78rem;
    color: rgba(255,255,255,.7);
    font-weight: 600;
}

/* ============================================================
   چاپ متن قرآن
   ============================================================ */
@media print {
    .quran-text-section {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .quran-text-header {
        background: #fff !important;
        color: #000 !important;
        border-bottom: 2px solid #e0a82e;
    }

    .quran-text-header h2 {
        color: #b8841a !important;
    }

    .quran-text-header-meta {
        color: #666 !important;
    }

    .quran-verses {
        color: #000 !important;
        font-size: 16pt !important;
        line-height: 2 !important;
    }

    .quran-text-actions {
        display: none !important;
    }

    .verse-num {
        background: #e0a82e !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ============================================================
   ریسپانسیو
   ============================================================ */
@media (max-width: 900px) {
    .miracles-grid-page {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .category-hero-title { font-size: 1.7rem; }
    .category-hero-icon { width: 70px; height: 70px; font-size: 2.2rem; }

    .quran-verses {
        padding: 16px 20px 30px;
        font-size: 1.5rem;
        line-height: 2.5;
    }

    .quran-verses.size-small {
        font-size: 1.2rem;
        line-height: 2.2;
    }

    .quran-verses.size-large {
        font-size: 1.8rem;
        line-height: 2.8;
    }

    .bismillah {
        font-size: 1.7rem;
        padding: 24px 16px 16px;
    }

    .surah-hero {
        padding: 40px 0 36px;
        border-radius: 18px;
    }

    .surah-hero-number {
        width: 65px;
        height: 65px;
        font-size: 1.6rem;
    }

    .surah-hero-name {
        font-size: 1.9rem;
    }
}

@media (max-width: 600px) {
    .miracles-grid-page {
        grid-template-columns: 1fr;
    }

    .category-hero {
        padding: 36px 0 28px;
    }
    .category-hero-title { font-size: 1.4rem; }
    .category-hero-desc { font-size: .9rem; }

    .quran-text-header {
        padding: 16px 18px;
    }

    .quran-text-header h2 {
        font-size: 1rem;
    }

    .quran-verses {
        padding: 14px 16px 24px;
        font-size: 1.35rem;
        line-height: 2.3;
    }

    .quran-verses.size-small {
        font-size: 1.1rem;
        line-height: 2;
    }

    .quran-verses.size-large {
        font-size: 1.65rem;
        line-height: 2.6;
    }

    .bismillah {
        font-size: 1.5rem;
        padding: 20px 14px 12px;
    }

    .verse-num {
        min-width: 28px;
        height: 28px;
        font-size: .68rem;
    }

    .quran-text-actions {
        padding: 12px 14px;
        gap: 8px;
    }

    .quran-text-btn {
        padding: 8px 14px;
        font-size: .8rem;
    }

    .surah-hero {
        padding: 30px 0;
    }

    .surah-hero-stats {
        gap: 12px;
    }

    .surah-hero-stat {
        padding: 10px 16px;
        min-width: 100px;
    }
}