/* ==========================================================================
   دار السحاب — نظام التصميم v5 (تحريري مؤسسي) (المصدر الوحيد للألوان والخطوط والمسافات)
   الخطوط محمّلة محلياً من assets/fonts/fonts.css
   ========================================================================== */
:root {
    /* ==== الهوية v5: تحريرية مؤسسية — ألوان دور النشر العالمية ==== */
    --ink: #142536;            /* حبر أزرق ليلي — اللون المؤسسي */
    --ink-2: #1C3247;
    --ink-3: #29445C;
    --terracotta: #88633F;     /* لون الدار المميّز (طين محروق) */
    --terracotta-2: #A98457;
    --sage: #5F7A61;           /* أخضر مريمية */
    --river: #3E6A8A;          /* أزرق نهري */
    --ochre: #C08A2E;          /* مغرة */
    --plum: #6D3B57;           /* برقوقي */
    --slate: #4B5563;

    /* أسماء التوافق مع المكوّنات */
    --gold: var(--terracotta);
    --gold-2: var(--terracotta-2);
    --gold-3: #EAE0D0;
    --cloud: #9AA9BC;
    --paper: #F8F9FB;          /* ورق دافئ */
    --indigo: var(--ink); --violet: var(--plum); --pink: var(--terracotta); --coral: var(--terracotta);
    --sun: var(--ochre); --sky: var(--river); --mint: var(--sage); --lime: var(--sage);

    /* "تدرّجات" صارت ألواناً مصمتة متناسقة */
    --grad-primary: linear-gradient(0deg, var(--ink), var(--ink));
    --grad-sky: linear-gradient(0deg, var(--river), var(--river));
    --grad-sun: linear-gradient(0deg, var(--terracotta), var(--terracotta));
    --grad-mint: linear-gradient(0deg, var(--sage), var(--sage));
    --grad-candy: linear-gradient(0deg, var(--plum), var(--plum));
    --grad-lime: linear-gradient(0deg, var(--ochre), var(--ochre));
    --grad-dawn: linear-gradient(180deg, #F8F9FB, #F8F9FB);
    --gold-foil: linear-gradient(115deg, #8E3E1C 0%, #A98457 40%, #E9A47E 55%, #88633F 100%);

    --brand: var(--ink);
    --brand-light: var(--ink-2);
    --accent: var(--terracotta);
    --accent-hover: #705132;
    --accent-light: rgba(136, 99, 63, .10);
    --success: #3D7A55;
    --danger: #B23A30;
    --warning: #B7802B;

    /* الوضع الفاتح */
    --bg-color: var(--paper);
    --surface: #FFFFFF;
    --surface-2: #EEF1F4;
    --surface-glass: rgba(255, 255, 255, .95);
    --text: #1D2E3D;
    --text-light: #596B7A;
    --text-faint: #667787;
    --border: #E1E6EB;
    --border-strong: #C6CFD7;

    /* الخطوط */
    --font-display: 'Tajawal', system-ui, sans-serif;
    --font-literary: 'Amiri', 'Tajawal', Georgia, serif;
    --font-body: 'Tajawal', system-ui, sans-serif;
    --fs-xs: .78rem;
    --fs-sm: .9rem;
    --fs-md: 1rem;
    --fs-lg: 1.15rem;
    --fs-xl: clamp(1.35rem, 1.1rem + 1vw, 1.8rem);
    --fs-2xl: clamp(1.9rem, 1.3rem + 2.2vw, 2.9rem);
    --fs-3xl: clamp(2.6rem, 1.4rem + 4.6vw, 5.2rem);

    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
    --sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 96px;

    /* زوايا مؤسسية هادئة */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(20, 33, 61, .06);
    --shadow: 0 6px 20px rgba(20, 33, 61, .07);
    --shadow-lg: 0 18px 48px rgba(20, 33, 61, .12);
    --shadow-hover: var(--shadow-lg);
    --shadow-glow: var(--shadow-lg);
    --shadow-book: 0 1px 1px rgba(0,0,0,.08), 0 10px 18px -6px rgba(20,33,61,.32), 0 28px 50px -18px rgba(20,33,61,.42);

    --ease: cubic-bezier(.22, .8, .24, 1);
    --ease-bounce: cubic-bezier(.22, .8, .24, 1);
    --dur-1: .18s;
    --dur-2: .32s;
    --dur-3: .6s;
    --transition: color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease);
    --grain: none;
}

[data-theme="dark"] {
    --bg-color: #101B26;
    --surface: #162432;
    --surface-2: #203343;
    --surface-glass: rgba(16, 27, 38, .95);
    --text: #F1F3F5;
    --text-light: #B4C2CD;
    --text-faint: #99ACBB;
    --border: #2D4050;
    --border-strong: #445B6D;
    --terracotta: #CDB28B;
    --terracotta-2: #E1C9A7;
    --gold: var(--terracotta);
    --gold-2: var(--terracotta-2);
    --gold-3: #3B352B;
    --accent: var(--terracotta);
    --accent-hover: #E1C9A7;
    --accent-light: rgba(205, 178, 139, .12);
    --grad-dawn: linear-gradient(180deg, #101B26, #101B26);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 8px 22px rgba(0, 0, 0, .35);
    --shadow-lg: 0 22px 50px rgba(0, 0, 0, .5);
    --shadow-book: 0 1px 1px rgba(0,0,0,.3), 0 12px 22px -6px rgba(0,0,0,.6), 0 30px 60px -18px rgba(0,0,0,.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; }

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text);
    text-align: start;
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* Container */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Top Bar */
.top-bar {
    background: var(--brand);
    color: #fff;
    font-size: 13px;
    padding: 8px 0;
}
.top-bar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.top-bar-left, .top-bar-right {
    display: flex;
    gap: 16px;
    align-items: center;
}
.top-contact i {
    color: var(--accent);
    margin-inline-end: 4px;
}
.top-bar a {
    color: #fff;
    opacity: 0.8;
}
.top-bar a:hover {
    opacity: 1;
    color: var(--accent);
}
.top-bar a i {
    margin-inline-end: 4px;
}

/* Header */
.header {
    background: var(--surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.header.scrolled {
    box-shadow: var(--shadow);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo {
    font-size: 28px;
    font-weight: 900;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    color: var(--accent);
}

.logo span {
    color: var(--accent);
}

/* Search Dropdown Overlay */
.search-dropdown-overlay {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 20px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 999;
    border-top: 1px solid var(--border);
}

.search-dropdown-overlay.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-box-large {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.search-box-large input {
    width: 100%;
    padding: 15px 50px;
    border-radius: 50px;
    border: 2px solid var(--border);
    background: var(--bg-color);
    color: var(--text);
    font-size: 1.1rem;
    outline: none;
    transition: var(--transition);
}

.search-box-large input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-light);
}

.search-box-large .fa-search {
    position: absolute;
    right: 20px;
    font-size: 1.2rem;
    color: var(--text-light);
}

.search-box-large .close-btn {
    position: absolute;
    left: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease;
}

.search-box-large .close-btn:hover {
    color: var(--accent);
}

.search-dropdown-overlay .search-results {
    max-width: 800px;
    margin: 15px auto 0;
    max-height: 400px;
    overflow-y: auto;
}

.nav-links {
    display: flex;
    gap: 20px; /* Reduced gap to prevent wrapping */
    align-items: center;
    flex-wrap: nowrap; /* Force single line */
}

.nav-links a {
    font-weight: 600;
    color: var(--text-light);
    font-size: 16px;
    position: relative;
    padding: 8px 0;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--accent);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent);
    transition: var(--transition);
    border-radius: 2px;
}

.nav-links a:hover::after, .nav-links a.active::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.nav-icon-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--text);
    min-width: 42px;
}

.lang-switch-btn {
    padding: 6px 10px;
    font-size: 14px;
}

.nav-text-btn {
    padding: 6px 15px;
    font-size: 14px;
}

.user-menu {
    position: relative;
    display: inline-block;
}

.mobile-menu-btn {
    display: none;
}

.nav-actions .btn-outline {
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
}
.nav-actions .btn-outline:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.cart-icon {
    position: relative;
    font-size: 22px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-color);
    transition: var(--transition);
}

.cart-icon:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.cart-count {
    position: absolute;
    top: 0;
    right: 0;
    background-color: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    width: 18px;
    height: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    border: 2px solid var(--surface-glass);
}


.trust-strip {
    margin-top: -44px;
    position: relative;
    z-index: 6;
}

.trust-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.trust-item {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.trust-item i {
    color: var(--accent);
    font-size: 22px;
    margin-top: 3px;
}

.trust-item h3 {
    font-size: 18px;
    margin-bottom: 2px;
}

.trust-item p {
    color: var(--text-light);
    font-size: 14px;
}

.section-space {
    padding: 80px 0;
}

.section-surface {
    background: var(--surface);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 40px;
    gap: 20px;
}

.section-title-inline {
    margin-bottom: 0;
    text-align: right;
}

.section-title-inline::after {
    margin-right: 0;
}

.btn-sm {
    padding: 8px 15px;
    font-size: 14px;
}

.center-cta {
    text-align: center;
    margin-top: 50px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    text-align: center;
}

.category-item {
    padding: 30px 20px;
    background: var(--bg-color);
    border-radius: var(--radius);
    transition: var(--transition);
    border: 1px solid transparent;
}

.category-item i {
    font-size: 30px;
    color: var(--accent);
    margin-bottom: 15px;
}

.category-item h3 {
    font-size: 16px;
    color: var(--text);
}

.category-item:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
    box-shadow: var(--shadow-hover);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 32px;
    background-color: var(--accent);
    color: #000;
    font-weight: 800;
    border-radius: 30px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
}

.btn-outline:hover {
    background: var(--accent);
    color: var(--brand);
}

/* Book Grid */
.section-title {
    font-size: 36px;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 50px;
    text-align: center;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background-color: var(--accent);
    margin: 20px auto 0;
    border-radius: 2px;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 32px;
}

/* Book Card */
.book-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--border);
}

.book-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.book-card-hot {
    border: 2px solid var(--accent);
}


.book-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--accent);
    color: #000;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 800;
    border-radius: 20px;
    z-index: 2;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.book-badge-hot {
    background: var(--accent);
    color: #000;
}

.book-info {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.book-category {
    font-size: 12px;
    color: var(--accent);
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.book-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.5;
}

.book-title::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

.book-author {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 20px;
    font-weight: 500;
}

.book-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 16px;
    position: relative;
    z-index: 2; /* keep above the card overlay */
}

.book-price {
    font-size: 22px;
    font-weight: 900;
    color: var(--text);
}

.add-to-cart-btn {
    background: var(--bg-color);
    color: var(--text);
    border: 1px solid var(--border);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 16px;
}

.book-card:hover .add-to-cart-btn {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    transform: rotate(-10deg) scale(1.1);
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    z-index: 1000;
    display: none;
    max-height: 400px;
    overflow-y: auto;
}
.search-dropdown-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
}
.search-dropdown-item:last-child {
    border-bottom: none;
}
.search-dropdown-item:hover {
    background: var(--bg-color);
}
.search-dropdown-item img {
    width: 45px;
    height: 65px;
    object-fit: cover;
    border-radius: 6px;
    margin-left: 16px;
}
.search-info {
    flex: 1;
}
.search-title {
    font-weight: 800;
    font-size: 15px;
    color: var(--text);
    margin-bottom: 4px;
}
.search-author {
    font-size: 13px;
    color: var(--text-light);
}
.search-price {
    font-weight: 900;
    color: var(--accent);
    font-size: 15px;
}

/* Books Listing Page */
.books-banner-title {
    font-size: 3.5rem;
    margin-bottom: 20px;
    font-weight: 900;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.books-banner-search-form {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

.books-banner-search-input {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 30px;
    font-family: inherit;
    font-size: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.books-banner-search-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.35);
}

.books-banner-search-btn {
    padding: 12px 25px;
    border-radius: 30px;
}

.books-toolbar-wrap {
    background: var(--surface);
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.books-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.books-categories-chips {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: thin;
    flex-grow: 1;
}

.books-chip {
    border-radius: 30px;
    white-space: nowrap;
}

.books-chip-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

.books-sort-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.books-sort-label {
    color: var(--text-light);
    font-size: 14px;
    white-space: nowrap;
}

.books-sort-select {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-family: inherit;
    background: var(--bg-color);
    color: var(--text);
    outline: none;
}

.books-listing-section {
    padding: 60px 0;
}

.book-card-listing {
    position: relative;
}

.book-badge-danger {
    background: #e74c3c;
    color: #fff;
}

.wishlist-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: 0.3s;
    color: #cbd5e1;
}

.wishlist-btn:hover {
    transform: translateY(-2px);
}

.wishlist-btn.is-active {
    color: #e74c3c;
}

.book-image-container {
    display: block;
}

.book-cover-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.book-cover-fallback i {
    font-size: 48px;
    color: var(--accent);
    margin-bottom: 15px;
    opacity: 0.8;
}

.book-cover-fallback span {
    color: #ffffff;
    font-weight: 800;
    font-size: 16px;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.price-on-request {
    font-size: 14px;
    color: var(--text-light);
}

.pagination-wrap {
    display: flex;
    justify-content: center;
    margin-top: 50px;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination-btn {
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-weight: 700;
}

.books-empty-state {
    text-align: center;
    padding: 100px 0;
}

.books-empty-state i {
    font-size: 60px;
    color: var(--border);
    margin-bottom: 20px;
}

.books-empty-state h3 {
    color: var(--text-light);
}

.books-empty-btn {
    margin-top: 20px;
}

/* Footer */
.footer {
    background:
        radial-gradient(circle at 15% 15%, rgba(212,175,55,.07), transparent 28%),
        linear-gradient(145deg, #101c34 0%, var(--brand) 58%, #0b1528 100%);
    color: #94a3b8;
    padding: 80px 0 40px;
    margin-top: 100px;
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at top right, rgba(212,175,55,0.05), transparent 50%);
    pointer-events: none;
}

.footer-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1.35fr) repeat(3, minmax(180px, 1fr));
    gap: clamp(32px, 4vw, 64px);
    margin-bottom: 60px;
    position: relative;
    z-index: 2;
}

.footer-logo {
    color: #ffffff;
    font-size: 28px;
    font-weight: 900;
    margin-bottom: 24px;
    display: block;
}

.footer-logo-image {
    display: block;
    width: auto;
    max-width: 170px;
    max-height: 76px;
    margin-bottom: 16px;
    object-fit: contain;
}

.footer-brand-column { max-width: 390px; }
.footer-note { max-width: 360px; line-height: 1.9; }

.footer-logo span {
    color: var(--accent);
}

.footer-note,
.footer-contact-list {
    color: #94a3b8;
    font-size: 14px;
}

.footer-links h4 {
    color: #ffffff;
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 24px;
    position: relative;
    display: inline-block;
}

.footer-links h4::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 0;
    width: 40px;
    height: 2px;
    background: var(--accent);
}

.footer-links ul li {
    margin-bottom: 16px;
}

.footer-links ul li a {
    color: #94a3b8;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    line-height: 1.65;
}

.footer-link-row i,
.footer-contact-list i {
    display: grid;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    place-items: center;
    color: #b8c4d8;
    border-radius: 6px;
    background: rgba(255,255,255,.055);
    font-size: 11px;
}

.footer-contact-list li {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.7;
}

.footer-contact-list li > span,
.footer-contact-list li > a { min-width: 0; overflow-wrap: anywhere; }

.footer-links ul li a:hover {
    color: var(--accent);
    transform: translateX(-5px);
}

.footer-links ul li a:hover i {
    color: var(--brand);
    background: var(--accent);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 14px;
    position: relative;
    z-index: 2;
}

@media (max-width: 1050px) {
    .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    .footer { padding-top: 58px; }
    .footer-grid { grid-template-columns: 1fr; gap: 34px; margin-bottom: 42px; }
    .footer-brand-column { max-width: none; }
    .footer-links h4 { margin-bottom: 19px; }
}

.mobile-bottom-nav {
    display: none;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   Forms & Inputs
   ========================================= */
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    transition: var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
}

/* =========================================
   Tables (Cart & Admin)
   ========================================= */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.table th, .table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    text-align: right;
}
.table th {
    background: rgba(0,0,0,0.02);
    font-weight: 800;
    color: var(--text);
}
[data-theme="dark"] .table th {
    background: rgba(255,255,255,0.02);
}
.table tr:last-child td {
    border-bottom: none;
}
@media (max-width: 768px) {
    .hero {
        padding: 80px 0;
    }

    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-graphics {
        display: none;
    }

    .hero-content-home {
        text-align: center;
        margin: 0 auto;
    }

    .hero-content-home p {
        margin-right: auto;
    }

    .hero-actions,
    .hero-highlights {
        justify-content: center;
    }

    .hero h1 {
        font-size: 40px;
    }

    .section-head {
        flex-direction: column;
        align-items: stretch;
    }

    .section-title-inline {
        text-align: center;
    }

    .section-title-inline::after {
        margin: 20px auto 0;
    }

    .trust-strip {
        margin-top: 20px;
    }

    .trust-grid {
        grid-template-columns: 1fr;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        background: var(--surface);
        padding: 20px;
        box-shadow: var(--shadow);
        gap: 15px;
    }
    .nav-links.show {
        display: flex;
    }
    .mobile-menu-btn {
        display: block !important;
    }

    .books-banner-title {
        font-size: 2.2rem;
    }

    .books-banner-search-form {
        flex-direction: column;
    }

    .books-banner-search-btn {
        width: 100%;
    }

    .books-toolbar {
        align-items: stretch;
    }

    .books-sort-form {
        width: 100%;
        justify-content: space-between;
    }

    .books-sort-select {
        flex: 1;
        max-width: 260px;
    }

    .footer {
        padding-bottom: 110px;
    }

    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--surface-glass);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        z-index: 10050;
    }

    .mobile-nav-item {
        padding: 10px 4px;
        color: var(--text-light);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        font-size: 11px;
        font-weight: 700;
    }

    .mobile-nav-item i {
        font-size: 17px;
    }

    .mobile-nav-item.active {
        color: var(--accent);
    }

    #toast-container {
        left: 16px;
        right: 16px;
        bottom: 88px;
    }
}

/* =========================================
   Interactive Elements (Side Cart, Toasts, Animations)
   ========================================= */

/* Toasts */
.toast {
    background: var(--surface);
    color: var(--text);
    padding: 15px 25px;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 700;
    transform: translateX(-120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-left: 4px solid #10b981;
}
.toast.show {
    transform: translateX(0);
    opacity: 1;
}
.toast-icon {
    font-size: 24px;
    color: #10b981;
}

#toast-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Side Cart */
.side-cart-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.side-cart-overlay.open {
    opacity: 1;
    visibility: visible;
}
.side-cart {
    position: fixed;
    top: 0; left: -400px; /* RTL - Slide from left */
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--surface);
    z-index: 10001;
    box-shadow: 10px 0 30px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.side-cart.open {
    left: 0;
}
.side-cart-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.side-cart-header h3 {
    margin: 0;
    color: var(--text);
}
.close-cart {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.3s;
}
.close-cart:hover {
    color: #ef4444;
}
.side-cart-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px;
}

.side-cart-loading {
    text-align: center;
    padding: 40px 0;
    color: var(--text-light);
}

.side-cart-loading i {
    font-size: 24px;
}

.side-cart-link-btn {
    width: 100%;
}
.side-cart-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border);
    background: var(--bg-color);
}



html, body { max-width: 100%; }
body { background-image: radial-gradient(circle at 15% 5%, rgba(197,154,54,.055), transparent 24rem); }
.container, .hero-grid, .hero-slider-wrapper, .hero-slider, .hero-slide { min-width: 0; }

.top-bar { padding: 7px 0; }
.top-bar-container { gap: 24px; }
.top-bar-left, .top-bar-right { gap: 18px; }

.nav-container { height: 86px; gap: 24px; }
.logo { flex: 0 0 auto; gap: 11px; line-height: 1; }
.brand-mark {
    width: 46px; height: 46px; border-radius: 14px; position: relative;
    display: inline-grid; place-items: center; overflow: hidden;
    background: var(--brand); box-shadow: 0 8px 20px rgba(16,26,49,.18);
}
.brand-mark-cloud {
    width: 27px; height: 12px; border-radius: 20px; position: absolute; top: 10px;
    background: var(--accent);
}
.brand-mark-cloud::before, .brand-mark-cloud::after {
    content: ""; position: absolute; border-radius: 50%; background: var(--accent);
}
.brand-mark-cloud::before { width: 12px; height: 12px; right: 3px; top: -6px; }
.brand-mark-cloud::after { width: 9px; height: 9px; left: 4px; top: -3px; }
.brand-mark-book { position: absolute; bottom: 8px; width: 25px; height: 13px; }
.brand-mark-book::before, .brand-mark-book::after {
    content: ""; position: absolute; bottom: 0; width: 12px; height: 12px;
    border: 2px solid #fff; border-top-width: 1px;
}
.brand-mark-book::before { right: 1px; transform: skewY(9deg); border-radius: 1px 4px 2px 1px; }
.brand-mark-book::after { left: 1px; transform: skewY(-9deg); border-radius: 4px 1px 1px 2px; }
.logo-lockup { display: flex; flex-direction: column; gap: 5px; }
.logo .logo-text { color: var(--text); font-size: 24px; font-weight: 900; }
.logo .logo-text b { color: var(--accent); font-weight: 900; }
.logo-lockup small { color: var(--text-light); font-size: 10px; letter-spacing: .7px; font-weight: 700; }
.nav-links { gap: clamp(13px, 1.3vw, 22px); }
.nav-links a { font-size: 15px; }
.nav-actions { gap: 8px; }
.nav-icon-btn, .cart-icon {
    width: 42px; height: 42px; min-width: 42px; padding: 0;
    display: inline-grid; place-items: center; border: 1px solid var(--border);
    border-radius: 12px; background: var(--surface);
}
.mobile-menu-extras { display: none; }


.trust-strip { margin-top: -34px; }
.trust-item { box-shadow: 0 10px 30px rgba(16,26,49,.08); border-radius: 14px; }
.trust-item i {
    width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
    background: var(--accent-light); flex: 0 0 auto;
}
.trust-item h3 { font-size: 16px; }
.section-space { padding: 68px 0; }
.section-title { font-size: clamp(27px, 3vw, 36px); margin-bottom: 38px; }
.section-title::after { width: 48px; height: 3px; margin-top: 14px; }
.section-eyebrow {
    display: block; margin-bottom: 7px; color: var(--accent); font-size: 13px;
    font-weight: 800; letter-spacing: .4px;
}
.section-eyebrow-center { text-align: center; }
.section-head .section-title { margin-bottom: 0; }

.editorial-books-section {
    position: relative; isolation: isolate; color: #fff; overflow: hidden;
    background:
        linear-gradient(90deg, rgba(16,26,49,.94), rgba(16,26,49,.82)),
        var(--cms-home-editorial-image, url('../images/editorial-home-v2.webp')) center / cover no-repeat;
}
.editorial-books-section::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: radial-gradient(circle at 50% 20%, rgba(197,154,54,.15), transparent 35rem);
}
.editorial-books-section .section-title { color: #fff; }
.editorial-books-section .section-eyebrow { color: #e6c66d; }
.editorial-books-section .carousel-nav button {
    color: #fff;
    border-color: rgba(212, 175, 55, .55);
    background: rgba(9, 22, 44, .82);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
    backdrop-filter: blur(8px);
}
.editorial-books-section .carousel-nav button:hover,
.editorial-books-section .carousel-nav button:focus-visible {
    color: #0f172a;
    border-color: var(--accent);
    outline: none;
    background: var(--accent);
}
.editorial-books-section .carousel-nav button:disabled {
    color: rgba(255,255,255,.5);
    border-color: rgba(255,255,255,.18);
    background: rgba(9, 22, 44, .5);
    cursor: not-allowed;
    opacity: .72;
}
.editorial-books-section .btn-outline { border-color: rgba(255,255,255,.5); color: #fff; }
.categories-stage {
    position: relative; overflow: hidden;
    background:
        radial-gradient(circle at 100% 30%, rgba(197,154,54,.14), transparent 27rem),
        linear-gradient(180deg, var(--bg-color), var(--surface));
}
.categories-stage::before {
    content: "س"; position: absolute; left: 4%; top: -120px; color: var(--accent);
    font-size: 430px; font-weight: 900; opacity: .035; line-height: 1; pointer-events: none;
}
.categories-stage .category-item { background: var(--surface); border-color: var(--border); box-shadow: 0 8px 26px rgba(16,26,49,.05); }
@media (max-width: 768px) {
    .editorial-books-section { background-position: 35% center; }
    .categories-stage::before { font-size: 280px; }
}

@media (max-width: 1100px) {
    .nav-links { gap: 12px; }
    .nav-links a { font-size: 14px; }
    .logo-lockup small { display: none; }
    .logo .logo-text { font-size: 21px; }
}

@media (max-width: 768px) {
    .container { padding-inline: 18px; }
    .top-bar { display: none; }
    .nav-container { height: 70px; gap: 10px; }
    .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
    .logo .logo-text { font-size: 19px; }
    .logo-lockup small { display: none; }
    .nav-actions { margin-inline-start: auto; gap: 6px; }
    .nav-actions > .theme-toggle, .nav-actions > .lang-switch-btn { display: none; }
    .nav-icon-btn, .cart-icon { width: 39px; min-width: 39px; height: 39px; }
    .nav-links {
        position: fixed; inset: 70px 0 auto; max-height: calc(100dvh - 70px);
        overflow-y: auto; padding: 18px; border-top: 1px solid var(--border);
        box-shadow: 0 22px 30px rgba(16,26,49,.14); z-index: 1010;
    }
    .nav-links a { width: 100%; padding: 11px 6px; font-size: 16px; }
    .mobile-menu-extras { display: block; width: 100%; padding-top: 8px; border-top: 1px solid var(--border); }
    .hero-grid-section { padding: 18px 0 38px; }
    .hero-grid { width: 100%; gap: 14px; overflow: hidden; }
    .hero-slider-wrapper { width: 100%; height: min(430px, 108vw); border-radius: 16px; }
    .hero-slide { inset: 0; width: 100%; padding: 28px 22px 72px; align-items: center; overflow: hidden; }
    .hero-slide-content { width: 100%; max-width: 100%; }
    .hero-slide-content .slide-title {
        font-size: clamp(30px, 10vw, 42px); overflow-wrap: anywhere; line-height: 1.3;
    }
    .hero-slide-content .slide-desc { font-size: 16px; line-height: 1.8; }
    .hero-slider-nav { right: 20px; bottom: 20px; }
    .hero-banners { width: 100%; height: auto; gap: 14px; }
    .hero-banner { width: 100%; min-height: 180px; padding: 22px; }
    .hero-banner .banner-content { max-width: 100%; }
    .hero-banner .banner-content h3 { font-size: 21px; overflow-wrap: anywhere; }
    .trust-strip { margin-top: 0; }
    .trust-grid { gap: 10px; }
    .trust-item { padding: 16px; }
    .trust-item p { display: none; }
    .section-space { padding: 50px 0; }
    .section-head { margin-bottom: 26px; }
    .section-title { font-size: 27px; margin-bottom: 28px; }
    .books-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .book-info { padding: 13px; }
    .book-title { font-size: 15px; }
    .book-author, .book-category { font-size: 12px; }
    .book-footer { gap: 6px; }
    .book-price { font-size: 15px; }
    .add-to-cart-btn { width: 36px; height: 36px; }
    .drag-carousel { max-width: 100%; overflow-x: auto; }
    .drag-carousel .book-card { min-width: min(64vw, 240px); }
}

/* ==========================================================================
   Skeleton Loaders
   ========================================================================== */
.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--bg-color) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius);
}
[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--surface) 50%, var(--border) 75%);
    background-size: 200% 100%;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-text {
    height: 14px;
    width: 80%;
    margin-bottom: 8px;
    border-radius: 4px;
}
.skeleton-title {
    height: 20px;
    width: 60%;
    margin-bottom: 12px;
}
.skeleton-img {
    width: 100%;
    height: 100%;
}

/* Sticky Add to Cart (Book Page) */
.sticky-add-to-cart {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    background: var(--surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 15px rgba(0,0,0,0.05);
    padding: 15px 0;
    z-index: 1000;
    transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
}
.sticky-add-to-cart.visible {
    bottom: 0;
}
.sticky-add-to-cart .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sticky-book-info {
    display: flex;
    align-items: center;
    gap: 15px;
}
.sticky-book-info img {
    width: 40px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}
.sticky-book-details h4 {
    margin: 0;
    font-size: 16px;
    color: var(--text);
}
.sticky-book-details .price {
    font-weight: 700;
    color: var(--accent);
    margin: 0;
}
.sticky-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
@media (max-width: 768px) {
    .sticky-book-info { display: none; }
    .sticky-add-to-cart .container { justify-content: center; width: 100%; }
    .sticky-actions { width: 100%; }
    .sticky-actions .btn { flex: 1; }
}

@media (max-width: 380px) {
    .logo .logo-text { display: none; }
    .books-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Safe rich content rendered from the admin editor */
.rich-content { max-width: 100%; line-height: 1.9; overflow-wrap: anywhere; }
.rich-content > :first-child { margin-top: 0; }
.rich-content > :last-child { margin-bottom: 0; }
.rich-content p { margin: 0 0 1em; }
.rich-content h1, .rich-content h2, .rich-content h3, .rich-content h4 { margin: 1.15em 0 .55em; color: inherit; line-height: 1.35; }
.rich-content ul, .rich-content ol { margin: .8em 0; padding-inline-start: 1.6em; }
.rich-content blockquote { margin: 1.2em 0; padding: .75em 1em; border-inline-start: 4px solid var(--accent); border-radius: 6px; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.rich-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.rich-content img { max-width: 100%; height: auto; border-radius: 10px; }
.rich-content figure { max-width: 100%; margin: 1.2em auto; text-align: center; }
.rich-content figcaption { margin-top: .45em; color: var(--text-light); font-size: .85em; }
.rich-content table { display: block; width: 100%; max-width: 100%; margin: 1.2em 0; overflow-x: auto; border-collapse: collapse; }
.rich-content th, .rich-content td { min-width: 90px; padding: 9px 12px; border: 1px solid var(--border); text-align: start; }
.rich-content th { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); font-weight: 700; }
.rich-content pre { max-width: 100%; padding: 14px; overflow-x: auto; border-radius: 8px; background: #101a31; color: #eef2f7; direction: ltr; text-align: left; }
.rich-content code { font-family: Consolas, Monaco, monospace; }
