/**
 * ============================================================================
 * Afiidah Academy — Unified Design System & Typography Engine
 * ============================================================================
 * Comprehensive styling system governing:
 * 1. Strengthened Arabic Typography (Alexandria + IBM Plex Sans Arabic + Amiri)
 * 2. Brand Identity Tokens (Midnight Petrol & Amber Gold)
 * 3. Icon System Alignment & Spacing Optimization
 * 4. Refined Islamic Geometric Pattern Canvas Background
 * 5. Complete, Safe Dark Mode / Light Mode Theming
 * 6. Responsive Table & Form Enhancements
 * ============================================================================
 */

:root {
    /* ------------------------------------------------------------------------
       1. Typography Stack Tokens
       ------------------------------------------------------------------------ */
    --font-ar-display: 'Alexandria', 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-ar-body:    'IBM Plex Sans Arabic', 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-en-display: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
    --font-en-body:    'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
    --font-quran:      'Amiri', 'Traditional Arabic', serif;

    /* Theme aliases used by Rocket LMS CSS */
    --font-family-base: var(--font-ar-body);
    --font-family-rtl:  var(--font-ar-body);

    /* Fluid responsive font scales (mobile to desktop) */
    --text-hero: clamp(2.1rem, 1.5rem + 3.4vw, 3.85rem);
    --text-h1:   clamp(1.85rem, 1.4rem + 2.5vw, 2.85rem);
    --text-h2:   clamp(1.5rem, 1.2rem + 1.7vw, 2.25rem);
    --text-h3:   clamp(1.25rem, 1.05rem + 1.1vw, 1.75rem);
    --text-h4:   clamp(1.1rem, 1.0rem + 0.55vw, 1.35rem);
    --text-body: clamp(0.95rem, 0.92rem + 0.2vw, 1.0625rem);
    --text-sm:   clamp(0.85rem, 0.82rem + 0.15vw, 0.9375rem);
    --text-xs:   clamp(0.75rem, 0.72rem + 0.1vw, 0.825rem);

    /* Arabic reading line-height */
    --lh-arabic-heading: 1.35;
    --lh-arabic-body:    1.75;
    --lh-arabic-loose:   1.95;
    --lh-quran:          2.2;

    /* ------------------------------------------------------------------------
       2. Brand Color Palette (Afiidah Authentic Identity: Midnight Petrol & Amber)
       ------------------------------------------------------------------------ */
    --brand-petrol:         #040E14;
    --brand-petrol-dark:    #02090D;
    --brand-petrol-surface: #071822;
    --brand-petrol-card:    #0B202B;
    --brand-petrol-border:  rgba(229, 164, 68, 0.20);
    --brand-amber:          #E5A444;
    --brand-amber-hover:    #D9922A;
    --brand-amber-dark:     #B87820;
    --brand-amber-soft:     rgba(229, 164, 68, 0.14);
    --brand-amber-light:    #F7D399;
    --brand-navy:           #071822;
    --brand-navy-deep:      #040E14;
    --brand-gold:           #E5A444;
    --brand-gold-soft:      rgba(229, 164, 68, 0.15);
    --brand-sage:           #8BA794;

    /* Semantic LMS variables binding */
    --primary:          var(--brand-amber);
    --primary-hover:    var(--brand-amber-hover);
    --primary-border:   var(--brand-amber);
    --primary-shadow:   rgba(229, 164, 68, 0.32);
    --secondary:        var(--brand-petrol-surface);

    /* ------------------------------------------------------------------------
       3. Subtle Islamic Geometric Pattern Tokens
       ------------------------------------------------------------------------ */
    --pattern-islamic: url("data:image/svg+xml,%3Csvg width='64' height='64' viewBox='0 0 64 64' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg stroke='%23E5A444' stroke-width='0.7' stroke-opacity='0.045'%3E%3Cpath d='M32 0l32 32-32 32L0 32z'/%3E%3Cpath d='M0 0h64v64H0z'/%3E%3Ccircle cx='32' cy='32' r='14'/%3E%3Ccircle cx='32' cy='32' r='24' stroke-dasharray='2,2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ============================================================================
   1. Base Body & Root Typography
   ============================================================================ */

html[dir="rtl"],
body.rtl,
:lang(ar) {
    font-family: var(--font-ar-body);
    line-height: var(--lh-arabic-body);
    letter-spacing: normal !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html[dir="ltr"]:not(:lang(ar)),
body:not(.rtl):not(:lang(ar)) {
    font-family: var(--font-en-body);
    line-height: 1.6;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    color: #2F3456;
    font-size: var(--text-body);
}

/* ============================================================================
   2. Headings & Titles — Alexandria Display Hierarchy (Reinforced & Bold)
   ============================================================================ */

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] .section-title,
html[dir="rtl"] .display-title,
html[dir="rtl"] .hero-title,
html[dir="rtl"] .card-title,
body.rtl h1,
body.rtl h2,
body.rtl h3,
body.rtl h4,
body.rtl .section-title,
body.rtl .section-header h1,
:lang(ar) h1,
:lang(ar) h2,
:lang(ar) h3,
:lang(ar) h4 {
    font-family: var(--font-ar-display) !important;
    line-height: var(--lh-arabic-heading);
    letter-spacing: normal !important;
}

h1, .text-h1 {
    font-size: var(--text-h1);
    font-weight: 800 !important;
}

h2, .text-h2 {
    font-size: var(--text-h2);
    font-weight: 800 !important;
}

h3, .text-h3 {
    font-size: var(--text-h3);
    font-weight: 700 !important;
}

h4, .text-h4 {
    font-size: var(--text-h4);
    font-weight: 700 !important;
}

h5, .text-h5 {
    font-size: var(--text-body);
    font-weight: 600 !important;
}

h6, .text-h6 {
    font-size: var(--text-sm);
    font-weight: 600 !important;
}

.section-title {
    font-weight: 800 !important;
    color: #161A2D;
}

/* ============================================================================
   3. Sacred Quranic Scripture & Religious Text (Amiri Font Preservation)
   ============================================================================ */

.font-quran,
.quran-verse,
.quran-text,
[data-quran],
.sacred-text,
.ayah,
.ayah-text,
.surah-text,
.hadith-text {
    font-family: var(--font-quran) !important;
    line-height: var(--lh-quran) !important;
    font-size: 1.35em !important;
    font-weight: 400;
    letter-spacing: 0 !important;
    word-spacing: 2px;
    direction: rtl;
    text-align: center;
    text-rendering: geometricPrecision;
}

.font-quran.font-bold,
.quran-verse.font-bold {
    font-weight: 700 !important;
}

/* ============================================================================
   4. Buttons, Forms, & Inputs (Increased Size & Stronger Weights)
   ============================================================================ */

.btn,
button,
input[type="submit"],
input[type="button"],
.site-header__btn,
.btn-amber,
.btn-primary,
.btn-outline-white,
.btn-glass-quiet {
    font-family: var(--font-ar-body);
    font-weight: 700 !important;
    font-size: 0.9375rem !important;
    letter-spacing: normal !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.55rem !important;
    border-radius: 10px !important;
    transition: all 0.2s ease-in-out !important;
}

/* Primary Brand Button Styling (Amber Gold with Dark Midnight Petrol Contrast) */
.btn-primary,
button.btn-primary,
a.btn-primary,
input[type="submit"].btn-primary {
    background-color: var(--brand-amber) !important;
    border-color: var(--brand-amber) !important;
    color: var(--brand-petrol) !important;
    font-weight: 800 !important;
    box-shadow: 0 4px 14px rgba(229, 164, 68, 0.28) !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
button.btn-primary:hover,
a.btn-primary:hover {
    background-color: var(--brand-amber-hover) !important;
    border-color: var(--brand-amber-hover) !important;
    color: #000000 !important;
    box-shadow: 0 6px 18px rgba(229, 164, 68, 0.42) !important;
    transform: translateY(-1px);
}

/* Form Inputs & Labels */
label,
.form-label,
.form-group label {
    font-family: var(--font-ar-body);
    font-weight: 600 !important;
    font-size: 0.9375rem !important;
    color: #2F3456;
    margin-bottom: 0.45rem;
}

input,
select,
textarea,
.form-control,
.select2-container--default .select2-selection--single {
    font-family: var(--font-ar-body) !important;
    font-size: 0.9375rem !important;
    font-weight: 500 !important;
    letter-spacing: normal !important;
    border-radius: 8px !important;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus {
    border-color: var(--brand-amber) !important;
    box-shadow: 0 0 0 3px rgba(229, 164, 68, 0.22) !important;
}

/* ============================================================================
   5. Icon System Normalization & Button Spacing
   ============================================================================ */

/* Normalize icon dimensions & alignment inside buttons */
.btn .icons,
.btn i,
.btn svg,
button .icons,
button i,
button svg {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    margin: 0 !important; /* Let CSS gap handle spacing cleanly */
    line-height: 1 !important;
}

/* In RTL, ensure icons don't reverse spacing incorrectly */
[dir="rtl"] .btn .mr-1,
[dir="rtl"] .btn .mr-2,
[dir="rtl"] .btn .mr-3,
body.rtl .btn .mr-1,
body.rtl .btn .mr-2,
body.rtl .btn .mr-3 {
    margin-right: 0 !important;
    margin-left: 0.45rem !important;
}

/* Strict Icon Fonts Isolation */
i[class*="fa-"],
i.fa,
i.fas,
i.far,
i.fab,
i.fal,
i.fad,
.iconsax,
.feather,
svg,
svg *,
.close-icon,
[class*="iconsax-"],
[class*="feather-"] {
    font-family: "Font Awesome 5 Free", "Font Awesome 5 Pro", "FontAwesome", "iconsax", "feather", sans-serif !important;
    letter-spacing: normal !important;
}

svg {
    font-family: inherit !important;
}

/* ============================================================================
   6. Admin Dashboard: Canvas, Subtle Pattern, Sidebar, & Tables
   ============================================================================ */

body.mobile-admin,
body.rtl.mobile-admin {
    background-color: #F4F6F9 !important;
    font-family: var(--font-ar-body) !important;
}

.main-content {
    background-color: #F4F6F9;
    background-image: var(--pattern-islamic);
    background-repeat: repeat;
    background-size: 64px 64px;
    min-height: calc(100vh - 70px);
}

/* Admin Header & Brand Blue Bar */
.admin-header,
.admin-header.bg-primary {
    background: linear-gradient(135deg, var(--brand-navy) 0%, #152C46 100%) !important;
    border-bottom: 2px solid var(--brand-gold) !important;
    box-shadow: 0 4px 16px rgba(11, 23, 38, 0.18) !important;
}

/* Sidebar Menu Typography & Item Spacing */
body.rtl .main-sidebar,
body.rtl #sidebar-wrapper,
body.rtl .sidebar-menu {
    font-family: var(--font-ar-body) !important;
}

body.rtl .sidebar-brand a {
    font-family: var(--font-ar-display) !important;
    font-weight: 800 !important;
    color: var(--brand-amber) !important;
    letter-spacing: 0.5px;
}

body.rtl .sidebar-menu li.menu-header {
    font-family: var(--font-ar-display) !important;
    font-weight: 800 !important;
    font-size: 0.8125rem !important;
    color: var(--brand-amber) !important;
    letter-spacing: 0.5px;
    padding-top: 18px;
    padding-bottom: 6px;
    opacity: 0.9;
}

body.rtl .sidebar-menu li a {
    font-family: var(--font-ar-body) !important;
    font-weight: 600 !important;
    font-size: 0.9375rem !important;
    color: #CBD5E1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 10px 14px !important;
    border-radius: 8px !important;
    transition: all 0.18s ease-in-out !important;
}

body.rtl .sidebar-menu li a:hover {
    background-color: var(--brand-amber-soft) !important;
    color: #FEF3C7 !important;
}

body.rtl .sidebar-menu li.active > a {
    background-color: var(--brand-amber) !important;
    color: var(--brand-petrol) !important;
    font-weight: 800 !important;
}

body.rtl .sidebar-menu li.active > a .icons {
    color: var(--brand-petrol) !important;
}

/* Table Typography & Usability Enhancements */
.table.custom-table,
body.rtl .table {
    font-family: var(--font-ar-body);
    font-size: 0.9375rem !important;
}

.table.custom-table th,
body.rtl .table th {
    font-family: var(--font-ar-display) !important;
    font-weight: 700 !important;
    font-size: 0.9375rem !important;
    color: #161A2D !important;
    background-color: #F8FAFC !important;
    padding: 14px 16px !important;
    border-bottom: 2px solid #E2E8F0 !important;
    white-space: nowrap;
}

.table.custom-table td,
body.rtl .table td {
    font-family: var(--font-ar-body) !important;
    font-size: 0.9375rem !important;
    font-weight: 500 !important;
    padding: 14px 16px !important;
    vertical-align: middle !important;
    border-bottom: 1px solid #EDF2F7 !important;
}

.table tr:hover td {
    background-color: rgba(229, 164, 68, 0.04) !important;
}

/* Table Row Action Quick Buttons */
.table-quick-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.table-quick-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #F1F5F9;
    color: #475569;
    border: 1px solid #E2E8F0;
    transition: all 0.15s ease;
}

.table-quick-btn:hover {
    background: var(--brand-amber-soft);
    color: var(--brand-amber-dark);
    border-color: var(--brand-amber);
    transform: translateY(-1px);
}

.table-quick-btn.btn-delete:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #EF4444;
    border-color: #EF4444;
}

/* Status Badges */
.badge-status,
.badge {
    font-family: var(--font-ar-body) !important;
    font-weight: 700 !important;
    font-size: 0.8125rem !important;
    padding: 5px 10px !important;
    border-radius: 20px !important;
    letter-spacing: 0.2px;
}

/* ============================================================================
   7. Course & Learning Page Navigation Bar Styles
   ============================================================================ */

.afiidah-course-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #FFFFFF;
    border-bottom: 1px solid #E2E8F0;
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.afiidah-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    color: #475569;
    text-decoration: none !important;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    transition: all 0.2s ease;
}

.afiidah-nav-btn:hover {
    background: var(--brand-amber-soft);
    color: var(--brand-amber-dark);
    border-color: var(--brand-amber);
}

/* ============================================================================
   8. Clean Unactivated Feature Notice (Replacing Raw Paid Plugin Errors)
   ============================================================================ */

.afiidah-reserved-feature-card {
    text-align: center;
    padding: 48px 24px;
    max-width: 680px;
    margin: 40px auto;
    background: #FFFFFF;
    border-radius: 20px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
}

.afiidah-reserved-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: var(--brand-amber-soft);
    color: var(--brand-amber-dark);
    margin-bottom: 20px;
}

.afiidah-reserved-title {
    font-family: var(--font-ar-display) !important;
    font-size: 1.35rem;
    font-weight: 800;
    color: #161A2D;
    margin-bottom: 10px;
}

body.dark-mode .afiidah-reserved-title {
    color: #F8FAFC !important;
}

.afiidah-reserved-desc {
    font-size: 0.95rem;
    color: #64748B;
    line-height: 1.7;
    margin-bottom: 24px;
}

body.dark-mode .afiidah-reserved-desc {
    color: #94A3B8 !important;
}

/* ============================================================================
   11. Tablet, iPad & Mobile Breakpoint Usability Optimizations
   ============================================================================ */

@media (max-width: 991.98px) {
    .main-content {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    .table.custom-table th,
    .table.custom-table td {
        padding: 10px 12px !important;
        font-size: 0.875rem !important;
    }

    .table-quick-actions {
        flex-wrap: nowrap;
    }

    .section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    .admin-header {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}

@media (max-width: 575.98px) {
    .btn, button {
        min-height: 42px;
    }

    .card-statistic .card-statistic__wrap {
        padding: 14px !important;
    }

    .table-quick-btn {
        width: 36px !important;
        height: 36px !important;
    }
}

