/* Al Zuhra Academy — Premium Article Design System */

:root {
    --primary: #059669;
    --primary-dark: #065f46;
    --primary-light: #d1fae5;
    --primary-glow: rgba(5, 150, 105, 0.2);
    --slate-950: #0f172a;
    --slate-900: #1e293b;
    --slate-700: #334155;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --white: #ffffff;
    --bg-paper: #f8fafc;
    --nav-height: 80px;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-paper);
    color: var(--slate-700);
    line-height: 1.85;
    padding-top: var(--nav-height);
}

.glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--slate-200);
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ar {
    font-family: 'Lateef', cursive;
    font-size: 1.5em;
    color: var(--primary);
    display: inline;
    vertical-align: sub;
    line-height: 1;
    font-weight: 400;
}

/* ═══════════════════════════════════════════════════════
   ARTICLE READER — Centered 75% Width Layout
   ═══════════════════════════════════════════════════════ */
.article-reader {
    max-width: 1100px;
    margin: 0 auto;
    padding: 4rem 1.5rem 8rem;
    animation: fadeInUp 0.8s ease-out;
}

/* ─── Hero ─── */
.article-header-wrap { margin-bottom: 3rem; }

.article-hero-image {
    width: 100%;
    aspect-ratio: 21 / 9;
    border-radius: 1.5rem;
    overflow: hidden;
    margin-bottom: 2.5rem;
    box-shadow: 0 25px 60px -15px rgba(0,0,0,0.1);
}

.article-hero-image img { width: 100%; height: 100%; object-fit: cover; }

.article-headline {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    line-height: 1.05;
    color: var(--slate-950);
    text-align: center;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.article-subheadline {
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    font-weight: 600;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--slate-500);
}

/* ─── Meta Bar ─── */
.article-meta-pill {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--slate-100);
    border-top: 1px solid var(--slate-100);
    margin-bottom: 3rem;
    background: rgba(255,255,255,0.5);
    border-radius: 1rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}
.article-meta-pill::-webkit-scrollbar { display: none; }

.meta-item { 
    display: flex; 
    align-items: center; 
    gap: 0.5rem; 
    font-size: 0.85rem; 
    font-weight: 600; 
    color: var(--slate-500);
}

.meta-item span.icon { 
    color: var(--primary); 
    font-size: 1.1rem;
    font-variation-settings: 'FILL' 1;
}

.meta-badge {
    padding: 0.35rem 0.9rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.meta-divider {
    width: 5px;
    height: 5px;
    background: var(--slate-300);
    border-radius: 50%;
}

/* ═══════════════════════════════════════════════════════
   PREMIUM TABLE OF CONTENTS — Accordion Style
   ═══════════════════════════════════════════════════════ */
.prose-toc {
    background: linear-gradient(145deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.95) 100%);
    border: 1px solid var(--slate-200);
    border-radius: 1.25rem;
    padding: 1.5rem;
    margin-bottom: 2.5rem;
    box-shadow: 
        0 4px 24px -4px rgba(0,0,0,0.05),
        0 1px 0 rgba(255,255,255,0.9) inset;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.prose-toc:hover {
    box-shadow: 
        0 8px 32px -8px rgba(0,0,0,0.08),
        0 1px 0 rgba(255,255,255,0.9) inset;
    border-color: rgba(5, 150, 105, 0.2);
}

/* TOC Header */
.prose-toc-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    cursor: pointer;
    user-select: none;
}

.prose-toc-header .toc-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
    flex-shrink: 0;
}

.prose-toc-header span {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    color: var(--slate-900);
    letter-spacing: -0.01em;
}

/* Expand Arrow */
.prose-toc-header::after {
    content: 'expand_more';
    font-family: 'Material Symbols Outlined';
    font-size: 1.5rem;
    color: var(--primary);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    margin-left: auto;
}

.prose-toc.is-open .prose-toc-header::after {
    transform: rotate(180deg);
}

/* TOC Links Container */
.prose-toc-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--slate-100);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.prose-toc.is-open .prose-toc-links {
    max-height: 1000px;
    opacity: 1;
}

/* Progress Bar */
.prose-toc-progress {
    display: none;
}

/* TOC Links */
.prose-toc-links a {
    text-decoration: none;
    color: var(--slate-600);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.6);
    overflow: hidden; /* For container safety */
}

/* Ensure child text span handles truncation */
.toc-text {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1; /* Take all available space */
    min-width: 0; /* Important for flex-basis & ellipsis */
}

.prose-toc-links a:hover {
    color: var(--primary-dark);
    background: var(--primary-light);
    border-color: rgba(5, 150, 105, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px -4px rgba(5, 150, 105, 0.15);
}

.prose-toc-links a.active {
    color: white;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: transparent;
    font-weight: 700;
    box-shadow: 0 4px 16px -4px rgba(5, 150, 105, 0.4);
}

.prose-toc-links a.active .toc-num {
    color: rgba(255,255,255,0.8);
}

.toc-num {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--slate-400);
    min-width: 20px;
    transition: all 0.3s ease;
}

/* ═══════════════════════════════════════════════════════
   PREMIUM PROSE — Article Content
   ═══════════════════════════════════════════════════════ */
.prose {
    font-size: 1.1rem;
    line-height: 1.95;
    color: var(--slate-700);
    max-width: 100%;
}

.prose h2 {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 800;
    color: var(--primary-dark);
    margin: 3.5rem 0 1.25rem;
    padding-top: 1.5rem;
    position: relative;
    letter-spacing: -0.02em;
}

/* Accent line before heading */
.prose h2::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 45px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 999px;
}

.prose p { 
    margin-bottom: 1.5rem;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
}

.prose a.backlink {
    color: var(--primary);
    text-decoration: none;
}

.prose a.backlink:hover {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-color: var(--primary);
}

.prose h2 + p {
    margin-top: 0.5rem;
}

.prose b, .prose strong { 
    color: var(--slate-900); 
    font-weight: 800; 
}

.prose i, .prose em { 
    color: var(--primary-dark); 
    font-style: italic; 
}

.prose section[id] {
    scroll-margin-top: 120px;
}

/* ═══════════════════════════════════════════════════════
   PREMIUM CALLOUTS — Quran & Hadith
   ═══════════════════════════════════════════════════════ */
.quran-quote-box {
    padding: 2rem 2rem 2rem 2.5rem;
    margin: 3rem 0;
    border-left: 5px solid var(--primary);
    border-radius: 0 1.25rem 1.25rem 0;
    display: flex;
    gap: 1.25rem;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.04) 0%, rgba(255,255,255,0.8) 100%);
    border-top: 1px solid rgba(5, 150, 105, 0.08);
    border-bottom: 1px solid rgba(5, 150, 105, 0.08);
    border-right: 1px solid rgba(5, 150, 105, 0.08);
    position: relative;
    box-shadow: 0 4px 20px -8px rgba(5, 150, 105, 0.1);
}

.quran-quote-box::before {
    content: '"';
    position: absolute;
    top: -5px;
    left: 25px;
    font-family: 'Amiri', serif;
    font-size: 6rem;
    color: var(--primary);
    opacity: 0.08;
    line-height: 1;
}

.quote-icon { 
    font-size: 1.75rem; 
    color: var(--primary); 
    opacity: 0.5; 
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.quote-text { 
    font-size: 1.15rem;
    font-style: italic; 
    font-weight: 500; 
    margin-bottom: 0.75rem; 
    color: var(--slate-900); 
    line-height: 1.7;
}

.quote-ref { 
    font-size: 0.75rem; 
    font-weight: 800; 
    color: var(--primary-dark); 
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.hadith-quote-box {
    padding: 1.75rem 2rem;
    margin: 3rem 0;
    border-radius: 1rem;
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.05) 0%, rgba(255,255,255,0.7) 100%);
    border: 1px solid rgba(16, 185, 129, 0.12);
    border-left: 4px solid var(--primary);
    position: relative;
}

.hadith-label { 
    display: flex; 
    align-items: center; 
    gap: 0.5rem; 
    color: var(--primary-dark); 
    font-weight: 800; 
    font-size: 0.75rem; 
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(5, 150, 105, 0.1);
}

.hadith-quote-box .quote-text {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

/* ─── Premium Cards ─── */
.premium-card {
    background: linear-gradient(145deg, rgba(255,255,255,1) 0%, rgba(248,250,252,0.9) 100%);
    border: 1px solid var(--slate-200);
    border-radius: 1rem;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: 0 4px 20px -4px rgba(0,0,0,0.04);
}

.premium-card h3 {
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.premium-card ul {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.premium-card ul li {
    list-style: none;
    position: relative;
    padding-left: 1.75rem;
    padding-top: 0.5rem;
    font-size: 0.95rem;
    color: var(--slate-700);
}

.premium-card ul li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 0.55rem;
    color: var(--primary);
    font-weight: 900;
}

/* ─── Lists ─── */
.prose ul, .prose ol {
    margin: 1.5rem 0 1.75rem;
    padding-left: 1.5rem;
}

.prose li {
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
    line-height: 1.75;
}

.prose ul li {
    position: relative;
    padding-left: 1.25rem;
}

.prose ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.7rem;
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
}

/* ═══════════════════════════════════════════════════════
   CTA & NAVIGATION
   ═══════════════════════════════════════════════════════ */
.enrollment-cta {
    margin-top: 5rem;
    padding: 4rem 3rem;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--slate-950) 100%);
    color: var(--white);
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 25px 80px -20px rgba(5, 150, 105, 0.35);
}

.enrollment-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 0%, rgba(43, 238, 108, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.enrollment-cta h2 { 
    font-size: 2rem !important; 
    font-weight: 900 !important; 
    color: white !important; 
    margin-bottom: 1rem !important;
    position: relative;
}

.enrollment-cta p { 
    font-size: 1.1rem; 
    color: rgba(255,255,255,0.75); 
    max-width: 600px; 
    margin: 0 auto 2rem !important;
    position: relative;
}

.btn-cta {
    display: inline-flex;
    padding: 1rem 2.5rem;
    background: var(--primary);
    color: white !important;
    border-radius: 99px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-decoration: none !important;
    box-shadow: 0 8px 24px -6px rgba(5, 150, 105, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px -8px rgba(5, 150, 105, 0.5);
}

/* ─── Nav Grid ─── */
.nav-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 4rem;
}

.nav-card {
    padding: 1.5rem;
    border-radius: 1rem;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: rgba(255,255,255,0.8);
    border: 1px solid var(--slate-200);
    transition: all 0.3s ease;
}

.nav-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px -8px rgba(5, 150, 105, 0.2);
}

.nav-card .icon { 
    color: var(--slate-400); 
    font-size: 1.5rem;
    transition: color 0.3s ease; 
}

.nav-card:hover .icon,
.nav-card:hover .nav-article-title { 
    color: var(--primary) !important; 
}

.nav-text-top { 
    font-size: 0.65rem; 
    font-weight: 800; 
    color: var(--slate-400); 
    text-transform: uppercase; 
    letter-spacing: 0.12em; 
    margin-bottom: 0.35rem; 
}

.nav-article-title { 
    font-size: 1rem; 
    font-weight: 800; 
    color: var(--slate-900); 
    transition: color 0.3s ease;
    line-height: 1.4;
}

/* ─── Sticky CTA ─── */
.sticky-cta-wrap {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: calc(100% - 2rem);
    max-width: 400px;
}

.btn-sticky {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    width: 100%;
    border-radius: 16px;
    border: none;
    color: white !important;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    text-decoration: none !important;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 
        0 8px 24px -6px rgba(5, 150, 105, 0.45),
        0 0 0 1px rgba(255,255,255,0.1) inset;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.btn-sticky::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s ease;
}

.btn-sticky:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 16px 40px -10px rgba(5, 150, 105, 0.55),
        0 0 0 1px rgba(255,255,255,0.15) inset;
}

.btn-sticky:hover::before {
    left: 100%;
}

.btn-sticky .material-symbols-outlined {
    font-size: 1.25rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* ═══════════════════════════════════════════════════════
   PREMIUM BOOK MENU — Discovery Hub
   ═══════════════════════════════════════════════════════ */
.premium-book-panel {
    margin: 4rem 0;
    padding: 2rem;
    border-radius: 2rem;
    background: linear-gradient(145deg, rgba(255,255,255,1) 0%, rgba(248,250,252,0.9) 100%);
    border: 1px solid rgba(5, 150, 105, 0.15);
    box-shadow: 0 20px 50px -20px rgba(0,0,0,0.06);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.panel-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.panel-tag {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--primary);
    display: block;
    margin-bottom: 2px;
}

.panel-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--slate-900);
    margin: 0;
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.panel-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 1px solid var(--slate-100);
    border-radius: 1.25rem;
    text-decoration: none !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px -8px rgba(5, 150, 105, 0.2);
}

.item-thumb {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--slate-100);
}

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

.item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--slate-900);
    line-height: 1.3;
}

.item-meta {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--slate-500);
}

.panel-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--slate-100);
    text-align: center;
}

.panel-more-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: transform 0.2s;
}

.panel-more-link:hover {
    transform: translateX(5px);
    color: var(--primary-dark);
}

.panel-more-link .material-symbols-outlined {
    font-size: 1.1rem;
}

/* ═══════════════════════════════════════════════════════
   GLOBAL UX IMPROVEMENTS — Blue Highlight Removal
   ═══════════════════════════════════════════════════════ */
* {
    -webkit-tap-highlight-color: transparent !important;
}

:focus {
    outline: none !important;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — Mobile Optimizations
   ═══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .prose-toc-links {
        grid-template-columns: repeat(2, 1fr);
    }
    /* Hide sticky CTA on anything but Desktop */
    .sticky-cta-wrap {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .article-reader {
        padding: 2.5rem 1rem 6rem;
    }

    .article-meta-pill { 
        gap: 0.75rem; 
        padding: 1rem;
        justify-content: flex-start;
    }
    
    .meta-item { font-size: 0.75rem; }
    .meta-badge { font-size: 0.65rem; padding: 0.25rem 0.7rem; }
    .meta-divider { display: none; }

    .prose-toc {
        padding: 1.25rem;
        margin-bottom: 2rem;
    }

    .prose-toc-header .toc-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .prose-toc-links {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .prose-toc-links a {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    .prose { 
        font-size: 1.05rem;
        line-height: 1.85;
    }

    .prose h2 {
        font-size: 1.4rem;
        margin: 2.5rem 0 1rem;
    }

    .prose p {
        text-align: left;
    }

    .quran-quote-box {
        padding: 1.5rem 1.25rem 1.5rem 1.75rem;
        margin: 2rem 0;
    }

    .quote-text {
        font-size: 1.05rem;
    }

    .hadith-quote-box {
        padding: 1.25rem;
        margin: 2rem 0;
    }

    .enrollment-cta { 
        padding: 3rem 1.5rem;
        margin-top: 3rem;
        border-radius: 1rem;
    }

    .enrollment-cta h2 {
        font-size: 1.5rem !important;
    }

    .enrollment-cta p {
        font-size: 1rem;
    }

    .nav-card-grid { 
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .panel-grid {
        grid-template-columns: 1fr;
    }
    
    .premium-book-panel {
        padding: 1.5rem;
        border-radius: 1.5rem;
    }
}

@media (max-width: 480px) {
    .prose-toc-links {
        grid-template-columns: 1fr;
    }
}
