/* =========================================================
   Quran Encyclopedia — e-Quran V15.6
   Presentation layer only. Core routing and content remain untouched.
   ========================================================= */
:root {
    --qe-green-950: #173328;
    --qe-green-900: #1f4032;
    --qe-green-800: #294c3a;
    --qe-green-700: #356248;
    --qe-green-100: #eaf2ed;
    --qe-gold-600: #a98235;
    --qe-gold-500: #bc9650;
    --qe-gold-100: #f6efdf;
    --qe-ink: #27332e;
    --qe-muted: #6d7872;
    --qe-bg: #f6f8f7;
    --qe-card: #ffffff;
    --qe-border: #dde5e0;
    --qe-shadow: 0 12px 34px rgba(23, 51, 40, .08);
    --qe-radius: 18px;
    --qe-reading-scale: 1;
}

html { scroll-behavior: smooth; }
body.qe-v15-body {
    background: var(--qe-bg);
    color: var(--qe-ink);
    overflow-x: hidden;
}
#qe-main { min-height: 60vh; }

/* Hero */
.qe-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    margin: 0 0 16px;
    background:
        radial-gradient(circle at 15% 20%, rgba(188, 150, 80, .16), transparent 32%),
        linear-gradient(135deg, var(--qe-green-950), var(--qe-green-800));
    color: #fff;
    border-bottom: 1px solid rgba(188, 150, 80, .35);
}
.qe-hero-pattern {
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: .12;
    background-image:
        linear-gradient(30deg, rgba(255,255,255,.28) 1px, transparent 1px),
        linear-gradient(150deg, rgba(255,255,255,.22) 1px, transparent 1px);
    background-size: 30px 30px;
}
.qe-hero-inner {
    min-height: 170px;
    padding-top: 28px;
    padding-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.qe-hero-copy { max-width: 760px; }
.qe-hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #ead6aa;
    font-size: 13px;
    font-weight: 700;
}
.qe-hero-kicker::before {
    content: "۞";
    color: var(--qe-gold-500);
    font-size: 16px;
}
.qe-hero h1 {
    margin: 0 0 8px;
    font-size: clamp(26px, 4vw, 38px);
    font-weight: 800;
    line-height: 1.35;
}
.qe-hero h1 a { color: #fff; text-decoration: none; }
.qe-hero p {
    margin: 0;
    color: rgba(255,255,255,.83);
    font-size: 15px;
    line-height: 1.9;
}
.qe-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}
.qe-hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    background: rgba(255,255,255,.07);
    color: #f6f3ec;
    font-size: 12px;
}
.qe-hero-meta i { color: #dfbf79; }
.qe-settings-trigger {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 12px;
    color: #fff;
    background: rgba(255,255,255,.08);
    backdrop-filter: blur(8px);
    font-weight: 700;
    transition: .2s ease;
}
.qe-settings-trigger:hover { background: rgba(255,255,255,.14); transform: translateY(-1px); }
.qe-settings-trigger i { color: #e2c47f; }

/* Quick navigation */
.qe-quicknav-wrap { margin: -1px 0 16px; }
.qe-quicknav {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) auto minmax(230px, .8fr);
    align-items: end;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--qe-border);
    border-radius: 16px;
    background: rgba(255,255,255,.94);
    box-shadow: var(--qe-shadow);
}
.qe-quicknav label,
.qe-quicknav-search > label {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 7px;
    color: #516059;
    font-size: 12px;
    font-weight: 800;
}
.qe-quicknav label i { color: var(--qe-gold-600); }
.qe-control-row { display: flex; align-items: stretch; gap: 8px; }
.qe-control-row .form-select,
.qe-control-row .form-control,
.qe-search-box .form-control {
    min-height: 42px;
    border: 1px solid #d8e1dc;
    border-radius: 11px;
    background-color: #fbfcfb;
    color: var(--qe-ink);
    box-shadow: none !important;
}
.qe-control-row .form-select:focus,
.qe-control-row .form-control:focus,
.qe-search-box .form-control:focus {
    border-color: #96ad9f;
    background: #fff;
}
.qe-go-btn {
    min-width: 88px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 0;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 800;
    transition: .2s ease;
}
.qe-go-btn:hover { transform: translateY(-1px); }
.qe-go-surah { background: var(--qe-green-800); color: #fff; }
.qe-go-ayah { background: var(--qe-gold-100); color: #73591f; border: 1px solid #e2d0a5; }
.qe-quicknav-home { align-self: end; }
.qe-quicknav-home a {
    width: 84px;
    min-height: 42px;
    padding: 5px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 1px solid var(--qe-border);
    border-radius: 11px;
    color: #52635a;
    background: #f8faf9;
    font-size: 10px;
    font-weight: 800;
}
.qe-quicknav-home i { color: var(--qe-green-700); font-size: 14px; }
.qe-quicknav-search { grid-column: 1 / -1; }
.qe-search-box { position: relative; }
.qe-search-box .form-control { padding-inline-end: 44px; }
#qeClearSearch {
    position: absolute;
    inset-inline-end: 7px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #85918a;
}
#qeClearSearch:hover { background: #eef3f0; color: #4a5b52; }
.qe-search-status { min-height: 18px; margin-top: 5px; color: var(--qe-muted); font-size: 11px; }

/* Content */
.qe-content-shell { padding-top: 2px; padding-bottom: 38px; }
.translations-container,
.translation-container { margin-top: 18px !important; }
.translations-title,
.surah-title {
    position: relative;
    overflow: hidden;
    padding: 14px 16px !important;
    border: 1px solid var(--qe-border) !important;
    border-radius: 14px !important;
    background: var(--qe-card) !important;
    box-shadow: 0 6px 20px rgba(23,51,40,.045);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.translations-title::before,
.surah-title::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 3px;
    background: linear-gradient(var(--qe-green-700), var(--qe-gold-500));
}
.translations-title:hover,
.surah-title:hover {
    transform: translateY(-2px);
    border-color: #c6d5cd !important;
    box-shadow: 0 10px 25px rgba(23,51,40,.075);
}
.translations-title a,
.surah-title a { color: var(--qe-green-800) !important; font-weight: 800; }
.translation-title {
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid var(--qe-border);
    border-radius: 16px;
    background: linear-gradient(180deg, #fff, #fafcfb);
    box-shadow: 0 8px 24px rgba(23,51,40,.05);
}
.translation-title h2 { margin-bottom: 8px; color: var(--qe-green-900); font-weight: 800; }
.translation-container-text {
    padding: 18px !important;
    border: 1px solid var(--qe-border) !important;
    border-radius: 16px !important;
    background: var(--qe-card) !important;
    box-shadow: 0 7px 22px rgba(23,51,40,.05) !important;
}
.translation-container-text .quran-text,
.translation-container-text p:first-child {
    font-size: calc(27px * var(--qe-reading-scale));
    line-height: 2.05;
}
.translation-text { font-size: calc(18px * var(--qe-reading-scale)) !important; line-height: 1.95; }
.audio-player { border-radius: 10px; }
.breadcrumb-container { margin-top: 12px !important; }
.breadcrumb { padding: 10px 13px !important; border: 1px solid var(--qe-border); border-radius: 12px; background: #fff; }

/* New share */
.quran-share.qe-share-card {
    margin: 24px 0 6px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid var(--qe-border);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(23,51,40,.05);
    text-align: initial;
}
.qe-share-copy strong { display: block; margin-bottom: 2px; color: var(--qe-green-900); font-size: 14px; }
.qe-share-copy span { color: var(--qe-muted); font-size: 11px; }
.qe-share-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.qe-share-btn {
    min-height: 36px;
    padding: 7px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--qe-border);
    border-radius: 10px;
    background: #f8faf9;
    color: #43544b;
    font-size: 12px;
    font-weight: 800;
}
.qe-share-btn:hover { border-color: #c2d1c9; background: #f1f6f3; }
.qe-share-btn[data-type="whatsapp"] { color: #216942; }
.qe-share-btn[data-type="facebook"] { color: #315c96; }
.qe-share-btn.qe-share-primary { background: var(--qe-green-800); border-color: var(--qe-green-800); color: #fff; }

/* Settings drawer — left side */
.qe-settings-panel {
    position: fixed;
    z-index: 10050;
    top: 0;
    left: 0;
    width: min(360px, 92vw);
    height: 100dvh;
    padding: 20px;
    overflow-y: auto;
    background: #fff;
    border-inline-end: 1px solid var(--qe-border);
    box-shadow: 20px 0 60px rgba(9,30,20,.16);
    transform: translateX(-103%);
    transition: transform .25s ease;
}
.qe-settings-panel.is-open { transform: translateX(0); }
.qe-settings-backdrop {
    position: fixed;
    z-index: 10040;
    inset: 0;
    background: rgba(10,25,18,.38);
    backdrop-filter: blur(2px);
}
.qe-settings-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.qe-settings-eyebrow { color: var(--qe-gold-600); font-size: 11px; font-weight: 800; }
.qe-settings-head h2 { margin: 2px 0 0; font-size: 21px; color: var(--qe-green-900); font-weight: 800; }
#qeSettingsClose {
    width: 38px; height: 38px; border: 1px solid var(--qe-border); border-radius: 11px; background: #f7f9f8; color: #536159;
}
.qe-setting-group { padding: 15px 0; border-top: 1px solid #edf1ef; }
.qe-setting-group h3 { display: flex; align-items: center; gap: 7px; margin: 0 0 10px; color: #4b5c53; font-size: 13px; font-weight: 800; }
.qe-setting-group h3 i { color: var(--qe-gold-600); }
.qe-language-switcher .flags { margin: 0; display: flex; gap: 8px; justify-content: flex-start; }
.qe-language-switcher .flags img { width: 42px; height: 28px; object-fit: cover; border-radius: 7px; border: 1px solid #d8e1dc; margin: 0; }
.qe-setting-action { width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--qe-border); border-radius: 11px; background: #f8faf9; color: #46574e; font-weight: 700; }
.qe-toggle { width: 42px; height: 24px; padding: 3px; display: inline-flex; border-radius: 999px; background: #c8d2cd; transition: .2s; }
.qe-toggle span { width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
#qeThemeToggle.is-active .qe-toggle { background: var(--qe-green-700); }
#qeThemeToggle.is-active .qe-toggle span { transform: translateX(18px); }
[dir="rtl"] #qeThemeToggle.is-active .qe-toggle span { transform: translateX(-18px); }
.qe-font-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.qe-font-controls button { min-height: 40px; border: 1px solid var(--qe-border); border-radius: 10px; background: #f8faf9; color: var(--qe-green-800); font-weight: 900; }
.qe-font-controls output { min-width: 58px; text-align: center; color: #68756f; font-size: 12px; font-weight: 800; }
.qe-reset-settings { width: 100%; min-height: 42px; margin-top: 8px; border: 1px solid #eadfc7; border-radius: 11px; background: #fbf7ed; color: #755d2a; font-weight: 800; }

/* Dark mode */
body.qe-dark {
    --qe-bg: #101814;
    --qe-card: #16211b;
    --qe-ink: #edf3ef;
    --qe-muted: #a7b3ac;
    --qe-border: #2b3a32;
    background: var(--qe-bg);
    color: var(--qe-ink);
}
body.qe-dark .qe-quicknav,
body.qe-dark .translations-title,
body.qe-dark .surah-title,
body.qe-dark .translation-title,
body.qe-dark .translation-container-text,
body.qe-dark .quran-share.qe-share-card,
body.qe-dark .breadcrumb,
body.qe-dark .qe-settings-panel { background: #16211b !important; border-color: #2b3a32 !important; color: #e9efeb; }
body.qe-dark .qe-control-row .form-select,
body.qe-dark .qe-control-row .form-control,
body.qe-dark .qe-search-box .form-control,
body.qe-dark .qe-setting-action,
body.qe-dark .qe-font-controls button,
body.qe-dark .qe-share-btn,
body.qe-dark #qeSettingsClose { background: #1b2922; border-color: #34473d; color: #e7eee9; }
body.qe-dark .translation-title h2,
body.qe-dark .translations-title a,
body.qe-dark .surah-title a,
body.qe-dark .qe-share-copy strong,
body.qe-dark .qe-settings-head h2 { color: #dbe9df !important; }
body.qe-dark .translation-text,
body.qe-dark .translation-container-text p { color: #e2e9e5; }
body.qe-dark .bg1,
body.qe-dark .bg2 { background: #16211b !important; }

@media (max-width: 767.98px) {
    .qe-hero-inner { min-height: 148px; padding-top: 22px; padding-bottom: 22px; align-items: flex-end; gap: 14px; }
    .qe-hero h1 { font-size: 26px; }
    .qe-hero p { font-size: 13px; line-height: 1.7; }
    .qe-hero-meta { margin-top: 10px; }
    .qe-hero-meta span { padding: 5px 8px; font-size: 10px; }
    .qe-settings-trigger { width: 40px; min-width: 40px; height: 40px; padding: 0; border-radius: 11px; }
    .qe-settings-trigger span { display: none; }

    .qe-quicknav { grid-template-columns: minmax(0, 1fr) minmax(0, .72fr); gap: 9px; padding: 10px; }
    .qe-quicknav-surah { grid-column: 1; }
    .qe-quicknav-ayah { grid-column: 2; }
    .qe-quicknav-home { grid-column: 1 / -1; grid-row: 2; }
    .qe-quicknav-home a { width: 100%; min-height: 34px; flex-direction: row; gap: 6px; }
    .qe-control-row { gap: 5px; }
    .qe-go-btn { min-width: 54px; padding-inline: 8px; }
    .qe-go-btn span { display: none; }
    .qe-quicknav label { font-size: 10px; white-space: nowrap; }
    .qe-control-row .form-select,
    .qe-control-row .form-control { min-height: 40px; font-size: 12px; padding-inline: 8px; }

    .quran-share.qe-share-card { align-items: stretch; flex-direction: column; }
    .qe-share-actions { justify-content: stretch; }
    .qe-share-btn { flex: 1 1 calc(50% - 5px); }
    .translation-container-text { padding: 14px !important; }
}

@media (max-width: 390px) {
    .qe-quicknav { grid-template-columns: minmax(0, 1.18fr) minmax(0, .72fr); }
    .qe-go-btn { min-width: 46px; }
    .qe-hero-copy { min-width: 0; }
}

/* =========================================================
   V15.8 — Floating gear settings button
   Fixed at one-third of the viewport from the top, on the left.
   ========================================================= */
.qe-hero-inner {
    justify-content: flex-start;
}

.qe-settings-trigger--floating {
    position: fixed !important;
    z-index: 10020;
    top: 33.333vh !important;
    bottom: auto !important;
    left: 12px !important;
    right: auto !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 !important;
    display: grid !important;
    place-items: center;
    border: 1px solid rgba(255,255,255,.20) !important;
    border-radius: 14px !important;
    background: linear-gradient(145deg, #173f35, #245b4a) !important;
    color: #fff !important;
    box-shadow: 0 10px 28px rgba(13, 48, 38, .24) !important;
    transform: translateY(-50%) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.qe-settings-trigger--floating::after {
    content: "";
    position: absolute;
    inset: -5px;
    border: 1px solid rgba(169, 130, 53, .18);
    border-radius: 18px;
    pointer-events: none;
}

.qe-settings-trigger--floating:hover,
.qe-settings-trigger--floating:focus-visible {
    background: linear-gradient(145deg, #12362d, #1f5142) !important;
    color: #fff !important;
    transform: translateY(-50%) scale(1.04) !important;
    box-shadow: 0 12px 32px rgba(13, 48, 38, .30) !important;
}

.qe-settings-trigger--floating:focus-visible {
    outline: 3px solid rgba(188, 150, 80, .35);
    outline-offset: 4px;
}

.qe-settings-trigger--floating i {
    margin: 0 !important;
    color: #ead19a !important;
    font-size: 18px !important;
    line-height: 1 !important;
}

.qe-settings-trigger--floating span {
    display: none !important;
}

body.qe-dark .qe-settings-trigger--floating {
    border-color: #3c5449 !important;
    background: linear-gradient(145deg, #17382f, #214d40) !important;
    box-shadow: 0 10px 28px rgba(0,0,0,.34) !important;
}

@media (max-width: 767.98px) {
    .qe-settings-trigger--floating {
        top: 33.333vh !important;
        bottom: auto !important;
        left: 10px !important;
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        border-radius: 13px !important;
        transform: translateY(-50%) !important;
        box-shadow: 0 9px 24px rgba(13, 48, 38, .24) !important;
    }

    .qe-settings-trigger--floating:hover,
    .qe-settings-trigger--floating:focus-visible {
        transform: translateY(-50%) scale(1.03) !important;
    }

    .qe-settings-trigger--floating i {
        font-size: 17px !important;
    }
}

@media (max-width: 360px) {
    .qe-settings-trigger--floating {
        left: 8px !important;
        width: 42px !important;
        min-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
    }
}
