/* ==========================================================================
   AL HUDA QURAN ACADEMY - OFFICIAL STYLESHEET
   Design Standard: Luminous, Clean, Humanized, High-Contrast & Vibrant
   Strictly Zero Darkness / No Pitch Black / Pure Islamic Elegance
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Primary Islamic Palette - Crisp, Prestigious & Luminous */
    --color-emerald-deep: #064E3B;
    --color-emerald-primary: #065F46;
    --color-emerald-accent: #059669;
    --color-emerald-light: #ECFDF5;
    --color-emerald-tint: #D1FAE5;

    /* Warm Royal Gold / Amber Accents */
    --color-gold-dark: #92400E;
    --color-gold-primary: #D97706;
    --color-gold-vibrant: #F59E0B;
    --color-gold-light: #FEF3C7;
    --color-gold-border: #FCD34D;

    /* Crisp High-Key Backgrounds (Strictly Zero Darkness) */
    --bg-white: #FFFFFF;
    --bg-cream: #FDFCF7;
    --bg-pearl: #F8FAFC;
    --bg-sand: #F7F5EE;

    /* Sharp, High-Contrast Typography */
    --text-heading: #0F172A;
    --text-body: #334155;
    --text-muted: #64748B;
    --border-light: #E2E8F0;
    --border-accent: #CBD5E1;

    /* Organic Premium Shadows */
    --shadow-soft: 0 4px 20px -2px rgba(6, 95, 70, 0.06), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 16px 32px -4px rgba(6, 95, 70, 0.12), 0 6px 12px -2px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.05), 0 10px 25px -5px rgba(6, 95, 70, 0.07);
}

/* Base Reset & Typography (Hardware-Accelerated Smooth Natural Scrolling) */
html {
    scroll-behavior: auto;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-body);
    background-color: var(--bg-cream);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
}

body {
    background-color: var(--bg-cream);
    color: var(--text-body);
    overflow-x: clip;
    max-width: 100vw;
    line-height: 1.6;
}

/* Authentic Arabic Calligraphic Typography */
.font-arabic {
    font-family: 'Amiri', 'Traditional Arabic', serif;
    direction: rtl;
    line-height: 1.8;
}

.arabic-bismillah {
    font-family: 'Amiri', serif;
    font-size: 2.2rem;
    color: var(--color-emerald-primary);
    text-shadow: 0 1px 2px rgba(6, 95, 70, 0.1);
}

/* Luminous Executive Academic Header Banner (Zero Repeating Dots, Zero Murky Darkness) */
.bg-islamic-pattern,
.page-header-luminous {
    background-color: #FFFFFF;
    background-image: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 35%, #F0FDF4 70%, #FEFCE8 100%);
    position: relative;
    box-shadow: 0 4px 20px -4px rgba(6, 95, 70, 0.03);
}

.bg-islamic-geometric {
    background-color: #FCFBF7;
    background-image:
        radial-gradient(circle at 100% 0%, rgba(5, 150, 105, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 0% 100%, rgba(217, 119, 6, 0.07) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.04) 0%, transparent 50%);
}

.hero-glow-emerald {
    position: absolute;
    width: 32rem;
    height: 32rem;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, rgba(5, 150, 105, 0.03) 50%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    transform: translateZ(0);
}

.hero-glow-gold {
    position: absolute;
    width: 26rem;
    height: 26rem;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.10) 0%, rgba(217, 119, 6, 0.02) 50%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    transform: translateZ(0);
}

.badge-islamic-pill {
    background: linear-gradient(135deg, rgba(236, 253, 245, 0.95) 0%, rgba(254, 243, 199, 0.65) 100%);
    border: 1px solid rgba(167, 243, 208, 0.9);
    box-shadow: 0 4px 14px -2px rgba(6, 95, 70, 0.08);
}

.bg-pattern-subtle {
    background-color: #FFFFFF;
    background-image: linear-gradient(180deg, #FAFAF7 0%, #FFFFFF 100%);
}

/* Card Styling - Bright, Sharp, Elegant */
.card-luminous {
    background: #FFFFFF;
    border: 1px solid var(--border-light);
    border-radius: 1rem;
    box-shadow: var(--shadow-card);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card-luminous:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: #A7F3D0;
}

/* Interactive Badge Tokens - Prominent & Highly Visible */
.badge-gold {
    background-color: #FEF3C7;
    color: #92400E;
    border: 1px solid #FCD34D;
    font-weight: 800;
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 1px 3px rgba(217, 119, 6, 0.15);
}

.badge-emerald {
    background-color: #ECFDF5;
    color: #065F46;
    border: 1px solid #A7F3D0;
    font-weight: 800;
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 1px 3px rgba(6, 95, 70, 0.12);
}

/* Custom Buttons with Humanized Tactile Feel */
.btn-primary-emerald,
.btn-emerald {
    background: linear-gradient(135deg, #065F46 0%, #044E39 100%);
    color: #FFFFFF;
    font-weight: 600;
    padding: 0.75rem 1.75rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(6, 95, 70, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #044E39;
    cursor: pointer;
}

.btn-primary-emerald:hover,
.btn-emerald:hover {
    background: linear-gradient(135deg, #044E39 0%, #022C20 100%);
    box-shadow: 0 6px 18px rgba(6, 95, 70, 0.35);
    transform: translateY(-1px);
    color: #FFFFFF;
}

.btn-accent-gold {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: #FFFFFF;
    font-weight: 700;
    padding: 0.75rem 1.75rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #B45309;
    cursor: pointer;
}

.btn-accent-gold:hover {
    background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
    box-shadow: 0 6px 18px rgba(217, 119, 6, 0.35);
    transform: translateY(-1px);
    color: #FFFFFF;
}

.btn-outline-emerald {
    background: #FFFFFF;
    color: #065F46;
    border: 2px solid #065F46;
    font-weight: 600;
    padding: 0.7rem 1.6rem;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-outline-emerald:hover {
    background-color: #ECFDF5;
    border-color: #044E39;
    color: #044E39;
    transform: translateY(-1px);
}

/* Interactive Tajweed Reciter Audio Studio */
.tajweed-player-box {
    background: #FFFFFF;
    border: 1px solid #A7F3D0;
    border-left: 5px solid #059669;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: var(--shadow-soft);
}

.audio-equalizer-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2.5px;
    height: 14px;
}

.audio-equalizer-bars span {
    display: inline-block;
    width: 3px;
    background-color: currentColor;
    border-radius: 2px;
    height: 4px;
    transition: height 0.15s ease;
}

.audio-equalizer-bars.is-active span:nth-child(1) {
    animation: eqBounce 0.8s ease-in-out infinite alternate;
}

.audio-equalizer-bars.is-active span:nth-child(2) {
    animation: eqBounce 0.6s ease-in-out infinite 0.2s alternate;
}

.audio-equalizer-bars.is-active span:nth-child(3) {
    animation: eqBounce 0.9s ease-in-out infinite 0.1s alternate;
}

.audio-equalizer-bars.is-active span:nth-child(4) {
    animation: eqBounce 0.7s ease-in-out infinite 0.3s alternate;
}

@keyframes eqBounce {
    0% {
        height: 3px;
    }

    50% {
        height: 14px;
    }

    100% {
        height: 6px;
    }
}

.audio-progress-track {
    width: 100%;
    height: 6px;
    background: #E2E8F0;
    border-radius: 9999px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.audio-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #059669, #10B981);
    border-radius: 9999px;
    width: 0%;
    transition: width 0.1s linear;
}

.audio-progress-track:hover .audio-progress-fill {
    background: linear-gradient(90deg, #047857, #059669);
}

/* Floating WhatsApp Quick Action Button */
.whatsapp-floating {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    background: #25D366;
    color: #FFFFFF;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.whatsapp-floating:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 28px rgba(37, 211, 102, 0.5);
    color: #FFFFFF;
}

/* Toast Notification Styles */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast-message {
    pointer-events: auto;
    background: #FFFFFF;
    color: #0F172A;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
    border-left: 5px solid #065F46;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 440px;
    animation: toastSlideIn 0.3s ease-out forwards;
    font-size: 0.925rem;
}

.toast-message.success {
    border-left-color: #059669;
}

.toast-message.error {
    border-left-color: #DC2626;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Accordion Smooth Transition */
.accordion-header {
    cursor: pointer;
    user-select: none;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-out, padding 0.35s ease-out;
}

.accordion-item.active .accordion-content {
    max-height: 500px;
    padding-top: 1rem;
}

.accordion-item.active .accordion-chevron {
    transform: rotate(180deg);
}

/* Sticky Header with Frosted Glass over Bright White (Hardware-Accelerated Layer) */
.navbar-luminous {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    position: sticky;
    top: 0;
    z-index: 50;
    transform: translateZ(0);
    will-change: transform;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

/* Responsive Table Wrappers */
.table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.75rem;
    border: 1px solid var(--border-light);
    background: #FFFFFF;
}

/* Clean Form Controls */
.form-input-luminous {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid #CBD5E1;
    border-radius: 0.65rem;
    background-color: #FFFFFF;
    color: #0F172A;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input-luminous:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.form-label-luminous {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: #1E293B;
    margin-bottom: 0.4rem;
}

/* Animations & Micro-Interactions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Text & Heading Overflow Safeguards */
h1, h2, h3, h4, h5, h6, p, span, a, button {
    overflow-wrap: break-word;
}

/* Horizontal Filter Pill Swiping on Mobile (Zero Broken Wraps & Native Smooth Scroll) */
.pills-scroll-container,
#books-category-pills,
#faculty-filter-buttons {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.pills-scroll-container::-webkit-scrollbar,
#books-category-pills::-webkit-scrollbar,
#faculty-filter-buttons::-webkit-scrollbar {
    display: none;
}

/* Mobile Sidebar Drawer */
#mobile-sidebar-backdrop {
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#mobile-sidebar {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -6px 0 28px rgba(0, 0, 0, 0.2);
}

body.overflow-hidden {
    overflow: hidden !important;
}

/* Mobile Viewport Safety, Typography & Layout Enhancements */
@media (max-width: 640px) {
    /* Critical iOS Safari & WebKit Viewport Zoom Glitch Fix:
       Ensures inputs are at least 16px to prevent auto-zooming into form fields */
    input,
    select,
    textarea,
    .form-input-luminous {
        font-size: 16px !important;
    }

    /* Humanized Mobile Touch Tap Target Size (Min 44px) */
    button,
    .btn-emerald,
    a.btn-primary-emerald,
    a.btn-accent-gold,
    a.btn-outline-emerald {
        min-height: 44px;
    }

    /* Floating WhatsApp Button Mobile Optimization */
    .whatsapp-floating {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
        font-size: 1.35rem;
    }

    /* Toast Notification Positioning for Mobile (Edge-to-Edge Safe Padding) */
    #toast-container {
        top: 12px;
        left: 12px;
        right: 12px;
        max-width: none;
    }

    .toast-message {
        min-width: 0;
        width: 100%;
        max-width: 100%;
        font-size: 0.85rem;
        padding: 0.75rem 1rem;
    }

    /* Arabic Calligraphy Responsive Scaling */
    .arabic-bismillah {
        font-size: 1.65rem;
    }

    .badge-islamic-pill {
        white-space: normal;
    }

    .card-luminous {
        border-radius: 0.875rem;
    }
}

/* Prestigious World-Class Academy Footer Styles (Regal Midnight-Emerald & Metallic Gold) */
.footer-vibrant-bg {
    background: radial-gradient(circle at 50% 0%, #08261e 0%, #051914 40%, #020b08 100%);
    position: relative;
    color: #E2E8F0;
    border-top: 2px solid #C5A059;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

.footer-hero-band {
    background: linear-gradient(135deg, #092a21 0%, #0c362a 50%, #08241c 100%);
    border-bottom: 1px solid rgba(197, 160, 89, 0.22);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.35);
}

.footer-col-title {
    font-size: clamp(1.15rem, 1.8vw, 1.35rem) !important;
    font-weight: 900 !important;
    color: #E2C37E !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.35rem;
    position: relative;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(197, 160, 89, 0.22);
}

.footer-col-title-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: rgba(197, 160, 89, 0.12);
    border: 1px solid rgba(197, 160, 89, 0.35);
    font-size: 1.05rem;
    flex-shrink: 0;
}

.footer-col-title-line {
    position: absolute;
    bottom: -1px;
    left: 0;
    height: 2.5px;
    width: 3.25rem;
    background: linear-gradient(90deg, #D4AF37, #E5C07B, transparent);
    border-radius: 9999px;
}

.footer-vibrant-bg h4 {
    font-size: clamp(1.15rem, 1.8vw, 1.35rem) !important;
    font-weight: 900 !important;
    color: #E2C37E !important;
}

.footer-vibrant-bg h5 {
    font-size: clamp(1.05rem, 1.6vw, 1.25rem) !important;
    font-weight: 900 !important;
    color: #F3E5AB !important;
}

.footer-link-item {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: #CBD5E1 !important;
    font-size: 1rem !important;
    line-height: 1.4;
    padding: 0.4rem 0.55rem;
    border-radius: 0.5rem;
    font-weight: 600 !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.footer-link-item:hover {
    color: #F5E6C8 !important;
    background: rgba(197, 160, 89, 0.1);
    transform: translateX(4px);
}

.footer-link-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 0.35rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(197, 160, 89, 0.28);
    color: #C5A059;
    font-size: 0.85rem;
    font-weight: 800;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.footer-link-item:hover .footer-link-arrow {
    background: #C5A059;
    color: #061612;
    border-color: #D4AF37;
    transform: scale(1.08);
}

.footer-contact-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(197, 160, 89, 0.22);
    border-radius: 0.85rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: #FFFFFF;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(8px);
}

.footer-contact-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(197, 160, 89, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.footer-standard-card {
    background: linear-gradient(145deg, rgba(8, 30, 24, 0.85) 0%, rgba(4, 16, 13, 0.95) 100%);
    border: 1px solid rgba(197, 160, 89, 0.35);
    border-radius: 1.25rem;
    padding: 1.5rem 1.65rem;
    box-shadow: 0 12px 36px -4px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.footer-social-btn {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(197, 160, 89, 0.28);
    color: #E2E8F0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.footer-social-btn:hover {
    background: #C5A059;
    border-color: #D4AF37;
    color: #061612;
    transform: translateY(-2px) scale(1.08);
    box-shadow: 0 4px 14px rgba(197, 160, 89, 0.4);
}

/* Modal Scale-In Animation */
@keyframes scaleInModal {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.animate-scaleIn {
    animation: scaleInModal 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ==========================================================================
   GLOBAL DARK MODE ARCHITECTURE & CONTRAST REFINEMENTS
   Ensures 100% legibility, rich islamic nocturnal sapphire theme, and zero dark-on-dark issues
   ========================================================================== */
html.dark {
    --bg-white: #0F172A;
    --bg-cream: #0B1120;
    --bg-pearl: #111827;
    --bg-sand: #1E293B;

    --text-heading: #F8FAFC;
    --text-body: #E2E8F0;
    --text-muted: #94A3B8;
    --border-light: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(255, 255, 255, 0.2);

    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.6);
    --shadow-hover: 0 16px 32px -4px rgba(0, 0, 0, 0.85);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.55);
    
    color-scheme: dark;
}

html.dark body {
    background-color: #0B1120 !important;
    color: #E2E8F0 !important;
}

/* Background utilities in dark mode */
html.dark .bg-white:not(.page-header-luminous):not(.bg-islamic-pattern):not(.keep-white):not(.active-mode):not(.theme-toggle-btn),
html.dark .bg-\[\#FDFCF7\],
html.dark .bg-\[\#FCFBF7\],
html.dark .bg-\[\#FAFAF7\] {
    background-color: #0F172A !important;
}

html.dark .bg-slate-50,
html.dark .bg-slate-50\/50,
html.dark .bg-slate-100 {
    background-color: #1E293B !important;
}

html.dark .bg-emerald-50,
html.dark .bg-emerald-50\/50,
html.dark .bg-emerald-50\/80,
html.dark .bg-emerald-50\/30 {
    background-color: rgba(6, 78, 59, 0.45) !important;
}

html.dark .bg-amber-50,
html.dark .bg-amber-50\/50,
html.dark .bg-amber-50\/60,
html.dark .bg-amber-50\/20 {
    background-color: rgba(120, 53, 15, 0.35) !important;
}

/* Typography contrast in dark mode - Default for dark surfaces */
html.dark .text-slate-900 {
    color: #F8FAFC;
}
html.dark .text-slate-800 {
    color: #F1F5F9;
}
html.dark .text-slate-700 {
    color: #E2E8F0;
}
html.dark .text-slate-600 {
    color: #CBD5E1;
}
html.dark .text-slate-500 {
    color: #94A3B8;
}
html.dark .text-slate-400 {
    color: #94A3B8;
}
html.dark .text-emerald-950,
html.dark .text-emerald-900,
html.dark .text-emerald-800 {
    color: #34D399;
}
html.dark .text-emerald-700 {
    color: #6EE7B7;
}

/* =========================================================================
   SPECIAL CONTRAST ADAPTATION: WHITENESS SECTIONS IN DARK MODE
   If any section, container, banner, or button has whiteness/light background in dark mode,
   its text MUST be deep black/slate for crystal-clear readability!
   Meanwhile, all dark surfaces & cards have crisp luminous white/silver text!
   Zero hidden text in dark mode, zero hidden text in light mode!
   ========================================================================= */

/* Explicit Whiteness Sections & Page Banners in Dark Mode */
html.dark .page-header-luminous,
html.dark .bg-islamic-pattern,
html.dark .keep-white,
html.dark .bg-white-preserved {
    background-color: #FFFFFF !important;
    background-image: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 35%, #F0FDF4 70%, #FEFCE8 100%) !important;
    color: #0F172A !important;
}

/* Headings in Whiteness Sections */
html.dark .page-header-luminous h1,
html.dark .page-header-luminous h2,
html.dark .page-header-luminous h3,
html.dark .page-header-luminous h4,
html.dark .page-header-luminous h5,
html.dark .page-header-luminous h6,
html.dark .page-header-luminous .text-slate-900,
html.dark .page-header-luminous .text-slate-800,
html.dark .bg-islamic-pattern h1,
html.dark .bg-islamic-pattern h2,
html.dark .bg-islamic-pattern h3,
html.dark .bg-islamic-pattern h4,
html.dark .bg-islamic-pattern h5,
html.dark .bg-islamic-pattern h6,
html.dark .bg-islamic-pattern .text-slate-900,
html.dark .bg-islamic-pattern .text-slate-800,
html.dark .keep-white h1,
html.dark .keep-white h2,
html.dark .keep-white h3,
html.dark .keep-white .text-slate-900 {
    color: #0F172A !important;
}

/* Body & Paragraphs in Whiteness Sections */
html.dark .page-header-luminous p,
html.dark .page-header-luminous .text-slate-700,
html.dark .page-header-luminous .text-slate-600,
html.dark .bg-islamic-pattern p,
html.dark .bg-islamic-pattern .text-slate-700,
html.dark .bg-islamic-pattern .text-slate-600,
html.dark .keep-white p,
html.dark .keep-white .text-slate-700 {
    color: #334155 !important;
}

/* Muted Text in Whiteness Sections */
html.dark .page-header-luminous .text-slate-500,
html.dark .page-header-luminous .text-slate-400,
html.dark .bg-islamic-pattern .text-slate-500,
html.dark .bg-islamic-pattern .text-slate-400,
html.dark .keep-white .text-slate-500 {
    color: #64748B !important;
}

/* Emerald & Amber Accents in Whiteness Sections */
html.dark .page-header-luminous .text-emerald-950,
html.dark .page-header-luminous .text-emerald-900,
html.dark .page-header-luminous .text-emerald-800,
html.dark .bg-islamic-pattern .text-emerald-950,
html.dark .bg-islamic-pattern .text-emerald-900,
html.dark .bg-islamic-pattern .text-emerald-800,
html.dark .keep-white .text-emerald-800 {
    color: #065F46 !important;
}

html.dark .page-header-luminous .text-emerald-700,
html.dark .bg-islamic-pattern .text-emerald-700,
html.dark .keep-white .text-emerald-700 {
    color: #047857 !important;
}

html.dark .page-header-luminous .text-amber-800,
html.dark .bg-islamic-pattern .text-amber-800,
html.dark .keep-white .text-amber-800 {
    color: #92400E !important;
}

/* Active buttons & chips with white background in Dark Mode */
html.dark .active-mode.bg-white,
html.dark button.active-mode.bg-white,
html.dark .theme-toggle-btn.bg-white,
html.dark .bg-white.text-slate-900:not(.card-luminous) {
    background-color: #FFFFFF !important;
    color: #0F172A !important;
}

/* Ensure Dark Cards and Dark Surfaces always have bright luminous text */
html.dark .card-luminous h1,
html.dark .card-luminous h2,
html.dark .card-luminous h3,
html.dark .card-luminous h4,
html.dark .card-luminous h5,
html.dark .card-luminous h6,
html.dark .card-luminous .text-slate-900 {
    color: #F8FAFC !important;
}
html.dark .card-luminous .text-slate-800 {
    color: #F1F5F9 !important;
}
html.dark .card-luminous p,
html.dark .card-luminous .text-slate-700,
html.dark .card-luminous .text-slate-600 {
    color: #CBD5E1 !important;
}
html.dark .card-luminous .text-slate-500,
html.dark .card-luminous .text-slate-400 {
    color: #94A3B8 !important;
}
html.dark .card-luminous .text-emerald-800,
html.dark .card-luminous .text-emerald-700 {
    color: #34D399 !important;
}
html.dark .card-luminous .text-amber-800,
html.dark .card-luminous .text-amber-700 {
    color: #FBBF24 !important;
}

/* Border overrides in dark mode */
html.dark .border-slate-100,
html.dark .border-slate-200 {
    border-color: rgba(255, 255, 255, 0.12) !important;
}
html.dark .border-emerald-100,
html.dark .border-emerald-200 {
    border-color: rgba(16, 185, 129, 0.3) !important;
}
html.dark .border-amber-100,
html.dark .border-amber-200,
html.dark .border-amber-200\/80 {
    border-color: rgba(245, 158, 11, 0.35) !important;
}

/* Header & Navigation in dark mode */
html.dark .navbar-luminous {
    background: rgba(11, 17, 32, 0.94) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(14px) !important;
}

html.dark #mobile-sidebar {
    background-color: #0F172A !important;
    border-left: 1px solid rgba(255, 255, 255, 0.12) !important;
}

/* Geometric backgrounds in dark mode */
html.dark .bg-islamic-geometric {
    background-color: #0B1120 !important;
    background-image:
        radial-gradient(circle at 100% 0%, rgba(16, 185, 129, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 0% 100%, rgba(245, 158, 11, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(5, 150, 105, 0.08) 0%, transparent 50%) !important;
}

html.dark .bg-pattern-subtle {
    background-color: #0B1120 !important;
    background-image: linear-gradient(180deg, #0F172A 0%, #0B1120 100%) !important;
}

/* Cards & Containers in dark mode */
html.dark .card-luminous {
    background: #111827 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45) !important;
}

html.dark .card-luminous:hover {
    border-color: rgba(52, 211, 153, 0.6) !important;
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.75) !important;
}

/* Card inner boxes in dark mode: adapt to sleek dark surfaces with luminous contrast */
html.dark .card-luminous .bg-white,
html.dark .card-luminous [class*="bg-[#FDFCF7]"],
html.dark .card-luminous [class*="bg-[#fdfcf7]"],
html.dark .card-luminous div[class*="bg-[#FDFCF7]"] {
    background-color: #1E293B !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

html.dark .card-luminous .text-emerald-950,
html.dark .card-luminous .text-emerald-900,
html.dark .text-emerald-950,
html.dark .text-emerald-900 {
    color: #A7F3D0 !important;
}

html.dark .card-luminous .bg-white .text-slate-900,
html.dark .card-luminous [class*="bg-[#FDFCF7]"] .text-slate-800 {
    color: #F8FAFC !important;
}

html.dark .card-luminous .bg-white .text-slate-500,
html.dark .card-luminous .bg-white .text-slate-600 {
    color: #94A3B8 !important;
}

html.dark .card-luminous .bg-white .border-slate-100 {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

html.dark .badge-emerald {
    background-color: rgba(6, 78, 59, 0.65) !important;
    color: #6EE7B7 !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
}

html.dark .badge-gold {
    background-color: rgba(146, 64, 14, 0.55) !important;
    color: #FDE68A !important;
    border-color: rgba(245, 158, 11, 0.45) !important;
}

html.dark .badge-islamic-pill {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.7) 0%, rgba(120, 53, 15, 0.4) 100%) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
}

/* Form Controls in dark mode */
html.dark .form-input-luminous,
html.dark input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
html.dark select,
html.dark textarea {
    background-color: #1E293B !important;
    color: #F8FAFC !important;
    border-color: #334155 !important;
}

html.dark .form-input-luminous:focus,
html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus {
    border-color: #10B981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3) !important;
}

html.dark select option {
    background-color: #1E293B !important;
    color: #F8FAFC !important;
}

html.dark .form-label-luminous {
    color: #E2E8F0 !important;
}

/* Modals & Dialogs in dark mode */
html.dark .modal-content-box,
html.dark #course-modal-box,
html.dark #book-modal-box,
html.dark #teacher-modal-box,
html.dark #syllabus-modal-box {
    background-color: #111827 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #F8FAFC !important;
}

/* Details & FAQ in dark mode */
html.dark details,
html.dark .faq-item {
    background-color: #111827 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Tables in dark mode */
html.dark table {
    color: #E2E8F0 !important;
}

html.dark thead tr,
html.dark th {
    background-color: #1E293B !important;
    color: #F8FAFC !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

html.dark tbody tr {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

html.dark tbody tr:hover {
    background-color: rgba(30, 41, 59, 0.6) !important;
}

/* Buttons in dark mode */
html.dark .btn-outline-emerald:not(.bg-white):not([class*="bg-white"]) {
    background-color: rgba(6, 78, 59, 0.4) !important;
    border-color: #10B981 !important;
    color: #6EE7B7 !important;
}
html.dark .btn-outline-emerald:not(.bg-white):not([class*="bg-white"]):hover {
    background-color: #065F46 !important;
    border-color: #34D399 !important;
    color: #FFFFFF !important;
}

/* Audio Player in dark mode */
html.dark .audio-progress-track {
    background: #334155 !important;
}

/* Scrollbars in dark mode */
html.dark ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
html.dark ::-webkit-scrollbar-track {
    background: #0B1120;
}
html.dark ::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}
html.dark ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}