/* =====================================================================
   Quran Land — Design System v3
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Amiri:wght@400;700&display=swap');

/* ---------- Variables ---------- */
:root {
    --brand-primary:     #2563eb;
    --brand-primary-dk:  #1d4ed8;
    --brand-primary-lt:  #eff6ff;
    --brand-accent:      #10b981;
    --brand-accent-dk:   #059669;
    --brand-accent-lt:   #ecfdf5;

    --nav-bg:            #0d1b2e;
    --nav-text:          #94afc8;
    --nav-text-active:   #f0f6ff;
    --nav-hover-bg:      rgba(255,255,255,.06);
    --nav-active-bg:     rgba(37,99,235,.18);
    --nav-active-border: #2563eb;
    --nav-width:         270px;
    --nav-border:        rgba(255,255,255,.07);

    --header-bg:         #1e3a5f;
    --header-height:     58px;

    --body-bg:           #f1f5f9;
    --surface:           #ffffff;
    --border:            #e2e8f0;
    --border-strong:     #cbd5e1;

    --text-primary:      #0f172a;
    --text-secondary:    #475569;
    --text-muted:        #94a3b8;

    --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.07), 0 4px 6px rgba(0,0,0,.05);
    --shadow-xl: 0 20px 40px rgba(0,0,0,.10), 0 8px 16px rgba(0,0,0,.06);

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --t-fast: .15s ease;
    --t-base: .25s ease;
    --t-slow: .35s cubic-bezier(.4,0,.2,1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 15px; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-primary);
    background: var(--body-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
a { color: var(--brand-primary); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--brand-primary-dk); }
img { max-width: 100%; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c1ccd9; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #9aaab8; }

/* =====================================================================
   SIDEBAR
   ===================================================================== */

.sidenav {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--nav-width);
    background: var(--nav-bg);
    z-index: 800;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform var(--t-slow);
    will-change: transform;
}
.sidenav.nav-closed { transform: translateX(-100%); }

.sidenav-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--nav-border);
    flex-shrink: 0;
}

.brand-logo { display: flex; align-items: center; gap: 10px; }

.brand-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--brand-primary), #7c3aed);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; flex-shrink: 0;
}

.brand-text .brand-title {
    font-family: 'Amiri', serif;
    font-size: 19px; font-weight: 700;
    color: #fff; line-height: 1.2;
}
.brand-text .brand-sub {
    font-size: 10px; font-weight: 500; color: var(--nav-text);
    letter-spacing: 1.6px; text-transform: uppercase; margin-top: 1px;
}

.sidenav-close {
    background: none; border: none; color: var(--nav-text);
    font-size: 18px; cursor: pointer; padding: 6px;
    border-radius: var(--radius-sm); line-height: 1;
    transition: background var(--t-fast), color var(--t-fast); display: none;
}
.sidenav-close:hover { background: rgba(255,255,255,.08); color: #fff; }

.sidenav-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 0 24px; }

.sidenav-section { margin-top: 4px; }
.sidenav-section + .sidenav-section {
    margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--nav-border);
}

.sidenav-label {
    font-size: 10px; font-weight: 600; letter-spacing: 1.5px;
    text-transform: uppercase; color: rgba(148,175,200,.4); padding: 10px 18px 5px;
}

.sidenav a {
    display: flex; align-items: center; gap: 11px; padding: 10px 18px;
    color: var(--nav-text); font-size: 13.5px; font-weight: 450;
    border-left: 3px solid transparent;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
    text-decoration: none; white-space: nowrap;
}
.sidenav a:hover { background: var(--nav-hover-bg); color: var(--nav-text-active); text-decoration: none; }
.sidenav a.active { background: var(--nav-active-bg); color: var(--nav-text-active); border-left-color: var(--nav-active-border); font-weight: 600; }

.nav-icon { width: 18px; text-align: center; font-size: 13px; flex-shrink: 0; opacity: .75; }
.sidenav a:hover .nav-icon, .sidenav a.active .nav-icon { opacity: 1; }

.nav-field { padding: 5px 14px; }
.nav-field label {
    display: block; font-size: 10px; font-weight: 600; letter-spacing: 1px;
    text-transform: uppercase; color: rgba(148,175,200,.5); margin-bottom: 4px; padding-left: 2px;
}

.nav-select {
    width: 100%; padding: 7px 10px;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.10);
    border-radius: var(--radius-sm); color: #c8d9ea; font-size: 12.5px;
    font-family: 'Inter', sans-serif; cursor: pointer;
    transition: border-color var(--t-fast), background var(--t-fast); appearance: auto;
}
.nav-select:hover { border-color: rgba(255,255,255,.22); }
.nav-select:focus { outline: none; border-color: var(--brand-primary); }
.nav-select option { background: #1a2d44; color: #c8d9ea; }

.nav-actions { padding: 8px 14px; display: flex; gap: 7px; }

/* =====================================================================
   OVERLAYS & LOADING
   ===================================================================== */

.nav-overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 999;
    backdrop-filter: blur(2px); opacity: 0; transition: opacity var(--t-base);
    visibility: hidden;
    pointer-events: none;
}
.nav-overlay.visible { opacity: 1; visibility: visible; pointer-events: auto; }

.loading-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(255,255,255,.82); z-index: 9000;
    align-items: center; justify-content: center; flex-direction: column;
    gap: 16px; backdrop-filter: blur(3px);
}
.loading-overlay.active { display: flex; }
.loading-spinner {
    width: 40px; height: 40px; border: 3px solid var(--border);
    border-top-color: var(--brand-primary); border-radius: 50%;
    animation: spin .7s linear infinite;
}
.loading-text { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
@keyframes spin { to { transform: rotate(360deg); } }
#waitlayer, #graylayer, .HideGray { display: none; }

/* =====================================================================
   HEADER
   ===================================================================== */

.site-header {
    position: fixed; top: 0; left: var(--nav-width); right: 0;
    height: var(--header-height); background: var(--header-bg); z-index: 900;
    display: flex; align-items: center; padding: 0 20px; gap: 12px;
    box-shadow: 0 1px 0 rgba(0,0,0,.25), 0 4px 12px rgba(0,0,0,.12);
    transition: left var(--t-slow);
}
.site-header.full-width { left: 0; }

.header-toggle {
    background: none; border: none; color: rgba(255,255,255,.75); font-size: 20px;
    cursor: pointer; padding: 7px; border-radius: var(--radius-sm); line-height: 1;
    transition: background var(--t-fast), color var(--t-fast); flex-shrink: 0;
}
.header-toggle:hover { background: rgba(255,255,255,.12); color: #fff; }
.site-logo {
    display: flex; align-items: center; gap: 9px;
    text-decoration: none; flex-shrink: 0; user-select: none;
}
.site-logo-icon {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--brand-primary) 0%, #1d4ed8 100%);
    border-radius: 8px;
    font-size: 15px; color: #fff;
    box-shadow: 0 2px 6px rgba(37,99,235,.45);
    flex-shrink: 0;
}
.site-logo-text {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 18px; font-weight: 800;
    letter-spacing: -.3px; color: #fff;
    text-transform: none;
}
.site-logo-accent { color: #93c5fd; font-weight: 500; }
.header-divider { width: 1px; height: 20px; background: rgba(255,255,255,.2); }
.header-subtitle { font-size: 12px; color: rgba(255,255,255,.6); font-weight: 500; letter-spacing: .5px; }
.header-spacer { flex: 1; }

/* =====================================================================
   PAGE SHELL
   ===================================================================== */

.page-wrapper {
    display: flex; flex-direction: column; min-height: 100vh;
    margin-left: var(--nav-width); margin-top: var(--header-height);
    transition: margin-left var(--t-slow);
}
.page-wrapper.full-width { margin-left: 0; }
.main-content { flex: 1; padding: 28px 28px 40px; min-width: 0; }

.site-footer {
    padding: 14px 28px; border-top: 1px solid var(--border); background: var(--surface);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--text-muted);
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--brand-primary); }
.footer-links { display: flex; gap: 16px; }

/* =====================================================================
   PAGE HEADER
   ===================================================================== */

.page-header { margin-bottom: 24px; }
.page-title { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.title-icon {
    width: 38px; height: 38px; border-radius: var(--radius);
    background: var(--brand-primary-lt); color: var(--brand-primary);
    display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.page-desc { font-size: 13.5px; color: var(--text-muted); margin-top: 5px; padding-left: 50px; }

/* =====================================================================
   CARDS
   ===================================================================== */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 20px; }
.card-header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); background: #fafbfc; }
.card-header h3 { font-size: 13.5px; font-weight: 700; color: var(--text-primary); margin: 0; letter-spacing: -.1px; }
.card-icon { color: var(--brand-primary); font-size: 14px; width: 16px; text-align: center; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--border); background: #fafbfc; display: flex; align-items: center; gap: 10px; }

/* =====================================================================
   FORMS
   ===================================================================== */

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label, .form-label { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .6px; }
.form-control {
    width: 100%; padding: 9px 12px; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-size: 13.5px; font-family: 'Inter', sans-serif;
    color: var(--text-primary); background: #fff;
    transition: border-color var(--t-fast), box-shadow var(--t-fast); line-height: 1.4;
}
.form-control:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-control-row { display: flex; gap: 8px; align-items: stretch; }
.form-control-row .form-control { flex: 1; }
.input-note { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.input-note a { color: var(--brand-primary); }

/* =====================================================================
   BUTTONS
   ===================================================================== */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 18px; border-radius: var(--radius-sm); font-family: 'Inter', sans-serif;
    font-size: 13.5px; font-weight: 600; cursor: pointer; border: 1.5px solid transparent;
    transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
    line-height: 1; white-space: nowrap; text-decoration: none;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }
.btn-primary:hover { background: var(--brand-primary-dk); border-color: var(--brand-primary-dk); box-shadow: 0 4px 12px rgba(37,99,235,.3); color: #fff; }

.btn-accent { background: var(--brand-accent); color: #fff; border-color: var(--brand-accent); }
.btn-accent:hover { background: var(--brand-accent-dk); border-color: var(--brand-accent-dk); box-shadow: 0 4px 12px rgba(16,185,129,.3); color: #fff; }

.btn-outline { background: transparent; color: var(--text-secondary); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--body-bg); color: var(--text-primary); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--body-bg); color: var(--text-primary); }

.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }

.btn-calendar {
    padding: 9px 12px; background: var(--body-bg); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer; color: var(--text-secondary);
    font-size: 14px; transition: background var(--t-fast), border-color var(--t-fast); line-height: 1;
}
.btn-calendar:hover { border-color: var(--brand-primary); color: var(--brand-primary); background: var(--brand-primary-lt); }

/* =====================================================================
   BADGES
   ===================================================================== */

.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; line-height: 1.4; }
.badge-primary { background: var(--brand-primary-lt); color: var(--brand-primary); }
.badge-accent  { background: var(--brand-accent-lt); color: var(--brand-accent-dk); }
.badge-gray    { background: var(--body-bg); color: var(--text-secondary); border: 1px solid var(--border); }

/* =====================================================================
   MODAL
   ===================================================================== */

.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,.55); z-index: 2000;
    overflow-y: auto; padding: 60px 16px; backdrop-filter: blur(4px);
}
.modal-overlay.open { display: block; }
.modal-box {
    background: var(--surface); max-width: 660px; margin: 0 auto;
    border-radius: var(--radius-xl); overflow: hidden;
    box-shadow: var(--shadow-xl); animation: modal-in .2s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.modal-close {
    background: none; border: none; font-size: 20px; cursor: pointer;
    color: var(--text-muted); padding: 4px 8px; border-radius: var(--radius-sm);
    line-height: 1; transition: background var(--t-fast), color var(--t-fast);
}
.modal-close:hover { background: var(--body-bg); color: var(--text-primary); }
.modal-body { padding: 22px; }
.modal-section + .modal-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.modal-section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); margin-bottom: 10px; }

/* =====================================================================
   QURAN READER
   ===================================================================== */

.h5-player {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.h5-player audio {
    flex: 1;
    min-width: 200px;
    height: 36px;
    accent-color: var(--brand-primary);
}
.h5-player-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.h5-player-label i { color: var(--brand-primary); margin-right: 4px; }
.h5-player-continuous {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
}

#QuranParagraf {
    font-family: 'Amiri', 'Simplified Arabic', 'Arabic Typesetting', serif;
    font-size: clamp(20px, 2.5vw, 28px); line-height: 2.4;
    text-align: justify; direction: rtl; color: var(--text-primary);
}
#TranslationParagraf { font-size: 14.5px; line-height: 2; color: var(--text-secondary); margin-top: 8px; }

.highlight  { color: #ef4444 !important; }
.highlight2 { color: var(--brand-accent) !important; font-weight: 700; }
.HideDiv    { display: none !important; }
.ShowDiv    { display: block !important; }
.AyahNumer  { color: inherit; text-decoration: none; }
.sign       { color: var(--text-muted); }
.selected   { background: #fefce8; border-radius: 4px; }

.search-result-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; cursor: pointer; transition: background var(--t-fast); }
.search-result-row:hover { background: var(--brand-primary-lt); }
.search-result-row:last-child { border-bottom: none; }
.search-badge { background: var(--brand-primary); color: #fff; border-radius: 99px; font-size: 10.5px; font-weight: 600; padding: 2px 9px; white-space: nowrap; flex-shrink: 0; }

.verse-nav { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 16px 0 4px; flex-wrap: wrap; }
.verse-nav .btn { min-width: 140px; }

/* =====================================================================
   ABOUT
   ===================================================================== */

.about-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.about-meta-item { background: var(--body-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.about-meta-item h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--text-muted); margin-bottom: 5px; }
.about-meta-item p { font-size: 13.5px; color: var(--text-primary); font-weight: 500; }

.version-list { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.version-list li { display: flex; align-items: baseline; gap: 14px; font-size: 13.5px; color: var(--text-secondary); line-height: 1.6; }
.version-tag { display: inline-block; background: var(--brand-primary-lt); color: var(--brand-primary); font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; flex-shrink: 0; }
.version-list li:first-child .version-tag { background: var(--brand-accent-lt); color: var(--brand-accent-dk); }

.tech-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.tech-pill { background: var(--body-bg); border: 1px solid var(--border); border-radius: 99px; padding: 5px 14px; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.tech-pill i { color: var(--brand-primary); font-size: 12px; }

/* =====================================================================
   UTILITY
   ===================================================================== */

.ad-container { text-align: center; margin: 0 0 20px; overflow: hidden; }
.d-flex { display: flex; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .flex-1 { flex: 1; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; } .text-muted { color: var(--text-muted); font-size: 13px; } .w-100 { width: 100%; }
.separator { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */

@media (max-width: 1024px) { :root { --nav-width: 245px; } }

@media (max-width: 768px) {
    :root { --nav-width: 270px; --header-height: 54px; }
    .sidenav { transform: translateX(-100%); }
    .sidenav.mobile-open { transform: translateX(0); box-shadow: var(--shadow-xl); z-index: 1001; }
    .sidenav-body { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
    body.nav-open-mobile { overflow: hidden; touch-action: none; }
    .sidenav-close { display: flex; }
    .site-header { left: 0 !important; }
    .page-wrapper { margin-left: 0 !important; }
    .main-content { padding: 18px 16px 32px; }
    .site-footer { padding: 12px 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .page-desc { padding-left: 0; }
}

@media (max-width: 480px) {
    .header-subtitle, .header-divider { display: none; }
    .btn { padding: 8px 14px; font-size: 13px; }
    .modal-overlay { padding: 20px 10px; }
    .modal-box { border-radius: var(--radius-lg); }
    .about-meta { grid-template-columns: 1fr; }
    .version-list li { flex-direction: column; gap: 4px; }
}
