/*
Theme Name: Amidriver
Theme URI: https://example.com/amidriver
Author: AMIDRIVER
Author URI: https://example.com
Description: Multilingual (Urdu / Greek / English) Greek driving-license theory exam practice portal with a built-in quiz engine, RTL support, and immigration news section. Converted from a static HTML build into a fully working WordPress theme.
Version: 1.3.3
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: amidriver
Tags: rtl-language-support, translation-ready, one-column, custom-menu
*/

/* ==========================================================================
   Custom theme styles
   (Tailwind utility classes are loaded via the Tailwind CDN script enqueued
   in functions.php — this file only holds the bespoke, non-utility CSS
   that the original design needed.)
   ========================================================================== */

.glass-card {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.hero-gradient {
    background: linear-gradient(135deg, #0A2540 0%, #002B5B 55%, #0066FF 100%);
}

.noori-nastaleeq {
    font-family: 'Noto Nastaliq Urdu', 'Arial', sans-serif !important;
    font-size: 0.8rem; /* Reduced font size for Urdu */
    line-height: 1.6 !important;
    word-spacing: 1px;
}

.ad-slide {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.ad-slide.active {
    display: block;
    opacity: 1;
}

html[dir="rtl"] .dir-flip {
    transform: scaleX(-1);
}

/* WordPress core alignment classes kept for compatibility with the editor */
.alignleft { float: left; margin: 0 1.5em 1.5em 0; }
.alignright { float: right; margin: 0 0 1.5em 1.5em; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* ================================================================
   AMIDRIVER PRIMARY NAVIGATION — independent of Tailwind
   Chapters and Language are real navigation dropdowns, so they remain
   visible even if Tailwind CDN or a cache/minification plugin fails.
   ================================================================ */
.amidriver-main-nav {
    display: block !important;
    position: relative;
    z-index: 1000;
    background: transparent;
    border-top: 1px solid rgba(255, 255, 255, .2);
    border-bottom: 1px solid rgba(255, 255, 255, .16);
    direction: ltr;
}
.amidriver-nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    min-height: 42px;
    padding: 4px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    direction: ltr;
}
.amidriver-nav-link,
.amidriver-nav-button {
    appearance: none;
    border: 0;
    background: transparent;
    color: #fff;
    text-shadow: 0 1px 3px rgba(10, 37, 64, .5);
    text-decoration: none;
    font: 700 13px/1.2 Arial, sans-serif;
    padding: 9px 13px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}
.amidriver-nav-link:hover,
.amidriver-nav-button:hover,
.amidriver-nav-button[aria-expanded="true"] {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}
.amidriver-nav-dropdown {
    position: relative;
    display: inline-block;
}
.amidriver-chevron {
    margin-left: 7px;
    font-size: 11px;
}
.amidriver-dropdown-panel {
    display: none;
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    min-width: 285px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 6px;
    background: #fff;
    border: 1px solid #dbe3ec;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(15,23,42,.16);
    z-index: 2000;
    direction: ltr;
}
.amidriver-nav-dropdown.is-open .amidriver-dropdown-panel {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.amidriver-dropdown-panel a,
.amidriver-dropdown-panel button {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #334155;
    text-decoration: none;
    text-align: left;
    font: 700 12px/1.35 Arial, sans-serif;
    cursor: pointer;
}
.amidriver-dropdown-panel a:hover,
.amidriver-dropdown-panel button:hover {
    background: #f1f5f9;
    color: #0066ff;
}
.amidriver-language-panel {
    min-width: 155px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.amidriver-language-panel button {
    justify-content: flex-start;
}

/* ================================================================
   LANGUAGE SWITCHER — three independent inline buttons
   Deliberately isolated from .amidriver-nav-link/.amidriver-nav-button
   so no shared navigation hover state can affect the language controls.
   ================================================================ */
.amidriver-language-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
    direction: ltr;
}
.amidriver-language-button {
    appearance: none !important;
    -webkit-appearance: none !important;
    border: 1px solid rgba(255,255,255,.30) !important;
    background: rgba(255,255,255,.10) !important;
    color: #fff !important;
    box-shadow: none !important;
    outline: none !important;
    filter: none !important;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 32px;
    padding: 4px 7px;
    border-radius: 7px;
    cursor: pointer;
    font: 700 11px/1 Arial, sans-serif;
    white-space: nowrap;
    transition: none !important;
    transform: none !important;
}
/* Explicitly keep every interaction state visually identical. */
.amidriver-language-button:hover,
.amidriver-language-button:focus,
.amidriver-language-button:focus-visible,
.amidriver-language-button:active,
.amidriver-language-button.is-active,
.amidriver-language-button.is-active:hover,
.amidriver-language-button.is-active:focus,
.amidriver-language-button.is-active:active {
    background: rgba(255,255,255,.10) !important;
    background-color: rgba(255,255,255,.10) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,.30) !important;
    box-shadow: none !important;
    outline: none !important;
    filter: none !important;
    transform: none !important;
}
.amidriver-language-button.is-active {
    border-color: rgba(255,255,255,.55) !important;
    background: rgba(255,255,255,.16) !important;
}
.amidriver-language-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    line-height: 1;
}
.amidriver-language-name {
    display: none;
}
.amidriver-language-button {
    padding: 4px 8px;
}

/* ================================================================
   HEADER LOGO ROW
   No forced direction here: the logo row follows the document's
   current dir (set by the language switcher), so the logo sits on
   the right in Urdu (rtl) and flush left in English/Greek (ltr).
   ================================================================ */

/* Language dropdown items, styled as flag chips */
.amidriver-flag-btn {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 8px 10px !important;
}
.amidriver-flag-btn .amidriver-flag-icon {
    width: 24px;
    height: 24px;
    font-size: 14px;
    flex: 0 0 auto;
}
.amidriver-flag-name {
    font: 700 12px/1.2 Arial, sans-serif;
}
.amidriver-flag-btn.is-active {
    background: #eef4ff;
    color: #0066ff;
}
.amidriver-flag-btn.is-active .amidriver-flag-icon {
    border-color: #0066ff;
    box-shadow: 0 0 0 2px rgba(0, 102, 255, .18);
}
@media (max-width: 767px) {
    .amidriver-main-nav { display: block !important; overflow: visible !important; }
    .amidriver-nav-inner { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; }
    .amidriver-nav-link, .amidriver-nav-button { flex: 0 0 auto; }
}

/* FINAL HEADER VISIBILITY + COMPACT HERO FIX
   NOTE: header.php's original sticky/z-index/background came from Tailwind
   utility classes (sticky top-0 z-50 bg-white/95), which only exist once
   the Tailwind CDN <script> has loaded and scanned the DOM. That made
   visibility depend on script timing/availability and on no ancestor
   element ever having an unexpected overflow/transform (which breaks
   position:sticky). To make this bulletproof, the header is hardcoded here
   to position:fixed — taken completely out of document flow and pinned to
   the viewport, so nothing on the page can ever render over it. The
   matching body padding-top (so page content doesn't start underneath the
   fixed header) is set dynamically by the script at the bottom of
   header.php, since the header's real height changes with screen size. */
/* Guards against a very common cause of "position:fixed disappears/moves":
   if ANY ancestor of the header (html, body, or a wrapper div added by a
   plugin) has a CSS transform/filter/perspective on it, fixed-positioned
   children become fixed relative to THAT ancestor instead of the browser
   viewport — which can make them scroll away or render off-screen. This
   forces html/body to never do that. */
html, body {
    transform: none !important;
    filter: none !important;
    perspective: none !important;
}

header {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    background: linear-gradient(180deg, #0757B8 0%, #3B82F6 38%, #D1D5DB 72%, #F8FAFC 100%) !important;
}
/* Fixed only on tablet/desktop; on phones the header is a normal in-flow
   block so it stops covering the quiz (header.php script mirrors this). */
@media (min-width: 768px) {
    header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 999999 !important;
    }
}
@media (max-width: 767px) {
    header {
        position: relative !important;
        top: auto !important;
        z-index: 99999 !important;
    }
}
.amidriver-main-nav {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 99999 !important;
}
.amidriver-nav-inner {
    visibility: visible !important;
    opacity: 1 !important;
}
.amidriver-nav-link,
.amidriver-nav-button {
    visibility: visible !important;
    opacity: 1 !important;
}
.amidriver-nav-dropdown {
    position: relative !important;
    visibility: visible !important;
}
.amidriver-dropdown-panel {
    z-index: 100000 !important;
}
.hero-gradient {
    position: relative;
    z-index: 1;
}
@media (max-width: 767px) {
    .amidriver-nav-inner {
        justify-content: flex-start !important;
        overflow-x: auto !important;
        scrollbar-width: thin;
    }
    .amidriver-nav-link, .amidriver-nav-button {
        font-size: 12px !important;
        padding: 8px 10px !important;
    }
}



/* FINAL BRAND + NAV TYPOGRAPHY AMENDMENTS */
.amidriver-brand-title {
    display: inline-block;
    color: #ffffff !important;
    font: 900 26px/1 Arial, sans-serif !important;
    letter-spacing: -0.02em;
    text-shadow: 0 3px 0 #e11d1d;
    white-space: nowrap;
}
.amidriver-brand-subtitle {
    display: inline-block !important;
    margin-left: 8px;
    color: #ffffff !important;
    font: 800 11px/1.1 Arial, sans-serif !important;
    letter-spacing: .04em;
    white-space: nowrap;
    vertical-align: middle;
    text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.amidriver-nav-link,
.amidriver-nav-button {
    color: #000000 !important;
    text-shadow: none !important;
    font-weight: 800 !important;
}
.amidriver-nav-link:hover,
.amidriver-nav-button:hover,
.amidriver-nav-button[aria-expanded="true"] {
    color: #000000 !important;
    background: rgba(255,255,255,.18);
}
@media (max-width: 767px) {
    .amidriver-brand-title { font-size: 21px !important; }
    .amidriver-brand-subtitle { font-size: 9px !important; margin-left: 5px; }
}


/* V41 FINAL HEADER AMENDMENTS */
.amidriver-header-row {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 5px !important;
    padding-right: 5px !important;
    direction: ltr !important;
}

.amidriver-header-row > a:first-child {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
}

.amidriver-header-row > a:first-child > div:first-child {
    width: 52px !important;
    height: 52px !important;
    flex: 0 0 52px !important;
}

.amidriver-header-row > a:first-child > div:first-child .custom-logo-link,
.amidriver-header-row > a:first-child > div:first-child .custom-logo,
.amidriver-header-row > a:first-child > div:first-child img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: contain !important;
}

.amidriver-brand-subtitle {
    margin-left: 8px !important;
    color: #ffffff !important;
    font-family: Arial, "Noto Nastaliq Urdu", sans-serif !important;
    font-size: 26px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
    text-shadow: 0 3px 0 #e11d1d !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
}

@media (max-width: 767px) {
    .amidriver-header-row {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }
    .amidriver-header-row > a:first-child > div:first-child {
        width: 42px !important;
        height: 42px !important;
        flex-basis: 42px !important;
    }
    .amidriver-brand-subtitle {
        margin-left: 5px !important;
        font-size: 21px !important;
        line-height: 1 !important;
    }
}

/* -----------------------------------------------------------------------
   Admin-only "Upload Question Image" button + modal (header.php).
   PHP only renders this markup for logged-in users who can upload files,
   so none of it ever appears for regular site visitors.
------------------------------------------------------------------------ */
.amidriver-image-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}
.amidriver-image-upload-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.amidriver-image-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.amidriver-image-modal[hidden] {
    display: none;
}
.amidriver-image-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}
.amidriver-image-modal-panel {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 92%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.amidriver-image-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
}
.amidriver-image-modal-header h2 {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}
.amidriver-image-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
}
.amidriver-image-modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.amidriver-image-modal-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}
.amidriver-image-modal-select,
.amidriver-image-modal-body input[type="file"] {
    font-size: 13px;
    font-weight: 400;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #0f172a;
}
.amidriver-image-status {
    font-size: 12px;
    font-weight: 700;
    margin: 0;
}
.amidriver-image-status.is-ok {
    color: #059669;
}
.amidriver-image-status.is-missing {
    color: #d97706;
}
.amidriver-image-upload-submit {
    background: #0A2540;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    padding: 9px 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
}
.amidriver-image-upload-submit:hover {
    background: #123a63;
}
.amidriver-image-upload-submit:disabled {
    opacity: 0.6;
    cursor: default;
}
.amidriver-image-message {
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    min-height: 16px;
}
.amidriver-image-message.is-error {
    color: #dc2626;
}


/* ================================================================
   MOBILE OPTIMISATION (phones, <= 767px)  — v1.14.22
   Goal: the whole question, all answers and the explanation use as
   much of the screen as possible; the footer is minimal; the Next
   button is always reachable in a bar pinned to the bottom edge.
   ================================================================ */
@media (max-width: 767px) {

    /* ---- Compact header (scrolls away on phones, see header.php) ---- */
    header .amidriver-header-row {
        height: 46px !important;
    }
    header .amidriver-header-row > a:first-child > div:first-child {
        width: 34px !important;
        height: 34px !important;
        flex-basis: 34px !important;
    }
    header .amidriver-brand-title { font-size: 19px !important; }
    header .amidriver-brand-subtitle { font-size: 19px !important; }
    header .amidriver-nav-inner {
        min-height: 34px !important;
        padding: 2px 8px !important;
    }
    header .amidriver-nav-link,
    header .amidriver-nav-button {
        padding: 6px 9px !important;
    }

    /* ---- Quiz card: tighter spacing, same content ---- */
    #quiz-section {
        padding: 6px 6px 8px !important;
        scroll-margin-top: 4px;
    }
    #quiz-section .glass-card {
        padding: 10px !important;
        border-radius: 14px !important;
    }
    #quiz-section .amd-progress-row {
        margin-bottom: 6px !important;
        padding-bottom: 6px !important;
    }
    #quiz-section .amd-heading-row {
        margin-bottom: 8px !important;
    }
    #quiz-mainheading {
        font-size: 1rem !important;
        line-height: 1.35 !important;
    }
    #quiz-box > * + * {
        margin-top: 8px !important;
    }
    #question-text {
        padding: 10px 12px !important;
        font-size: 15px !important;
        line-height: 1.6 !important;
    }
    #quiz-section .amd-quiz-grid {
        gap: 8px !important;
    }
    #options-container > * + * {
        margin-top: 6px !important;
    }
    #options-container button {
        padding: 9px 10px !important;
        font-size: 14px !important;
        line-height: 1.5 !important;
        touch-action: manipulation;
    }
    #explanation-box {
        margin-top: 8px !important;
        padding: 10px 12px !important;
    }

    /* ---- Question image: fit the screen instead of a fixed 300x300 box ---- */
    #question-image-container {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        padding: 6px !important;
    }
    #question-image-container img {
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: 34vh !important;
        object-fit: contain !important;
    }

    /* ---- Next button (phones): in-flow, sticky bar right after the quiz card.
            Always above the footer; stays on screen while reading. ---- */
    #next-bar-wrap {
        position: sticky;
        bottom: 0;
        z-index: 40;
        margin: 6px -6px 0;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
        background: linear-gradient(to top, #f8fafc 72%, rgba(248, 250, 252, 0));
    }
    #next-btn-bottom {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        min-height: 50px;
        border: 0;
        border-radius: 14px;
        background: #0A2540;
        color: #fff;
        font-size: 16px;
        font-weight: 800;
        box-shadow: 0 4px 12px rgba(10, 37, 64, .3);
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    #next-btn-bottom:active {
        background: #123a63;
    }

    /* ---- Chapters dropdown (phones): the nav bar scrolls sideways, which
            clipped the menu to a 3px sliver so chapters could not be tapped.
            The panel is now position:fixed under the nav bar (top set by
            toggleHeaderDropdown() in quiz-v4.js). ---- */
    header .amidriver-dropdown-panel {
        position: fixed !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        min-width: 0 !important;
        max-height: 60vh !important;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    header .amidriver-dropdown-panel a {
        padding: 11px 10px !important;
        font-size: 13px !important;
    }

    /* ---- Minimal footer (phones): a single slim line ---- */
    #news-section.amd-footer {
        margin-top: 4px !important;
        padding-top: 6px !important;
        padding-bottom: 6px !important;
    }
    #news-section .amd-footer-grid {
        display: none !important;
    }
    #news-section .amd-footer-bottom {
        display: flex !important;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 0 10px;
        padding: 0 8px !important;
        border-top: 0 !important;
        font-size: 11px !important;
        line-height: 1.5 !important;
    }
    #news-section .amd-footer-bottom p {
        margin: 0 !important;
    }
}

/* Phone-only Next bar: never shown on tablet/desktop (they keep the button
   beside the chapter heading). */
@media (min-width: 768px) {
    #next-bar-wrap { display: none !important; }
}


/* ================================================================
   MOBILE LANGUAGE SWITCHER — always visible
   The nav row scrolls sideways on phones, which pushed the three flag
   buttons off-screen. On phones the group now comes first in the row,
   stays pinned (sticky) while the row scrolls, and is larger with a
   solid background so it is easy to see and tap.
   ================================================================ */
@media (max-width: 767px) {
    header .amidriver-language-inline {
        order: -1 !important;
        position: sticky !important;
        inset-inline-start: 0 !important;
        left: auto;
        z-index: 100001 !important;
        flex: 0 0 auto !important;
        margin: 0 6px 0 0 !important;
        padding: 3px 4px !important;
        gap: 5px !important;
        background: #0b2a6f !important;
        border: 1px solid rgba(255,255,255,.55) !important;
        border-radius: 12px !important;
        box-shadow: 0 2px 6px rgba(0,0,0,.35) !important;
    }
    header .amidriver-language-button {
        min-width: 40px !important;
        min-height: 36px !important;
        padding: 4px 6px !important;
        border: 2px solid rgba(255,255,255,.45) !important;
        background: rgba(255,255,255,.12) !important;
        border-radius: 9px !important;
    }
    header .amidriver-language-button .amidriver-language-flag {
        font-size: 22px !important;
    }
    header .amidriver-language-button.is-active,
    header .amidriver-language-button.is-active:hover,
    header .amidriver-language-button.is-active:focus,
    header .amidriver-language-button.is-active:active {
        background: #ffffff !important;
        background-color: #ffffff !important;
        border-color: #facc15 !important;
        box-shadow: 0 0 0 2px #facc15 !important;
    }
}
