/* ================================================================
   مِقْراء — Design System v3 "Paper & Ink"
   Brand: warm paper (#F8F7F3) + ink brown (#8B6542) + gold accent.
   Night: deep forest library (#0F2E2A) — never pure black.
   Fonts: Alyamama (display/brand voice) · Cairo (UI body)
   Theme: light (paper) by default, data-theme="dark" for night.
   All names English, all labels Arabic. RTL-first using logical props.
   ================================================================ */

/* ---------- Self-hosted fonts (no CDN, swap + unicode-range) ---------- */
@font-face {
    font-family: 'Alyamama';
    src: url('/fonts/alyamama/ar-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFC, U+200C-200E, U+2010-2011;
}
@font-face {
    font-family: 'Alyamama';
    src: url('/fonts/alyamama/latin-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+2000-206F;
}

@font-face { font-family: 'Cairo'; src: url('/fonts/cairo/cairo-400.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Cairo'; src: url('/fonts/cairo/cairo-600.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Cairo'; src: url('/fonts/cairo/cairo-700.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Cairo'; src: url('/fonts/cairo/cairo-800.ttf') format('truetype'); font-weight: 800; font-style: normal; font-display: swap; }

/* ================================================================
   TOKENS — DAY (reading in daylight)
   ================================================================ */
:root {
    /* ---- Brand: warm ink / walnut ---- */
    --brand: #8B6542;
    --brand-hover: #735238;
    --brand-strong: #5E4128;
    --brand-soft: #F3ECE2;          /* tinted surface */
    --brand-softer: #FAF6EF;

    /* ---- Accent: gold (used sparingly) ---- */
    --accent: #C9A646;
    --accent-soft: #FBF4DF;
    --accent-strong: #A8872C;

    /* ---- Surfaces ---- */
    --bg: #F8F7F3;                  /* paper */
    --bg-secondary: #F4EFE7;        /* deeper paper */
    --surface: #FFFFFF;             /* cards */
    --surface-2: #FBF9F5;
    --surface-3: #F6F2EB;
    --border: #E8DDCB;
    --border-strong: #D9CBB2;

    /* ---- Text ---- */
    --ink: #3D3328;                 /* primary text */
    --ink-soft: #5A5043;
    --ink-muted: #6B6256;           /* secondary text */
    --ink-faint: #96897A;           /* meta text */

    /* ---- Semantic ---- */
    --success: #3F7D58;
    --success-soft: #E4F0E8;
    --warning: #D4A017;
    --warning-soft: #FBF1D4;
    --danger: #B5473C;
    --danger-soft: #F8E6E3;
    --info: #54786E;
    --info-soft: #E6EEEB;

    /* ---- Legacy aliases (existing markup compat) ---- */
    --brand-dark: var(--brand-strong);
    --brand-darker: #4A3220;
    --brand-light: var(--brand-soft);
    --brand-lighter: var(--brand-softer);
    --gray-700: var(--ink-soft);
    --gray-500: var(--ink-muted);
    --gray-400: var(--ink-faint);
    --gray-300: var(--border-strong);
    --gray-200: var(--border);
    --gray-100: var(--surface-3);
    --gray-50: var(--bg);
    --slate-700: var(--gray-700);
    --slate-500: var(--gray-500);
    --slate-400: var(--gray-400);
    --slate-300: var(--gray-300);
    --slate-200: var(--gray-200);
    --slate-100: var(--gray-100);
    --slate-50:  var(--gray-50);
    --soft-brand: var(--brand-soft);
    --soft-info: var(--info-soft);
    --soft-warn: var(--warning-soft);
    --soft-success: var(--success-soft);
    --soft-danger: var(--danger-soft);
    --soft-accent: var(--accent-soft);
    --text-muted: var(--ink-muted);
    --topbar-bg: var(--surface);
    --dropdown-bg: var(--surface);

    /* ---- Sidebar (panel) ---- */
    --sidebar-bg: var(--surface);
    --sidebar-text: #7A6D5C;
    --sidebar-text-strong: var(--ink);
    --sidebar-hover: rgba(139, 101, 66, 0.07);
    --sidebar-active: var(--brand-soft);
    --sidebar-border: var(--border);

    /* ---- Typography ---- */
    --font-display: 'Alyamama', 'Cairo', serif;
    --font-body: 'Cairo', system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
    --fs-h1: clamp(2rem, 3.6vw, 2.75rem);
    --fs-h2: 1.75rem;
    --fs-h3: 1.3rem;
    --lh-tight: 1.3;
    --lh-body: 1.8;

    /* ---- Shape / spacing ---- */
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 26px;
    --btn-height: 44px;
    --sidebar-width: 264px;
    --topbar-height: 68px;

    /* ---- Elevation — very soft, warm-tinted ---- */
    --shadow-xs: 0 1px 2px rgba(93, 74, 52, 0.05);
    --shadow-sm: 0 2px 6px rgba(93, 74, 52, 0.06);
    --shadow: 0 10px 28px rgba(93, 74, 52, 0.09);
    --shadow-lg: 0 20px 52px rgba(93, 74, 52, 0.14);

    --transition: .25s ease;

    --btn-disabled-bg: var(--surface-3);
    --btn-disabled-border: var(--border-strong);
    --btn-disabled-text: var(--ink-faint);
}

/* ================================================================
   TOKENS — NIGHT (reading in a deep forest library; never black)
   ================================================================ */
:root[data-theme="dark"] {
    --brand: #2A746A;
    --brand-hover: #35867B;
    --brand-strong: #8FD0C4;
    --brand-soft: #1B4D46;
    --brand-softer: #16423C;

    --accent: #C9A646;
    --accent-soft: rgba(201, 166, 70, 0.16);
    --accent-strong: #E0BE60;

    --bg: #0F2E2A;
    --bg-secondary: #0C2825;
    --surface: #16423C;
    --surface-2: #1B4D46;
    --surface-3: #21554D;
    --border: #2D5A54;
    --border-strong: #3A6B63;

    --ink: #F6F3EB;
    --ink-soft: #E4DECF;
    --ink-muted: #D9D2C3;
    --ink-faint: #A39D8D;

    --success: #5FA97E;
    --success-soft: rgba(95, 169, 126, 0.16);
    --warning: #DDB04B;
    --warning-soft: rgba(221, 176, 75, 0.16);
    --danger: #DE7A6E;
    --danger-soft: rgba(222, 122, 110, 0.16);
    --info: #7FB5AA;
    --info-soft: rgba(127, 181, 170, 0.16);

    --brand-dark: var(--brand-strong);
    --brand-darker: #BFE3DB;
    --brand-light: var(--brand-soft);
    --brand-lighter: var(--brand-softer);
    --gray-700: var(--ink-soft);
    --gray-500: var(--ink-muted);
    --gray-400: var(--ink-faint);
    --gray-300: var(--border-strong);
    --gray-200: var(--border);
    --gray-100: var(--surface-2);
    --gray-50: var(--bg);
    --text-muted: var(--ink-muted);
    --topbar-bg: var(--surface);
    --dropdown-bg: var(--surface-2);

    --sidebar-bg: #123A34;
    --sidebar-text: #9DBAB2;
    --sidebar-text-strong: var(--ink);
    --sidebar-hover: rgba(255, 255, 255, 0.05);
    --sidebar-active: rgba(201, 166, 70, 0.13);
    --sidebar-border: var(--border);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 52px rgba(0, 0, 0, 0.55);

    --btn-disabled-bg: var(--surface-3);
    --btn-disabled-border: var(--border-strong);
    --btn-disabled-text: var(--ink-faint);
}

/* ================================================================
   BASE
   ================================================================ */
html { font-size: 16px; position: relative; min-height: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: var(--lh-body);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Display voice — Alyamama for headings, brand, book covers, big numbers */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.section-title, .display-4 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: var(--lh-tight);
    color: var(--ink);
}

a {
    color: var(--accent-strong);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: var(--brand-hover); }

::selection { background: var(--accent); color: #3D3328; }

/* ================================================================
   SITE NAVBAR — quiet paper bar with a hairline border
   ================================================================ */
.site-navbar {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    --bs-navbar-padding-y: 0.6rem;
    /* Shadow appears only after user scrolls (class toggled by JS) */
    transition: box-shadow var(--transition);
}
.site-navbar.scrolled {
    box-shadow: var(--shadow-sm);
}

/* Push page content below the fixed bar */
body { padding-top: 68px; }

/* Panel layout has no fixed site navbar — undo the offset so the
   topbar sits flush at the viewport top. */
body.panel-body { padding-top: 0; }

/* ================================================================
   BACK-TO-TOP BUTTON
   ================================================================ */
.btn-back-to-top {
    position: fixed;
    bottom: 1.75rem;
    /* RTL: place on the left side (logical inline-start) */
    inset-inline-start: 1.75rem;
    z-index: 1050;
    width: 46px; height: 46px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--brand);
    font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity var(--transition), visibility var(--transition),
                transform var(--transition), background var(--transition),
                color var(--transition), border-color var(--transition);
}
.btn-back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.btn-back-to-top:hover,
.btn-back-to-top:focus-visible {
    background: var(--brand);
    color: #FFF8ED;
    border-color: var(--brand);
    outline: none;
}
[data-theme="dark"] .btn-back-to-top {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--brand-strong);
}
[data-theme="dark"] .btn-back-to-top:hover,
[data-theme="dark"] .btn-back-to-top:focus-visible {
    background: var(--brand);
    color: var(--ink);
    border-color: var(--brand);
}

.site-navbar .navbar-brand {
    white-space: nowrap;
    flex-shrink: 0;
}
.site-navbar .navbar-actions {
    flex-shrink: 0;
}
.site-navbar .navbar-brand .brand-logo {
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 400;
    color: var(--ink);
}
.brand-mark { color: var(--accent); }   /* gold hamza — the signature mark */

/* Brand lockup — gold-tinted orb + wordmark */
.brand-orb {
    width: 40px; height: 40px;
    /*border-radius: 12px;
    background: white;
    border: 1px solid rgba(201, 166, 70, 0.45);
    color: var(--accent-strong);*/
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
/*    padding: 2%;*/
}

.site-navbar .nav-link {
    color: var(--ink-muted) !important;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem !important;
    transition: background-color var(--transition), color var(--transition);
    display: flex; align-items: center; gap: 6px;
}
.site-navbar .nav-link:hover,
.site-navbar .nav-link.active {
    color: var(--ink) !important;
    background-color: var(--brand-soft);
}
.account-link { color: var(--ink) !important; }

.site-navbar .navbar-toggler {
    min-height: 40px;
    height: 40px;
    padding: 0 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    color: var(--ink-muted);
    font-size: 1rem;
    box-shadow: none;
    transition: all var(--transition);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.site-navbar .navbar-toggler i {
    line-height: 1;
}
.site-navbar .navbar-toggler:hover,
.site-navbar .navbar-toggler:focus {
    border-color: var(--brand);
    color: var(--brand);
    background: var(--brand-soft);
    box-shadow: none;
}

/* Navbar CTA — register button in the bar */
.nav-cta,
.nav-cta-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    background: var(--brand);
    border: 1px solid var(--brand);
    color: #FFF8ED !important;
    font-weight: 700; font-size: 0.92rem;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.nav-cta:hover,
.nav-cta-btn:hover,
.nav-cta-btn:focus { background: var(--brand-hover); border-color: var(--brand-hover); color: #FFF8ED !important; transform: translateY(-1px); }

@media (max-width: 767.98px) {
    .nav-cta-btn { padding: 0 10px; width: 40px; }
}

.dropdown-menu {
    text-align: right;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    background-color: var(--dropdown-bg);
    padding: 0.4rem;
}
.dropdown-item { padding: 0.55rem 1rem; font-size: 0.92rem; color: var(--ink); border-radius: var(--radius-sm); }
.dropdown-item:hover, .dropdown-item:focus { background-color: var(--brand-softer); }
.dropdown-divider { border-color: var(--border); }
.dropdown-header { color: var(--ink-faint); font-size: 0.78rem; }
.dropdown-item i { width: 18px; text-align: center; margin-inline-end: 6px; }

/* ================================================================
   PANEL LAYOUT — Sidebar + Topbar
   ================================================================ */
.panel-wrapper { display: flex; height: 100vh; overflow: hidden; }
.panel-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }

.panel-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    padding: 10px 10px 10px 0;
    background: transparent;
    position: fixed; top: 0; right: 0; z-index: 1040;
    transition: transform 0.25s ease;
}
.panel-sidebar .sidebar-shell {
    height: 100%;
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-lg);
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.sidebar-brand {
    margin: 10px 10px 0;
    padding: 12px 24%;
    border-radius: var(--radius);
    border: 1px solid var(--sidebar-border);
    background: var(--surface-2);
    color: var(--sidebar-text-strong);
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 1.25rem;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition);
}
.sidebar-brand:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); }

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px; margin: 0;
    list-style: none;
}

.sidebar-section-label {
    padding: 14px 10px 6px;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    color: var(--ink-faint);
    font-weight: 700;
}

.sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px;
    margin: 2px 0 ;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 0.92rem; font-weight: 600;
    transition: background var(--transition), color var(--transition);
    position: relative;
}
.sidebar-link i {
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--brand);
    background: transparent;
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition);
}
.sidebar-link:hover { color: var(--sidebar-text-strong); background: var(--sidebar-hover); text-decoration: none; }
.sidebar-link:hover i { background: var(--accent-soft); color: var(--accent-strong); }

.sidebar-link.active {
    color: var(--sidebar-text-strong);
    background: var(--sidebar-active);
}
.sidebar-link.active i { background: var(--accent); color: #3D3328; }
.sidebar-link.active::before {
    content: '';
    position: absolute;
    inset-inline-start: -10px;
    top: 8px; bottom: 8px;
    width: 3px;
    border-radius: 3px;
    background: var(--accent);
}

.sidebar-group {
    width: 100%; background: none; border: none; cursor: pointer;
    text-align: start; color: inherit; font: inherit;
    justify-content: flex-start;
}
.sidebar-group .sidebar-group-chevron {
    width: auto !important;
    height: auto !important;
    background: transparent !important;
    font-size: 0.75rem;
    margin-inline-start: auto;
    color: var(--ink-faint);
    transition: transform var(--transition), color var(--transition);
}
.sidebar-group.open .sidebar-group-chevron { transform: rotate(180deg); }
.sidebar-link.active .sidebar-group-chevron {
    color: var(--sidebar-text-strong);
    background: transparent !important;
}

.sidebar-subnav {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-rows: 0fr;
    transition: grid-template-rows 0.25s ease;
}
.sidebar-subnav.open { grid-template-rows: 1fr; }
.sidebar-subnav > li { margin: 0; min-height: 0; overflow: hidden; }
.sidebar-subnav-inner {
    margin-top: 4px; padding: 4px;
    background: var(--surface-2);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-sm);
}
.sidebar-subnav .sidebar-link {
    padding: 7px 10px;
    padding-inline-start: 46px;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--sidebar-text);
}
.sidebar-subnav .sidebar-link:hover { color: var(--sidebar-text-strong); background: var(--sidebar-hover); }
.sidebar-subnav .sidebar-link.active {
    color: var(--sidebar-text-strong);
    background: var(--sidebar-active);
}
.sidebar-subnav .sidebar-link.active::before {
    inset-inline-start: auto;
    top: 50%;
    inset-inline-end: 8px;
    width: 6px; height: 6px;
    border-radius: 50%;
    transform: translateY(-50%);
}

.sidebar-footer {
    margin: 10px;
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--sidebar-border);
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.sidebar-user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--brand);
    border: 2px solid var(--sidebar-border);
    display: flex; align-items: center; justify-content: center;
    color: #FFF8ED; font-weight: 700; font-size: 0.85rem;
    flex-shrink: 0;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-user-name {
    font-size: 0.85rem; font-weight: 700;
    color: var(--sidebar-text-strong);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 0.72rem; color: var(--ink-faint); }
.sidebar-logout {
    width: 36px; height: 36px;
    padding: 0 !important;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--sidebar-border) !important;
    background: var(--surface) !important;
    color: var(--ink-muted) !important;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all var(--transition);
}
.sidebar-logout:hover {
    color: var(--danger) !important;
    border-color: var(--danger) !important;
    background: var(--danger-soft) !important;
}

.panel-topbar {
    height: var(--topbar-height); flex-shrink: 0;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem; position: sticky; top: 0; z-index: 1030;
}
.panel-topbar-left { display: flex; align-items: center; gap: 12px; }
.panel-toggle-btn { background: none; border: none; font-size: 1.4rem; color: var(--ink-muted); cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm); transition: background var(--transition); display: none; }
.panel-toggle-btn:hover { background: var(--brand-soft); }
.panel-breadcrumb { font-size: 0.88rem; color: var(--ink-muted); margin: 0; }
.panel-breadcrumb a { color: var(--ink-muted); }
.panel-breadcrumb a:hover { color: var(--brand); }
.panel-topbar-right { display: flex; align-items: center; gap: 8px; }

.panel-content { flex: 1 1 auto; margin-right: var(--sidebar-width); padding: 1.75rem; min-height: 0; overflow-y: auto; background: var(--bg); }

/* ============= Scrollbars ============= */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--brand); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }
.panel-content { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sidebar-border); border: none; border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.sidebar-nav { scrollbar-width: thin; scrollbar-color: var(--sidebar-border) transparent; }

.sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(61, 51, 40, 0.5);
    backdrop-filter: blur(3px);
    z-index: 1035;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }

/* ================================================================
   PAGE HEADER
   ================================================================ */
.page-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.page-header-title { display: flex; align-items: center; gap: 12px; }
.page-header-title i {
    font-size: 1.2rem; color: var(--brand);
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-soft);
    border-radius: var(--radius);
    flex-shrink: 0;
}
.page-header-title h2 { font-size: 1.5rem; font-weight: 400; margin: 0; color: var(--ink); }
.page-header-title .subtitle { font-size: 0.88rem; color: var(--ink-muted); margin: 0; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ================================================================
   STAT CARDS — Alyamama numerals, quiet tinted icon wells
   ================================================================ */
.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    padding: 1.35rem 1.5rem;
    display: flex; align-items: center; gap: 1rem;
    transition: transform var(--transition), box-shadow var(--transition);
    border: 1px solid var(--border);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-card-icon { width: 52px; height: 52px; border-radius: 15px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-card-icon.bg-brand { background: var(--brand-soft); color: var(--brand); }
.stat-card-icon.bg-info { background: var(--info-soft); color: var(--info); }
.stat-card-icon.bg-warning { background: var(--warning-soft); color: var(--warning); }
.stat-card-icon.bg-success { background: var(--success-soft); color: var(--success); }
.stat-card-icon.bg-danger { background: var(--danger-soft); color: var(--danger); }
.stat-card-icon.bg-accent { background: var(--accent-soft); color: var(--accent-strong); }
.stat-card-body { flex: 1; }
.stat-number { font-family: var(--font-display); font-size: 1.9rem; font-weight: 400; color: var(--ink); line-height: 1.15; }
.stat-label { color: var(--ink-muted); font-size: 0.85rem; margin-top: 0.2rem; }

/* ============ Section titles ============ */
.section-title { font-weight: 400; position: relative; padding-right: 1rem; font-family: var(--font-display); }
.section-title::before {
    content: ""; position: absolute; right: 0; top: 50%;
    transform: translateY(-50%);
    width: 5px; height: 68%;
    background: linear-gradient(180deg, var(--accent), var(--brand));
    border-radius: 4px;
}

/* Section eyebrow — small gold kicker above titles */
.section-eyebrow {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--accent-strong);
    font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
}

/* ================================================================
   CARDS
   ================================================================ */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    background-color: var(--surface);
}
.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    padding: 1rem 1.35rem;
    color: var(--ink);
}
.card-header i { margin-inline-end: 6px; color: var(--brand); }
.card-title { font-weight: 700; font-size: 1rem; font-family: var(--font-body); }

/* ================================================================
   BOOK CARDS — cover-forward, editorial
   ================================================================ */
.book-card-link { display: block; color: inherit; }
.book-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex; flex-direction: column; height: 100%;
    border: 1px solid var(--border);
}
.book-card-link:hover .book-card { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.book-cover {
    aspect-ratio: 3 / 4;
    background: linear-gradient(160deg, var(--brand) 0%, var(--brand-strong) 100%);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover-placeholder { font-family: var(--font-display); font-size: 2.8rem; font-weight: 400; color: rgba(255, 248, 237, 0.92); }
.book-info { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.book-title { font-family: var(--font-display); font-size: 1.02rem; font-weight: 400; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); }
.book-author { font-size: 0.8rem; color: var(--ink-muted); margin: 0; }
.book-meta-row { display: flex; align-items: center; gap: 10px; font-size: 0.78rem; color: var(--ink-faint); margin-top: 2px; }
.book-rating { color: var(--accent-strong); display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.book-price-row { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 0.55rem; }
.book-price { font-weight: 800; color: var(--brand); font-size: 0.98rem; }

.book-detail-cover {
    aspect-ratio: 3 / 4;
    background: linear-gradient(160deg, var(--brand) 0%, var(--brand-strong) 100%);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow);
}
.book-detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-detail-cover .book-cover-placeholder { font-family: var(--font-display); font-size: 4.2rem; color: rgba(255, 248, 237, 0.92); }

/* ================================================================
   LIBRARY CARDS
   ================================================================ */
.library-card-link { display: block; color: inherit; }
.library-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition), box-shadow var(--transition);
    height: 100%;
    border: 1px solid var(--border);
}
.library-card-link:hover .library-card { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.library-cover { aspect-ratio: 16 / 7; background: var(--brand-softer); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.library-cover img { width: 100%; height: 100%; object-fit: cover; }
.library-cover-placeholder, .library-cover-icon { font-size: 2.4rem; color: var(--brand); }
.library-body { padding: 1.15rem 1.15rem 1.25rem; }
.library-name { font-family: var(--font-display); font-size: 1.15rem; font-weight: 400; margin: 0 0 0.3rem; color: var(--ink); }
.library-location { font-size: 0.85rem; color: var(--ink-muted); margin: 0 0 0.45rem; }
.library-desc { font-size: 0.85rem; color: var(--ink-muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.library-header {
    background: linear-gradient(150deg, var(--brand) 0%, var(--brand-strong) 100%);
    background-size: cover; background-position: center;
    border-bottom-left-radius: 26px; border-bottom-right-radius: 26px;
}
.library-logo {
    width: 84px; height: 84px; border-radius: 20px;
    background: rgba(255, 248, 237, 0.16);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; flex-shrink: 0;
    font-size: 2rem; color: rgba(255, 248, 237, 0.9);
    border: 2px solid rgba(201, 166, 70, 0.4);
}
.library-logo img { width: 100%; height: 100%; object-fit: cover; }
.library-logo i { display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }

/* ============ AUTH CARD ============ */
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 2rem 2rem;
    margin: 2rem 0;
}

/* ============ PROFILE CARD & TABS ============ */
.profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.profile-sidebar {
    background: var(--surface-2);
    border-inline-end: 1px solid var(--border);
    padding: 2.25rem 1.5rem;
}

.profile-content {
    padding: 2.25rem 2rem;
    background: var(--surface);
}

.profile-nav-pills .nav-link {
    border-radius: var(--radius);
    padding: 0.8rem 1.1rem;
    color: var(--ink-soft);
    font-weight: 600;
    background: transparent;
    border: 1px solid transparent;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-align: start;
    width: 100%;
}

.profile-nav-pills .nav-link:hover {
    background: var(--brand-softer);
    color: var(--brand-strong);
    border-color: var(--border);
}

.profile-nav-pills .nav-link.active {
    background: var(--brand);
    color: #fff8ed;
    box-shadow: var(--shadow-sm);
    border-color: var(--brand-strong);
}

:root[data-theme="dark"] .profile-nav-pills .nav-link.active {
    background: var(--brand);
    color: #fff8ed;
}

.profile-avatar-wrapper {
    position: relative;
    display: inline-block;
}

/* Clickable avatar — upload on click */
.avatar-upload-btn {
    position: relative;
    border: none;
    background: transparent;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    display: inline-block;
    overflow: visible;
    transition: filter var(--transition), transform var(--transition);
}
.avatar-upload-btn:hover { filter: brightness(0.94); transform: translateY(-1px); }
.avatar-upload-btn img,
.avatar-upload-btn > div { display: block; }
.avatar-upload-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(61, 51, 40, 0.45);
    color: #FFF8ED;
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity var(--transition);
}
.avatar-upload-btn:hover .avatar-upload-hint { opacity: 1; }
:root[data-theme="dark"] .avatar-upload-hint { background: rgba(0, 0, 0, 0.35); }

.profile-section-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--ink);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

/* ================================================================
   HERO — quiet paper gradient, no heavy imagery
   ================================================================ */
.hero {
    background:
      radial-gradient(900px 380px at 88% -25%, rgba(201, 166, 70, 0.12), transparent 55%),
      radial-gradient(700px 300px at 5% 110%, rgba(139, 101, 66, 0.07), transparent 60%),
      linear-gradient(170deg, var(--bg) 0%, var(--bg-secondary) 100%);
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    color: var(--ink);
}

:root[data-theme="dark"] .hero {
    background:
      radial-gradient(900px 380px at 88% -25%, rgba(201, 166, 70, 0.10), transparent 55%),
      radial-gradient(700px 300px at 5% 110%, rgba(42, 116, 106, 0.18), transparent 60%),
      linear-gradient(170deg, var(--bg) 0%, var(--bg-secondary) 100%);
}

/* --- Home-page masthead --- */
.hero-home { padding-block: 4.5rem 6rem; }
@media (min-width: 992px) { .hero-home { padding-block: 6rem 7.5rem; } }

.hero-eyebrow {
    display: inline-flex; align-items: center; gap: 0.55rem;
    padding: 0.42rem 1.05rem;
    border-radius: 999px;
    border: 1px solid rgba(201, 166, 70, 0.55);
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.82rem; font-weight: 700; letter-spacing: 0.02em;
    margin-bottom: 1.4rem;
}
.hero-eyebrow i { font-size: 0.9rem; }

.hero-wordmark {
    font-family: var(--font-display);
    font-size: clamp(3rem, 7vw, 4.6rem);
    line-height: 1.15;
    color: var(--ink);
    margin-bottom: 0.35rem;
}
.hero-wordmark .brand-mark { color: var(--accent); }

.hero-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.6rem, 3.4vw, 2.4rem);
    line-height: 1.4;
    color: var(--ink);
    margin-bottom: 1.1rem;
    letter-spacing: 0;
}

.hero-sub {
    font-size: 1.02rem;
    color: var(--ink-muted);
    max-width: 34rem;
    margin-bottom: 2rem;
    line-height: var(--lh-body);
    font-family: var(--font-body);
}

.hero-cta { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 2.25rem; }

.btn-hero-ghost {
    border: 1px solid var(--border-strong);
    color: var(--ink); font-weight: 700;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 0.55rem 1.4rem;
    transition: all var(--transition);
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-hero-ghost:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-softer); }

.hero-stats {
    display: flex; flex-wrap: wrap; gap: 0.4rem 2.2rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--border);
}
.hero-stat { font-size: 0.9rem; color: var(--ink-muted); }
.hero-stat-num {
    font-family: var(--font-display);
    color: var(--accent-strong);
    font-size: 1.5rem; font-weight: 400;
    margin-inline-end: 0.35rem;
}

@media (max-width: 575.98px) {
    .hero-home { padding-block: 3.5rem 4.5rem; }
    .hero-sub br { display: none; }
}

/* --- Spotlight card (hero-side feature book) --- */
.spotlight-card {
    display: block; color: inherit;
    background: var(--surface);
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: rotate(1.5deg);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.spotlight-card:hover { transform: rotate(0deg) translateY(-5px); box-shadow: var(--shadow-lg); }

.spotlight-cover {
    margin: 0;
    position: relative;
    aspect-ratio: 3 / 4;
    background: linear-gradient(150deg, var(--brand) 0%, var(--brand-strong) 100%);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.spotlight-cover img { width: 100%; height: 100%; object-fit: cover; }
.spotlight-cover-placeholder {
    font-family: var(--font-display);
    font-size: 5rem; font-weight: 400;
    color: rgba(255, 248, 237, 0.92);
}
.spotlight-cover-chip {
    position: absolute; inset: auto 1rem auto auto;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    background: var(--accent);
    color: #3D3328;
    font-size: 0.72rem; font-weight: 700;
    display: inline-flex; align-items: center; gap: 4px;
}
.spotlight-cover::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(61, 51, 40, 0.42));
    opacity: 0; transition: opacity var(--transition);
}
.spotlight-card:hover .spotlight-cover::before { opacity: 1; }

.spotlight-meta { padding: 1.15rem 1.3rem 1.3rem; }
.spotlight-title { font-size: 1.25rem; margin: 0 0 0.2rem; color: var(--ink); }
.spotlight-author { font-size: 0.88rem; color: var(--ink-muted); margin: 0 0 0.8rem; }
.hero-price { font-family: var(--font-display); font-size: 1.35rem; font-weight: 400; color: var(--brand); }
.spotlight-library { font-size: 0.8rem; color: var(--ink-muted); display: inline-flex; align-items: center; gap: 4px; }

@media (min-width: 992px) { .hero-float { animation: hero-float 6.5s ease-in-out 0.6s infinite; } }

/* Empty hero ornament */
.hero-orb-scene {
    display: flex; align-items: center; justify-content: center; gap: 0.75rem;
    aspect-ratio: 3 / 4; margin: 0;
    background: linear-gradient(150deg, var(--brand) 0%, var(--brand-strong) 100%);
    color: rgba(201, 166, 70, 0.9);
    font-size: 3rem;
}
.hero-orb-scene i { opacity: 0.85; }
.hero-orb-scene i:first-child { font-size: 4.5rem; transform: rotate(-8deg); }
.hero-orb-scene i:nth-child(2) { font-size: 1.6rem; transform: rotate(20deg); }
.hero-orb-scene i:nth-child(3) { font-size: 1.2rem; transform: rotate(-25deg); }

/* --- Category chips rail --- */
.rail {
    display: flex; gap: 0.7rem; flex-wrap: nowrap;
    overflow-x: auto; padding-bottom: 0.9rem;
    scrollbar-width: thin;
}
.category-chip {
    display: inline-flex; align-items: center; gap: 0.55rem;
    padding: 0.6rem 1.05rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 600; font-size: 0.88rem;
    white-space: nowrap; user-select: none;
    transition: all var(--transition);
}
.category-chip:hover {
    background: var(--brand); color: #FFF8ED; border-color: var(--brand);
    transform: translateY(-2px); box-shadow: var(--shadow-sm);
}
.category-chip-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.8rem; height: 1.8rem;
    border-radius: 999px;
    background: var(--brand-soft); color: var(--brand);
    font-size: 0.85rem;
}
.category-chip:hover .category-chip-icon { background: rgba(255, 248, 237, 0.2); color: #FFF8ED; }
.category-chip .count-pill {
    background: var(--accent-soft); color: var(--accent-strong);
    font-size: 0.72rem; font-weight: 700;
    padding: 0.15rem 0.55rem; border-radius: 999px;
}
.category-chip:hover .count-pill { background: rgba(255, 248, 237, 0.2); color: #FFF8ED; }

/* --- Testimonials --- */
.testimonial-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.6rem;
    height: 100%;
    display: flex; flex-direction: column; gap: 0.9rem;
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition), box-shadow var(--transition);
}
.testimonial-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.testimonial-quote-mark {
    font-family: var(--font-display);
    font-size: 2.2rem; line-height: 1;
    color: var(--accent);
}
.testimonial-text { font-size: 0.95rem; color: var(--ink-soft); margin: 0; flex: 1; }
.testimonial-person { display: flex; align-items: center; gap: 0.75rem; }
.testimonial-avatar {
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--brand-soft); color: var(--brand);
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-size: 1.1rem;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.testimonial-name { font-weight: 700; font-size: 0.9rem; color: var(--ink); margin: 0; }
.testimonial-role { font-size: 0.78rem; color: var(--ink-faint); margin: 0; }

/* --- CTA banner --- */
.cta-banner {
    background:
      radial-gradient(600px 240px at 92% 0%, rgba(201, 166, 70, 0.18), transparent 55%),
      linear-gradient(145deg, var(--brand) 0%, var(--brand-strong) 100%);
    border-radius: var(--radius-xl);
    padding: 2.8rem 2rem;
    color: #FFF8ED;
    position: relative; overflow: hidden;
}
.cta-banner h2 { color: #FFF8ED; margin-bottom: 0.4rem; }
.cta-banner p { color: rgba(255, 248, 237, 0.85); font-size: 0.98rem; }

/* --- Library cover fallback icon --- */
.library-cover.library-cover-fallback { background: var(--brand-softer); }
.library-cover-icon { font-size: 2.4rem; color: var(--brand); }

/* --- RTL arrow flip --- */
.flip-rtl { display: inline-block; transform: scaleX(-1); }

/* --- Gentle float --- */
@keyframes hero-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .hero-float { animation: none !important; } transition: none !important; }

/* ================================================================
   TABLES
   ================================================================ */
.table { margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 0.75rem 1rem; color: var(--ink); }
.table thead th {
    font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--ink-faint); font-weight: 700;
    border-bottom: 2px solid var(--border);
    background: var(--surface-2);
}
.table tbody tr { transition: background var(--transition); }
.table-hover tbody tr:hover { background: var(--brand-softer); }
.table-action-btn { padding: 0.25rem 0.6rem; font-size: 0.8rem; border-radius: var(--radius-sm); }

/* --- Sortable table headers: RTL-safe, accessible, themes via existing tokens --- */
.table .sortable {
    /* Remove button defaults; the <th> still carries .table thead th styling above. */
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    justify-content: space-between;
    text-align: start;
}
.table .sortable:hover { color: var(--brand); }
.table .sortable:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
.table .sortable .sort-icon {
    display: inline-block;
    opacity: 0.35;
    font-size: 0.85em;
    transition: transform var(--transition), opacity var(--transition);
    /* Logical: flip doesn't depend on direction */
    flex-shrink: 0;
}
.table .sortable[aria-sort="ascending"] .sort-icon,
.table .sortable[aria-sort="descending"] .sort-icon {
    opacity: 1;
    color: var(--brand);
}
.table .sortable[aria-sort="descending"] .sort-icon { transform: rotate(180deg); }

/* Sticky header when the table is inside .table-responsive-sticky (opt-in). */
.table-responsive-sticky { max-height: 70vh; overflow: auto; }
.table-responsive-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    /* Solid background so content doesn't bleed through under the sticky bar */
    background: var(--surface-2);
    box-shadow: 0 1px 0 var(--border);
}

/* Zebra density (opt-in via .table-striped-subtle): softer than Bootstrap's table-striped. */
.table-striped-subtle tbody tr:nth-of-type(odd) { background: var(--surface-2); }
.table-striped-subtle tbody tr:hover { background: var(--brand-softer); }

/* Numeric/money columns */
.table .text-num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

/* ================================================================
   BUTTONS — 44px target height, 14px radius, 250ms transitions
   ================================================================ */
.btn {
    font-family: var(--font-body);
    font-weight: 700;
    border-radius: var(--radius);
    transition: transform var(--transition), box-shadow var(--transition), background-color var(--transition), border-color var(--transition), color var(--transition);
}
.btn:not(.btn-sm):not(.btn-lg):not(.btn-icon) { min-height: var(--btn-height); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

/* Theme-aware disabled state — every variant (primary, accent, outline,
   success, danger, …) falls back to a muted paper/ink look */
.btn:disabled, .btn.disabled, fieldset:disabled .btn {
    --bs-btn-disabled-color: var(--btn-disabled-text);
    --bs-btn-disabled-bg: var(--btn-disabled-bg);
    --bs-btn-disabled-border-color: var(--btn-disabled-border);
    --bs-btn-disabled-opacity: 1;
    color: var(--btn-disabled-text);
    background-color: var(--btn-disabled-bg);
    border-color: var(--btn-disabled-border);
    pointer-events: none;
    box-shadow: none;
    transform: none;
}
.btn:disabled:hover, .btn.disabled:hover,
.btn:disabled:focus, .btn.disabled:focus,
.btn:disabled:focus-visible, .btn.disabled:focus-visible {
    transform: none;
    box-shadow: none;
}
.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-color: #FFF8ED;
    --bs-btn-hover-bg: var(--brand-hover);
    --bs-btn-hover-border-color: var(--brand-hover);
    --bs-btn-hover-color: #FFF8ED;
    --bs-btn-active-bg: var(--brand-strong);
    --bs-btn-active-border-color: var(--brand-strong);
}
.btn-primary:hover { /*transform: translateY(-1px);*/ box-shadow: var(--shadow-sm); }

.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-hover-color: #FFF8ED;
    --bs-btn-active-bg: var(--brand-hover);
    --bs-btn-active-border-color: var(--brand-hover);
}
.btn-outline-primary:hover { transform: translateY(-1px); }

.btn i { margin-inline-end: 2px; }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); }

/* Gold CTA — reserved for the single most important action */
.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: #3D3328;
    font-weight: 800;
}
.btn-accent:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #2E2412; transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* ================================================================
   FORMS
   ================================================================ */
.form-control, .form-select {
    background-color: var(--surface);
    border-color: var(--border);
    color: var(--ink);
    border-radius: var(--radius-sm);
    min-height: var(--btn-height);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control::placeholder { color: var(--ink-faint); }
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 0.22rem rgba(139, 101, 66, 0.15);
    background-color: var(--surface);
    color: var(--ink);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-label { font-weight: 700; font-size: 0.88rem; margin-bottom: 0.4rem; color: var(--ink-soft); }
.form-text { font-size: 0.8rem; color: var(--ink-muted); }

/* Password visibility toggle in input groups */
.input-group .toggle-password {
    border-color: var(--border);
    color: var(--ink-muted);
    background-color: var(--surface);
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.85rem;
    transition: color var(--transition), border-color var(--transition), background-color var(--transition);
}
.input-group .toggle-password:hover {
    color: var(--brand);
    border-color: var(--border-strong);
    background-color: var(--surface-2);
}
.input-group .toggle-password:focus {
    border-color: var(--brand);
    color: var(--brand);
    box-shadow: none;
    z-index: 4;
}
.input-group:focus-within .toggle-password {
    border-color: var(--brand);
}

/* ============ BADGES ============ */
.badge { font-weight: 700; padding: 0.42em 0.72em; border-radius: 999px; font-size: 0.74rem; font-family: var(--font-body); }
.badge.bg-success { background-color: var(--success) !important; }
.badge.bg-accent { background-color: var(--accent) !important; color: #3D3328 !important; }

/* ============ EMPTY STATE ============ */
.empty-state { text-align: center; padding: 3.2rem 1.5rem; }
.empty-state i { font-size: 3.2rem; color: var(--border-strong); margin-bottom: 1rem; display: block; }
.empty-state h5 { color: var(--ink-muted); font-family: var(--font-display); font-weight: 400; margin-bottom: 0.5rem; }
.empty-state p { color: var(--ink-faint); font-size: 0.9rem; margin-bottom: 1.5rem; }

/* ============ ORDER TIMELINE ============ */
.order-timeline .step-dot {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--surface-3); color: var(--ink-faint);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; margin: 0 auto; position: relative; z-index: 2;
}
.order-timeline .step-dot.done { background: var(--brand); color: #FFF8ED; }
.order-timeline .d-flex.justify-content-between::before {
    content: ""; position: absolute; top: 19px; right: 10%; left: 10%;
    height: 3px; background: var(--surface-3); z-index: 1;
}

/* ============ FOOTER ============ */
.footer-bg, .site-footer { background: var(--brand-strong); }
.site-footer { color: rgba(255, 248, 237, 0.75); }
:root[data-theme="dark"] .footer-bg, :root[data-theme="dark"] .site-footer { background: var(--bg-secondary); border-top: 1px solid var(--border); }
.site-footer .brand-mark { color: var(--accent); }
.site-footer a { color: rgba(255, 248, 237, 0.75); }
.site-footer a:hover { color: var(--accent); }
.text-light-emphasis { color: rgba(255, 248, 237, 0.68) !important; }
.site-footer h6 { color: #FFF8ED; font-family: var(--font-body); font-weight: 700; font-size: 0.9rem; }
.site-footer .footer-wordmark { font-family: var(--font-display); color: #FFF8ED; font-size: 1.5rem; }

/* ============ VALIDATION ============ */
.validation-summary-errors {
    background: var(--danger-soft);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}
.field-validation-error { color: var(--danger); font-size: 0.8rem; }

/* ============ UTILITY ============ */
.text-brand { color: var(--brand) !important; }
.bg-brand-soft { background-color: var(--brand-soft) !important; }
.text-muted-soft { color: var(--ink-muted) !important; }
.main-container { flex: 1 0 auto; width: 100%; }


@media (min-width: 576px) {
    .container-sm, .container {
        max-width: 768px;
    }
}

@media (min-width: 768px) {
    .container-md, .container-sm, .container {
        max-width: 992px;
    }
}

@media (min-width: 992px) {
    .container-lg, .container-md, .container-sm, .container {
        max-width: 1200px;
    }
}

@media (min-width: 1200px) {
    .container-xl, .container-lg, .container-md, .container-sm, .container {
        max-width: 1400px;
    }
}
/*:root {
    --bs-breakpoint-xs: 0;
    --bs-breakpoint-sm: 576px;
    --bs-breakpoint-md: 768px;
    --bs-breakpoint-lg: 992px;
    --bs-breakpoint-xl: 1200px;
    --bs-breakpoint-xxl: 1400px;
}*/
/* ============ WIDE SCREENS (laptop-4k) ============ */
@media (min-width: 1400px) { .container { max-width: 1400px !important; } }
@media (min-width: 1700px) { .container { max-width: 1560px !important; } }
@media (min-width: 2100px) { .container { max-width: 1800px !important; } }
@media (min-width: 2560px) { .container { max-width: 2000px !important; } }

/* ============ AUTH — dead-simple centered card, no page scroll ============ */
/* In _Layout.cshtml the DOM is:
     body > div.main-container (flex-grow-1 from Bootstrap, fills between header/footer)
           > main > .auth-center > .row > .col-* > .auth-card
   We make .main-container a flex column (so flex:1 propagates), then main
   stretches to fill it, then .auth-center centers its content. */

/* Make the counter element a flex column */
.main-container {
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
}

/* main stretches to fill .main-container (which fills between navbar/footer) */
.main-container > main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
}

/* .auth-center fills main and centers its card content */
.auth-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-block: 1.5rem;
}

.auth-center .row { width: 100%; margin-inline: 0; }
.auth-center .auth-card { margin-block: 0; }

/* ============ CART ============ */
.cart-book-thumb {
    width: 64px; height: 88px;
    border-radius: var(--radius-sm);
    background: linear-gradient(160deg, var(--brand) 0%, var(--brand-strong) 100%);
    color: rgba(255, 248, 237, 0.92);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-size: 1.7rem;
    overflow: hidden;
    flex-shrink: 0;
}
.cart-book-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ============ RESPONSIVE — Panel ============ */
@media (max-width: 991.98px) {
    .panel-sidebar { transform: translateX(calc(100% + 10px)); box-shadow: none; }
    .panel-sidebar.show { transform: translateX(0); }
    .panel-content { margin-right: 0; padding: 1.1rem; }
    .panel-toggle-btn { display: block; }
}

/* ============ THEME TOGGLE & NAVBAR ACTION BUTTONS ============ */
.theme-toggle,
.navbar-action-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 40px; height: 40px; padding: 0 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    line-height: 1;
    font-size: 0.9rem;
    font-weight: 600;
}
.theme-toggle { width: 40px; padding: 0; }
.theme-toggle:hover,
.navbar-action-btn:hover,
.navbar-action-btn:focus { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.theme-toggle i,
.navbar-action-btn i { font-size: 1.1rem; }
.theme-toggle .theme-icon-dark { display: none; }
.theme-toggle .theme-icon-light { display: inline; }
:root[data-theme="dark"] .theme-toggle .theme-icon-dark { display: inline; }
:root[data-theme="dark"] .theme-toggle .theme-icon-light { display: none; }

/* Notification Dropdown */
.notification-dropdown {
    min-width: 280px;
    max-width: min(340px, calc(100vw - 20px));
}

/* ============ RESPONSIVE — Mobile Navbar & Small Screens ============ */
@media (max-width: 575.98px) {
    body { padding-top: 60px; }
    body.panel-body { padding-top: 0; }
    .site-navbar {
        --bs-navbar-padding-y: 0.35rem;
    }
    .site-navbar .container {
        padding-inline: 0.5rem;
    }
    .brand-orb {
        width: 34px;
        height: 34px;
        border-radius: 9px;
        font-size: 1rem;
    }
    .site-navbar .navbar-brand {
        gap: 6px !important;
        margin-inline-end: 4px;
    }
    .site-navbar .navbar-brand .brand-logo {
        font-size: 1.35rem;
    }
    .theme-toggle,
    .navbar-action-btn,
    .site-navbar .navbar-toggler {
        min-height: 36px;
        height: 36px;
        width: 36px;
        min-width: 36px;
        padding: 0;
        border-radius: var(--radius-sm);
    }
    .theme-toggle i,
    .navbar-action-btn i {
        font-size: 1rem;
    }
    .site-navbar .navbar-toggler i {
        font-size: 1.25rem;
    }
    .navbar-action-btn .badge,
    .theme-toggle .badge {
        font-size: 0.65rem;
        padding: 0.2em 0.4em;
    }
    .site-navbar .navbar-actions {
        gap: 4px !important;
    }
    .auth-card {
        padding: 1.5rem 1.15rem;
        margin: 0.75rem 0;
        border-radius: var(--radius-lg);
    }
    .auth-center {
        padding-block: 0.75rem 1.5rem;
    }
}

/* Extra small mobile screens (e.g. Mobile S 320px) */
@media (max-width: 359.98px) {
    body { padding-top: 56px; }
    body.panel-body { padding-top: 0; }
    .site-navbar {
        --bs-navbar-padding-y: 0.25rem;
    }
    .site-navbar .container {
        padding-inline: 0.35rem;
    }
    .brand-orb {
        width: 30px;
        height: 30px;
        border-radius: 7px;
    }
    .site-navbar .navbar-brand .brand-logo {
        font-size: 1.2rem;
    }
    .theme-toggle,
    .navbar-action-btn,
    .site-navbar .navbar-toggler {
        min-height: 32px;
        height: 32px;
        width: 32px;
        min-width: 32px;
    }
    .theme-toggle i,
    .navbar-action-btn i {
        font-size: 0.9rem;
    }
    .site-navbar .navbar-toggler i {
        font-size: 1.1rem;
    }
    .site-navbar .navbar-actions {
        gap: 3px !important;
    }
    .auth-card {
        padding: 1.25rem 0.85rem;
    }
}

/* ================================================================
   MARKETPLACE HOME PAGE STYLES
   ================================================================ */

/* Hero Search & Filter Box */
.hero-search-box {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.hero-search-box:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(139, 101, 66, 0.15) !important;
}
.border-end-md {
    border-right: 1px solid var(--border);
}
@media (max-width: 767.98px) {
    .border-end-md { border-right: none; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
}

/* Badge Tags & Chips */
.badge-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-soft);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    transition: all var(--transition);
}
.badge-tag:hover {
    background: var(--brand-soft);
    color: var(--brand-strong);
    border-color: var(--brand);
    transform: translateY(-1px);
}

/* Book Card Badges */
.book-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    box-shadow: var(--shadow-sm);
}
.badge-brand { background: var(--brand); color: #FFF; }
.badge-accent { background: var(--accent); color: var(--ink); }
.badge-danger { background: var(--danger); color: #FFF; }
.badge-warning { background: var(--warning); color: var(--ink); }
.badge-success { background: var(--success); color: #FFF; }
.bg-brand-soft { background-color: var(--brand-soft) !important; }
.bg-accent-soft { background-color: var(--accent-soft) !important; }
.bg-danger-soft { background-color: var(--danger-soft) !important; }
.bg-warning-soft { background-color: var(--warning-soft) !important; }
.bg-success-soft { background-color: var(--success-soft) !important; }
.bg-info-soft { background-color: var(--info-soft) !important; }
.text-brand-strong { color: var(--brand-strong) !important; }
.text-accent-strong { color: var(--accent-strong) !important; }

/* Book Card Enhancements */
.book-category-tag a {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--brand);
    display: inline-block;
    margin-bottom: 2px;
}
.book-category-tag a:hover { text-decoration: underline !important; }
.btn-add-cart {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.35rem 0.65rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Trust Strip */
.trust-strip { background: var(--surface); }
.trust-item { padding: 0.5rem 0; }
.trust-icon-box {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.trust-title { font-size: 0.95rem; color: var(--ink); }

/* Author Cards */
.author-card-link { display: block; }
.author-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: transform var(--transition), box-shadow var(--transition);
}
.author-card-link:hover .author-card {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--brand);
}
.author-avatar-wrapper {
    width: 72px;
    height: 72px;
}
.author-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 2px solid var(--border);
}
.author-avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--brand-soft) 0%, var(--border-strong) 100%);
    color: var(--brand-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
}

/* City Badge Chips */
.city-badge-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 600;
    transition: all var(--transition);
}
.city-badge-chip .city-count {
    margin-right: 0.5rem;
    font-size: 0.75rem;
    color: var(--ink-muted);
    background: var(--brand-soft);
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
}
.city-badge-chip:hover {
    background: var(--brand-soft);
    border-color: var(--brand);
    color: var(--brand-strong);
    transform: translateY(-2px);
}

/* How It Works Steps */
.how-step-card {
    transition: transform var(--transition), box-shadow var(--transition);
}
.how-step-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}
.how-step-number {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--brand);
    color: #FFF;
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Literary Quote Box */
.quote-card {
    background: linear-gradient(135deg, var(--brand-soft) 0%, var(--surface-3) 100%);
    border: 1px solid var(--border);
    overflow: hidden;
}
.quote-icon-bg {
    position: absolute;
    top: -15px;
    left: 20px;
    font-size: 6rem;
    color: rgba(139, 101, 66, 0.08);
    pointer-events: none;
}
.quote-text {
    font-family: var(--font-display);
    font-size: 1.35rem;
    line-height: 1.7;
    color: var(--ink);
}

/* FAQ Accordion */
.custom-faq-accordion .accordion-item {
    border-color: var(--border) !important;
    background: var(--surface);
}
.custom-faq-accordion .accordion-button {
    background: var(--surface);
    color: var(--ink);
    font-size: 1rem;
    padding: 1.1rem 1.25rem;
}
.custom-faq-accordion .accordion-button:not(.collapsed) {
    background: var(--brand-soft);
    color: var(--brand-strong);
    box-shadow: none;
}
.custom-faq-accordion .accordion-button:focus {
    box-shadow: none;
}
.custom-faq-accordion .accordion-body {
    background: var(--surface);
    line-height: 1.8;
}

/* Newsletter Card */
.newsletter-card {
    background: var(--surface);
    border: 1px solid var(--border);
}

.start-90 {
    right: 90% !important;
}

