/* ============================================
   DHIVEHI FONT — Global Styles
   Sized to match vaguthu.mv typography
   ============================================ */

/* --------------------------------------------
   1. Faruma @font-face
   -------------------------------------------- */
@font-face {
    font-family: 'Faruma';
    src: url('https://driving.olafel.com/assetscd/fonts/Faruma.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: block;
}

/* --------------------------------------------
   2. Global Dhivehi override
   -------------------------------------------- */
body.language-rtl,
body.language-rtl *:not(i):not(.fa):not([class*="fa-"]) {
    font-family: 'Faruma', 'Noto Sans Thaana', 'MV Boli', 'Thaana', 'Arial', sans-serif !important;
}

/* --------------------------------------------
   3. Explicit Dhivehi containers
   -------------------------------------------- */
.dhivehi-text,
.dhivehi-text *,
.lang-dv,
[lang="dv"],
[dir="rtl"] {
    font-family: 'Faruma', 'Noto Sans Thaana', 'MV Boli', 'Thaana', 'Arial', sans-serif !important;
}

/* --------------------------------------------
   4. Preserve Font Awesome icons
   -------------------------------------------- */
body.language-rtl i.fas,
body.language-rtl i.far,
body.language-rtl i.fab,
body.language-rtl i.fa,
body.language-rtl [class*="fa-"] {
    font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Brands', 'Font Awesome 5 Free', 'Font Awesome 5 Brands' !important;
}

/* ============================================
   5. DHIVEHI TYPOGRAPHY — matches vaguthu.mv
   Desktop values (>= 601px viewport)
   ============================================ */

/* ---- Lesson body text (main reading material) ---- */
/* Vaguthu article body: 20px / 32px line-height */
body.language-rtl .dhivehi-text {
    font-size: 1.25rem !important;      /* 20px */
    line-height: 1.75 !important;       /* 35px */
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ---- Card titles (lesson headings) ---- */
/* Vaguthu h3: 22px */
body.language-rtl .header-text.lang-dv {
    font-size: 1.375rem !important;     /* 22px */
    font-weight: 600;
    line-height: 1.5 !important;
}

/* ---- Page/section headers (h1, h2) ---- */
body.language-rtl h1:not([class*="fa"]) {
    font-size: 2rem !important;         /* 32px */
    line-height: 1.4 !important;
}
body.language-rtl h2:not([class*="fa"]) {
    font-size: 1.625rem !important;     /* 26px */
    line-height: 1.4 !important;
}
body.language-rtl h3:not([class*="fa"]) {
    font-size: 1.375rem !important;     /* 22px */
    line-height: 1.5 !important;
}
body.language-rtl h4:not([class*="fa"]) {
    font-size: 1.125rem !important;     /* 18px */
    line-height: 1.5 !important;
}

/* ---- Paragraphs ---- */
body.language-rtl p:not([class*="fa"]):not(.intro) {
    font-size: 1.25rem;                  /* 20px */
    line-height: 1.75;
}

/* ---- Buttons ---- */
body.language-rtl button:not(.close-quiz):not(.lang-trigger):not(.quick-lang-btn):not(.font-size-btn),
body.language-rtl .btn-start-quiz,
body.language-rtl .btn-quiz,
body.language-rtl .read-more,
body.language-rtl .load-more-btn,
body.language-rtl .quick-action {
    font-size: 1rem !important;         /* 16px */
    line-height: 1.5 !important;
}

/* ---- Bottom nav labels ---- */
body.language-rtl .nav-label,
body.language-rtl .nav-item span:not(.nav-icon):not(.nav-badge) {
    font-size: 0.875rem !important;     /* 14px */
    line-height: 1.4 !important;
}

/* ---- Schedule tabs ---- */
body.language-rtl .schedule-tab {
    font-size: 1rem !important;         /* 16px */
    line-height: 1.5 !important;
}

/* ---- Dashboard stat labels ---- */
body.language-rtl .stat-label {
    font-size: 0.875rem !important;     /* 14px */
    line-height: 1.4 !important;
}

/* ---- Ratio card titles, labels, descriptions ---- */
body.language-rtl .ratio-card .card-title {
    font-size: 1.125rem !important;     /* 18px */
    letter-spacing: 0;
    line-height: 1.5 !important;
}
body.language-rtl .ratio-card .card-badge {
    font-size: 0.875rem !important;     /* 14px */
    line-height: 1.4 !important;
}
body.language-rtl .ratio-label {
    font-size: 1.125rem !important;     /* 18px */
    line-height: 1.5 !important;
}
body.language-rtl .ratio-desc {
    font-size: 1rem !important;         /* 16px */
    line-height: 1.6 !important;
}

/* ---- Dashboard welcome + subtitle ---- */
body.language-rtl .header-title,
body.language-rtl #dashboardWelcome {
    font-size: 1.375rem !important;     /* 22px */
    line-height: 1.4 !important;
}
body.language-rtl .header-title .subtitle,
body.language-rtl #dashboardSubtitle {
    font-size: 1rem !important;         /* 16px */
    line-height: 1.4 !important;
}

/* ---- Quick action labels ---- */
body.language-rtl .quick-action .qa-label {
    font-size: 0.875rem !important;     /* 14px */
    line-height: 1.4 !important;
}

/* ---- Section headers on dashboard ---- */
body.language-rtl .section-header h2 {
    font-size: 1.375rem !important;     /* 22px */
    line-height: 1.4 !important;
}
body.language-rtl .section-header a {
    font-size: 1rem !important;         /* 16px */
    line-height: 1.4 !important;
}

/* ---- Toast messages ---- */
body.language-rtl .toast {
    font-size: 1rem !important;         /* 16px */
    line-height: 1.5 !important;
}

/* ---- Quiz modal ---- */
body.language-rtl .quiz-modal h2 { font-size: 1.375rem !important; }
body.language-rtl .quiz-modal .q-text { font-size: 1.125rem !important; line-height: 1.6 !important; }
body.language-rtl .quiz-modal .option .text { font-size: 1rem !important; }
body.language-rtl .quiz-modal .explanation-box p { font-size: 1rem !important; line-height: 1.6 !important; }

/* ---- Lesson counter ---- */
body.language-rtl .lesson-counter {
    font-size: 0.875rem !important;
}

/* ---- Links ---- */
body.language-rtl a:not([class*="fa"]) {
    font-size: 1rem;
}

/* ============================================
   6. MOBILE — matches vaguthu.mv mobile
   <= 600px viewport
   ============================================ */
@media (max-width: 600px) {

    /* Vaguthu mobile article body: 18px / 30px */
    body.language-rtl .dhivehi-text {
        font-size: 1.125rem !important;    /* 18px */
        line-height: 1.75 !important;      /* 31.5px */
    }

    body.language-rtl .header-text.lang-dv {
        font-size: 1.25rem !important;     /* 20px */
        line-height: 1.5 !important;
    }

    /* Vaguthu mobile h1: 24px */
    body.language-rtl h1:not([class*="fa"]) {
        font-size: 1.5rem !important;      /* 24px */
        line-height: 1.4 !important;
    }

    /* Vaguthu mobile h2: 20px */
    body.language-rtl h2:not([class*="fa"]) {
        font-size: 1.25rem !important;     /* 20px */
        line-height: 1.4 !important;
    }

    body.language-rtl h3:not([class*="fa"]) {
        font-size: 1.125rem !important;    /* 18px */
        line-height: 1.5 !important;
    }

    /* Mobile paragraph */
    body.language-rtl p:not([class*="fa"]):not(.intro) {
        font-size: 1.125rem;
        line-height: 1.75;
    }

    /* Mobile buttons */
    body.language-rtl button:not(.close-quiz):not(.lang-trigger):not(.quick-lang-btn):not(.font-size-btn),
    body.language-rtl .btn-start-quiz,
    body.language-rtl .btn-quiz,
    body.language-rtl .read-more,
    body.language-rtl .load-more-btn,
    body.language-rtl .quick-action {
        font-size: 0.9375rem !important;   /* 15px */
    }

    /* Mobile nav labels */
    body.language-rtl .nav-label,
    body.language-rtl .nav-item span:not(.nav-icon):not(.nav-badge) {
        font-size: 0.75rem !important;     /* 12px */
    }

    /* Mobile schedule tabs */
    body.language-rtl .schedule-tab {
        font-size: 0.8125rem !important;   /* 13px */
    }

    /* Mobile ratio cards */
    body.language-rtl .ratio-card .card-title {
        font-size: 1rem !important;        /* 16px */
    }
    body.language-rtl .ratio-label {
        font-size: 1rem !important;
    }
    body.language-rtl .ratio-desc {
        font-size: 0.9375rem !important;   /* 15px */
    }

    /* Mobile dashboard welcome */
    body.language-rtl .header-title,
    body.language-rtl #dashboardWelcome {
        font-size: 1.125rem !important;    /* 18px */
    }
    body.language-rtl .header-title .subtitle,
    body.language-rtl #dashboardSubtitle {
        font-size: 0.875rem !important;    /* 14px */
    }

    /* Mobile quick action labels */
    body.language-rtl .quick-action .qa-label {
        font-size: 0.75rem !important;
    }

    /* Mobile section headers */
    body.language-rtl .section-header h2 {
        font-size: 1.125rem !important;    /* 18px */
    }

    /* Mobile ratio percentage */
    body.language-rtl .ratio-percentage {
        font-size: 40px !important;
    }
    body.language-rtl .stat-number {
        font-size: 22px !important;
    }
}


/* ============================================
   FONT SIZE ADJUSTER
   ============================================ */

/* The trigger button */
.font-size-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #F3F4F6;
    border: 2px solid #E5E7EB;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    color: #1A1A2E;
    min-width: 46px;
    justify-content: center;
}
.font-size-btn:hover {
    border-color: #6C63FF;
    background: #EDE9FE;
}
.font-size-btn:active {
    transform: scale(0.96);
}
.font-size-btn i {
    font-size: 0.85rem;
    color: #6C63FF;
}
.font-size-btn #fontSizeLabel {
    font-size: 0.75rem;
    font-weight: 700;
    color: #6C63FF;
    min-width: 22px;
    text-align: center;
}

/* Dark-mode / dashboard variant (light on dark bg) */
.dashboard-header .font-size-btn {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.2);
    color: #fff;
}
.dashboard-header .font-size-btn:hover {
    background: rgba(255,255,255,0.25);
}
.dashboard-header .font-size-btn i,
.dashboard-header .font-size-btn #fontSizeLabel {
    color: #fff;
}

/* ============================================
   FONT SIZE OVERRIDES
   Applied when user selects A+ or A++
   Overrides the default Vaguthu-matched sizes.
   ============================================ */

/* --- Level 1: Small (default / Vaguthu base) --- */
/* No overrides — falls back to Vaguthu sizes above. */

/* --- Level 2: Medium (+15%) --- */
body.font-size-medium.language-rtl .dhivehi-text {
    font-size: 1.4375rem !important;    /* 23px */
}
body.font-size-medium.language-rtl .header-text.lang-dv {
    font-size: 1.5625rem !important;    /* 25px */
}
body.font-size-medium.language-rtl p:not([class*="fa"]):not(.intro) {
    font-size: 1.4375rem;
}
body.font-size-medium.language-rtl .ratio-desc,
body.font-size-medium.language-rtl .ratio-label,
body.font-size-medium.language-rtl .ratio-card .card-title {
    font-size: 1.15rem !important;
}
body.font-size-medium.language-rtl button:not(.close-quiz):not(.lang-trigger):not(.quick-lang-btn):not(.font-size-btn),
body.font-size-medium.language-rtl .btn-start-quiz,
body.font-size-medium.language-rtl .read-more {
    font-size: 1.15rem !important;
}

/* --- Level 3: Large (+30%) --- */
body.font-size-large.language-rtl .dhivehi-text {
    font-size: 1.625rem !important;     /* 26px */
}
body.font-size-large.language-rtl .header-text.lang-dv {
    font-size: 1.75rem !important;      /* 28px */
}
body.font-size-large.language-rtl p:not([class*="fa"]):not(.intro) {
    font-size: 1.625rem;
}
body.font-size-large.language-rtl .ratio-desc,
body.font-size-large.language-rtl .ratio-label,
body.font-size-large.language-rtl .ratio-card .card-title {
    font-size: 1.3rem !important;
}
body.font-size-large.language-rtl button:not(.close-quiz):not(.lang-trigger):not(.quick-lang-btn):not(.font-size-btn),
body.font-size-large.language-rtl .btn-start-quiz,
body.font-size-large.language-rtl .read-more {
    font-size: 1.3rem !important;
}

/* ============================================
   MOBILE OVERRIDES FOR FONT SIZE
   ============================================ */
@media (max-width: 600px) {

    body.font-size-medium.language-rtl .dhivehi-text {
        font-size: 1.3125rem !important;    /* 21px */
    }
    body.font-size-medium.language-rtl .header-text.lang-dv {
        font-size: 1.4375rem !important;    /* 23px */
    }

    body.font-size-large.language-rtl .dhivehi-text {
        font-size: 1.5rem !important;       /* 24px */
    }
    body.font-size-large.language-rtl .header-text.lang-dv {
        font-size: 1.625rem !important;     /* 26px */
    }
}
/* ============================================
   FLOATING WHATSAPP BUTTON
   Works on both desktop and mobile.
   ============================================ */
.wa-float {
    position: fixed !important;
    bottom: calc(90px + env(safe-area-inset-bottom, 0px)) !important;
    right: calc(20px + env(safe-area-inset-right, 0px)) !important;
    top: auto !important;
    left: auto !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    background: #25D366 !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 28px !important;
    text-decoration: none !important;
    box-shadow: 0 6px 20px rgba(37,211,102,0.5) !important;
    z-index: 2147483647 !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
}

.wa-float:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 8px 28px rgba(37,211,102,0.6) !important;
}

.wa-float:active {
    transform: scale(0.95) !important;
}

.wa-float i,
.wa-float svg {
    color: #ffffff !important;
    fill: #ffffff !important;
    font-size: 28px !important;
    width: 30px !important;
    height: 30px !important;
    line-height: 1 !important;
    display: block !important;
}

/* Desktop: no bottom-nav so drop closer to the bottom edge */
@media (min-width: 601px) {
    .wa-float {
        bottom: 24px !important;
        right: 24px !important;
    }
}

/* Small phones: smaller button, but keep it well above the nav */
@media (max-width: 600px) {
    .wa-float {
        bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
        right: 14px !important;
        width: 54px !important;
        height: 54px !important;
    }
    .wa-float i,
    .wa-float svg {
        width: 28px !important;
        height: 28px !important;
    }
}