/* ==========================================================================
   دار السحاب — نظام الحركة والتفاعل
   كل الحركات تعتمد على transform/opacity فقط للحفاظ على 60fps
   ويتم إيقافها بالكامل عند تفعيل prefers-reduced-motion
   ========================================================================== */

:root {
    --ease-out-soft:  cubic-bezier(0.22, 1, 0.36, 1);
    --ease-out-back:  cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-in-out-s:  cubic-bezier(0.65, 0, 0.35, 1);
    --dur-fast:   0.2s;
    --dur-base:   0.4s;
    --dur-slow:   0.7s;
    --dur-slower: 1.1s;
}

/* ==========================================================================
   0) احترام تفضيل تقليل الحركة
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
.reduced-motion .cloud-layer,
.reduced-motion .hero-aurora,
.reduced-motion .marquee-track,
.reduced-motion .footer-clouds span { animation: none !important; }

html { scroll-behavior: smooth; }

/* ==========================================================================
   1) مكتبة الحركات الأساسية
   ========================================================================== */
@keyframes sa-fade-up      { from { opacity: 0; transform: translate3d(0, 34px, 0); }  to { opacity: 1; transform: none; } }
@keyframes sa-fade-down    { from { opacity: 0; transform: translate3d(0, -28px, 0); } to { opacity: 1; transform: none; } }
@keyframes sa-fade-in      { from { opacity: 0; } to { opacity: 1; } }
@keyframes sa-fade-side    { from { opacity: 0; transform: translate3d(40px, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes sa-zoom-in      { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes sa-flip-in      { from { opacity: 0; transform: perspective(900px) rotateY(-22deg) translateZ(-40px); }
                             to   { opacity: 1; transform: perspective(900px) rotateY(0) translateZ(0); } }
@keyframes sa-float        { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-18px) rotate(1.5deg); } }
@keyframes sa-float-slow   { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes sa-pop          { 0% { transform: scale(1); } 45% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes sa-shine        { 0% { transform: translateX(-160%) skewX(-18deg); } 100% { transform: translateX(320%) skewX(-18deg); } }
@keyframes sa-shimmer      { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes sa-spin         { to { transform: rotate(360deg); } }
@keyframes sa-pulse-ring   { 0% { transform: scale(0.85); opacity: 0.8; } 100% { transform: scale(2.1); opacity: 0; } }
@keyframes sa-drift        { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes sa-heart-burst  { 0% { transform: translate(0,0) scale(0); opacity: 1; }
                             100% { transform: translate(var(--hx), var(--hy)) scale(1); opacity: 0; } }
@keyframes sa-bar-slide    { 0% { transform: translateX(-100%); } 60% { transform: translateX(-12%); } 100% { transform: translateX(0); } }
@keyframes sa-blur-in      { from { opacity: 0; filter: blur(12px); transform: scale(1.04); }
                             to   { opacity: 1; filter: blur(0);   transform: none; } }

/* ==========================================================================
   2) نظام الظهور عند السكرول (Reveal)
   ========================================================================== */
.reveal,
.reveal-item {
    opacity: 0;
    will-change: transform, opacity;
}
.reveal.is-visible,
.reveal-item.is-visible {
    animation: sa-fade-up var(--dur-slow) var(--ease-out-soft) forwards;
    animation-delay: var(--reveal-delay, 0ms);
}
.reveal[data-anim="fade"].is-visible  { animation-name: sa-fade-in; }
.reveal[data-anim="zoom"].is-visible  { animation-name: sa-zoom-in; }
.reveal[data-anim="side"].is-visible  { animation-name: sa-fade-side; }
.reveal[data-anim="down"].is-visible  { animation-name: sa-fade-down; }
.reveal[data-anim="flip"].is-visible  { animation-name: sa-flip-in; }
.reveal[data-anim="blur"].is-visible  { animation-name: sa-blur-in; }

/* توافق مع الكلاس القديم */
.animate-on-scroll { opacity: 0; }
.animate-on-scroll.visible { animation: sa-fade-up var(--dur-slow) var(--ease-out-soft) forwards; }

/* ==========================================================================
   3) دخول الصفحة والانتقال بينها
   ========================================================================== */
body.page-enter > main { animation: sa-fade-in 0.5s var(--ease-out-soft) both; }
body.page-leaving { opacity: 0; transition: opacity 0.22s ease; }

/* شريط التحميل العلوي */
.top-loader {
    position: fixed; inset-block-start: 0; inset-inline-start: 0;
    height: 3px; width: 100%;
    background: linear-gradient(90deg, var(--accent), #f7dc8a, var(--accent));
    transform: scaleX(0); transform-origin: var(--logical-start, right);
    z-index: 4000; opacity: 0; pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.top-loader.is-loading { opacity: 1; transform: scaleX(0.75); transition-duration: 1.4s; }
.top-loader.is-done    { opacity: 0; transform: scaleX(1); transition-duration: 0.25s; }

/* شريط تقدّم السكرول */
.scroll-progress {
    position: fixed; inset-block-start: 0; inset-inline-start: 0;
    width: 100%; height: 3px; z-index: 3999; pointer-events: none;
}
.scroll-progress span {
    display: block; height: 100%; width: 100%;
    background: linear-gradient(90deg, var(--accent), #f1c40f);
    transform: scaleX(0); transform-origin: right;
    transition: transform 0.1s linear;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.6);
}
[dir="ltr"] .scroll-progress span { transform-origin: left; }

.skip-link {
    position: absolute; inset-inline-start: -9999px; top: 0; z-index: 5000;
    background: var(--accent); color: #0f172a; padding: 12px 20px;
    font-weight: 700; border-radius: 0 0 12px 12px;
}
.skip-link:focus { inset-inline-start: 24px; }

/* ==========================================================================
   4) الهيدر
   ========================================================================== */
.header { transition: box-shadow 0.35s ease, background 0.35s ease, transform 0.4s var(--ease-out-soft); }
.header.scrolled { box-shadow: 0 8px 30px -12px rgba(0, 0, 0, 0.25); }
.header.header-hidden { transform: translateY(-105%); }

.logo-cloud { display: inline-flex; position: relative; }
.logo-cloud i { color: var(--accent); animation: sa-float-slow 5s ease-in-out infinite; }
.logo:hover .logo-cloud i { animation-duration: 1.6s; }
.logo-text { display: inline-block; transition: transform 0.35s var(--ease-out-back); }
.logo:hover .logo-text { transform: translateX(-3px); }

/* مؤشر متحرك أسفل روابط القائمة */
.nav-links { position: relative; }
.nav-indicator {
    position: absolute; bottom: 0; height: 3px; border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), #f1c40f);
    inset-inline-start: 0; width: 0; opacity: 0;
    transition: transform 0.42s var(--ease-out-back), width 0.42s var(--ease-out-back), opacity 0.3s ease;
    pointer-events: none;
}
.nav-indicator.is-active { opacity: 1; }
.nav-links a::after { display: none; }

/* أزرار الأيقونات في الشريط */
.nav-icon-btn {
    width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 12px; border: 1px solid var(--border); background: transparent;
    color: var(--text); cursor: pointer; font-size: 15px; font-weight: 700;
    transition: transform 0.28s var(--ease-out-back), background 0.28s ease, color 0.28s ease, border-color 0.28s ease;
    position: relative; overflow: hidden; font-family: inherit;
}
.mobile-menu-btn { display: none !important; }
@media (max-width: 768px) {
    .mobile-menu-btn { display: inline-flex !important; }
}
.nav-icon-btn:hover { transform: translateY(-3px); color: var(--accent); border-color: var(--accent); }
.nav-icon-btn:active { transform: scale(0.92); }

/* زر الثيم — شمس/قمر بتتبدل بحركة */
.theme-toggle .theme-toggle-track { position: relative; width: 20px; height: 20px; display: block; }
.theme-toggle i {
    position: absolute; inset: 0; display: grid; place-items: center;
    transition: transform 0.5s var(--ease-out-back), opacity 0.35s ease;
}
.theme-icon-sun  { opacity: 0; transform: rotate(-90deg) scale(0.4); }
.theme-icon-moon { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="dark"] .theme-icon-sun  { opacity: 1; transform: rotate(0) scale(1); color: var(--accent); }
[data-theme="dark"] .theme-icon-moon { opacity: 0; transform: rotate(90deg) scale(0.4); }

/* موجة تبديل الثيم */
.theme-ripple {
    position: fixed; border-radius: 50%; pointer-events: none; z-index: 9998;
    background: var(--bg-color); transform: scale(0); animation: theme-wave 0.65s var(--ease-in-out-s) forwards;
}
@keyframes theme-wave { to { transform: scale(1); } }

/* زر القائمة (برجر متحرك) */
.burger { width: 20px; height: 14px; position: relative; display: block; }
.burger span {
    position: absolute; inset-inline: 0; height: 2px; border-radius: 2px; background: currentColor;
    transition: transform 0.4s var(--ease-out-back), opacity 0.25s ease, width 0.4s var(--ease-out-back);
}
.burger span:nth-child(1) { top: 0; }
.burger span:nth-child(2) { top: 6px; width: 70%; }
.burger span:nth-child(3) { top: 12px; }
.mobile-menu-btn[aria-expanded="true"] .burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.mobile-menu-btn[aria-expanded="true"] .burger span:nth-child(2) { opacity: 0; transform: translateX(-14px); }
.mobile-menu-btn[aria-expanded="true"] .burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* أيقونة السلة */
.cart-icon { position: relative; transition: transform 0.3s var(--ease-out-back); }
.cart-icon:hover { transform: translateY(-3px) rotate(-6deg); }
.cart-count { transition: transform 0.35s var(--ease-out-back); }
.cart-count.is-empty { opacity: 0.45; }
.cart-count.bump { animation: sa-pop 0.55s var(--ease-out-back); }
.cart-icon.ring::after {
    content: ''; position: absolute; inset: -6px; border-radius: 50%;
    border: 2px solid var(--accent); animation: sa-pulse-ring 0.7s ease-out;
}

/* ==========================================================================
   5) طبقة البحث السريع
   ========================================================================== */
.search-overlay {
    position: fixed; inset: 0; z-index: 3500;
    background: color-mix(in srgb, var(--bg-color) 82%, transparent);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    opacity: 0; visibility: hidden; transition: opacity 0.32s ease, visibility 0.32s;
    padding-top: 12vh;
}
.search-overlay.open { opacity: 1; visibility: visible; }
.search-overlay-inner {
    max-width: 720px; margin: 0 auto; padding: 0 20px;
    transform: translateY(-24px) scale(0.97); opacity: 0;
    transition: transform 0.45s var(--ease-out-back), opacity 0.35s ease;
}
.search-overlay.open .search-overlay-inner { transform: none; opacity: 1; }
.search-box {
    display: flex; align-items: center; gap: 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 18px; padding: 6px 20px; box-shadow: var(--shadow-hover);
}
.search-box > i { color: var(--accent); font-size: 18px; }
.search-box input {
    flex: 1; border: 0; outline: 0; background: transparent; color: var(--text);
    font-family: inherit; font-size: 19px; padding: 18px 0;
}
.search-box button {
    background: transparent; border: 0; color: var(--text-light); cursor: pointer;
    font-size: 18px; width: 36px; height: 36px; border-radius: 10px; transition: var(--transition);
}
.search-box button:hover { background: var(--bg-color); color: var(--accent); transform: rotate(90deg); }
.search-results { margin-top: 16px; max-height: 56vh; overflow-y: auto; }
.search-hint { text-align: center; color: var(--text-light); padding: 30px 0; }
.search-result-item {
    display: flex; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 14px;
    background: var(--surface); border: 1px solid var(--border); margin-bottom: 10px;
    opacity: 0; animation: sa-fade-up 0.45s var(--ease-out-soft) forwards;
    transition: transform 0.28s var(--ease-out-back), border-color 0.28s ease;
}
.search-result-item:hover { transform: translateX(-6px); border-color: var(--accent); }
[dir="ltr"] .search-result-item:hover { transform: translateX(6px); }
.search-result-item img { width: 44px; height: 62px; object-fit: cover; border-radius: 8px; }
.search-result-item .sr-title { font-weight: 700; color: var(--text); }
.search-result-item .sr-author { font-size: 13px; color: var(--text-light); }
.search-result-item .sr-price { margin-inline-start: auto; color: var(--accent); font-weight: 800; white-space: nowrap; }

/* ==========================================================================
   6) الهيرو
   ========================================================================== */
.hero { position: relative; overflow: hidden; isolation: isolate; }

.hero-aurora {
    position: absolute; inset: -30%; z-index: -2; pointer-events: none;
    background:
        radial-gradient(38% 42% at 20% 30%, rgba(212, 175, 55, 0.28), transparent 60%),
        radial-gradient(34% 38% at 78% 24%, rgba(96, 165, 250, 0.22), transparent 62%),
        radial-gradient(42% 46% at 55% 82%, rgba(212, 175, 55, 0.16), transparent 60%);
    filter: blur(20px);
    animation: aurora-drift 22s ease-in-out infinite alternate;
}
@keyframes aurora-drift {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    50%  { transform: translate3d(-3%, 2%, 0) scale(1.08); }
    100% { transform: translate3d(3%, -2%, 0) scale(1.03); }
}

/* طبقات السحاب المتحركة (هوية دار السحاب) */
.cloud-layer {
    position: absolute; inset-inline-start: 0; width: 200%; height: 100%;
    z-index: -1; pointer-events: none; opacity: 0.5;
    background-repeat: repeat-x; background-size: 50% auto;
}
.cloud-layer::before, .cloud-layer::after {
    content: ''; position: absolute; border-radius: 50%;
    background: radial-gradient(circle at 30% 40%, rgba(255,255,255,0.9), rgba(255,255,255,0) 70%);
}
.cloud-1 { animation: sa-drift 60s linear infinite; opacity: 0.35; }
.cloud-2 { animation: sa-drift 95s linear infinite; opacity: 0.22; }
.cloud-3 { animation: sa-drift 140s linear infinite; opacity: 0.14; }
.cloud-1::before { width: 320px; height: 120px; top: 18%; inset-inline-start: 8%; }
.cloud-1::after  { width: 220px; height: 90px;  top: 58%; inset-inline-start: 34%; }
.cloud-2::before { width: 420px; height: 150px; top: 34%; inset-inline-start: 55%; }
.cloud-2::after  { width: 260px; height: 100px; top: 8%;  inset-inline-start: 78%; }
.cloud-3::before { width: 500px; height: 170px; top: 62%; inset-inline-start: 20%; }
.cloud-3::after  { width: 300px; height: 110px; top: 26%; inset-inline-start: 90%; }
[data-theme="dark"] .cloud-layer { opacity: 0.16; }

/* ظهور محتوى الهيرو بتدرّج */
.hero-content > * { opacity: 0; animation: sa-fade-up 0.9s var(--ease-out-soft) forwards; }
.hero-content > *:nth-child(1) { animation-delay: 0.05s; }
.hero-content > *:nth-child(2) { animation-delay: 0.18s; }
.hero-content > *:nth-child(3) { animation-delay: 0.31s; }
.hero-content > *:nth-child(4) { animation-delay: 0.44s; }
.hero-content > *:nth-child(5) { animation-delay: 0.57s; }

/* ظهور العنوان كلمة كلمة */
.word-reveal { display: inline-block; overflow: hidden; vertical-align: bottom; }
.word-reveal > span {
    display: inline-block; transform: translateY(110%);
    animation: word-up 0.85s var(--ease-out-soft) forwards;
    animation-delay: calc(var(--wi, 0) * 70ms);
}
@keyframes word-up { to { transform: translateY(0); } }
.word-accent { color: var(--accent); }

/* الكتاب ثلاثي الأبعاد */
.hero-graphics { perspective: 1400px; display: grid; place-items: center; }
.book-3d {
    position: relative; width: 230px; height: 330px;
    transform-style: preserve-3d;
    transform: rotateY(var(--ry, -22deg)) rotateX(var(--rx, 6deg));
    transition: transform 0.4s var(--ease-out-soft);
    animation: sa-float 6s ease-in-out infinite;
}
.book-3d__face {
    position: absolute; inset: 0; border-radius: 6px 14px 14px 6px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    box-shadow: 0 40px 60px -25px rgba(0, 0, 0, 0.65);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px; color: #fff; overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.book-3d__face::after {
    content: ''; position: absolute; top: 0; inset-inline-start: 0; width: 60%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.22), transparent);
    transform: translateX(-160%) skewX(-18deg);
    animation: sa-shine 5.5s ease-in-out infinite;
}
.book-3d__face i { font-size: 58px; color: var(--accent); }
.book-3d__face span { font-weight: 800; font-size: 17px; letter-spacing: 0.5px; }
.book-3d__spine {
    position: absolute; inset-block: 0; inset-inline-end: 100%; width: 26px;
    background: linear-gradient(180deg, #d4af37, #a17f18);
    transform: rotateY(90deg); transform-origin: inset-inline-end center;
    border-radius: 4px 0 0 4px;
}
.book-3d__pages {
    position: absolute; inset-block: 8px; inset-inline-start: 100%; width: 22px;
    background: repeating-linear-gradient(90deg, #fff 0 2px, #e2e8f0 2px 4px);
    transform: rotateY(90deg); transform-origin: inset-inline-start center;
    border-radius: 0 4px 4px 0;
}
.book-3d__glow {
    position: absolute; inset: auto 0 -40px 0; height: 60px; filter: blur(24px);
    background: radial-gradient(ellipse at center, rgba(212,175,55,0.55), transparent 70%);
    transform: translateZ(-60px);
}

/* شريط الإحصائيات */
.hero-stats { display: flex; flex-wrap: wrap; gap: 32px; margin-top: 34px; }
.stat-item { display: flex; flex-direction: column; }
.stat-value { font-size: 34px; font-weight: 900; color: var(--accent); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 14px; color: var(--text-light); font-weight: 600; }

/* ==========================================================================
   7) كروت الكتب
   ========================================================================== */

/* زر الإضافة للسلة */
.add-to-cart-btn { position: relative; overflow: hidden; transition: transform 0.3s var(--ease-out-back), background 0.3s; }
.add-to-cart-btn:hover { transform: translateY(-3px) scale(1.06); }
.add-to-cart-btn:active { transform: scale(0.9); }
.add-to-cart-btn.is-success { background: #16a34a !important; color: #fff !important; animation: sa-pop 0.5s var(--ease-out-back); }

/* الغلاف الطائر للسلة */
.flying-cover {
    position: fixed; z-index: 5000; pointer-events: none;
    border-radius: 8px; object-fit: cover;
    box-shadow: 0 18px 40px -12px rgba(0,0,0,0.5);
    transition: transform 0.85s cubic-bezier(0.55, -0.2, 0.35, 1), opacity 0.85s ease, width 0.85s ease, height 0.85s ease;
}

/* ==========================================================================
   8) الأزرار — ripple و مغناطيسية
   ========================================================================== */
.btn { position: relative; overflow: hidden; transition: transform 0.3s var(--ease-out-back), box-shadow 0.3s ease, background 0.3s ease; }
.btn:hover { transform: translateY(-3px); }
.btn:active { transform: translateY(-1px) scale(0.98); }
.ripple-ink {
    position: absolute; border-radius: 50%; transform: scale(0);
    background: rgba(255, 255, 255, 0.45); pointer-events: none;
    animation: ripple-go 0.65s var(--ease-out-soft) forwards;
}
.btn-outline .ripple-ink { background: rgba(212, 175, 55, 0.35); }
@keyframes ripple-go { to { transform: scale(2.6); opacity: 0; } }

.btn-magnetic { transition: transform 0.25s var(--ease-out-soft); }

/* لمعة على الأزرار الأساسية */
.btn::before {
    content: ''; position: absolute; top: 0; inset-inline-start: -60%; width: 45%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,0.35), transparent);
    transform: skewX(-20deg); opacity: 0; transition: opacity 0.2s;
}
.btn:hover::before { opacity: 1; animation: sa-shine 0.85s ease-out; }

/* ==========================================================================
   9) هياكل التحميل (Skeleton)
   ========================================================================== */
.skeleton {
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--border) 55%, transparent) 25%,
        color-mix(in srgb, var(--border) 90%, transparent) 37%,
        color-mix(in srgb, var(--border) 55%, transparent) 63%);
    background-size: 400% 100%;
    animation: sa-shimmer 1.4s ease-in-out infinite;
    border-radius: 10px;
}
.skeleton-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; padding-bottom: 16px; }
.skeleton-cover { aspect-ratio: 3 / 4; width: 100%; border-radius: 0; }
.skeleton-line { height: 12px; margin: 12px 16px 0; }
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-45 { width: 45%; }
.skeleton-row { display: flex; gap: 12px; padding: 12px; align-items: center; }
.skeleton-thumb { width: 54px; height: 74px; flex: 0 0 auto; }
.skeleton-stack { flex: 1; }

/* ==========================================================================
   10) التنبيهات (Toasts)
   ========================================================================== */
#toast-container {
    position: fixed; inset-block-end: 24px; inset-inline-end: 24px;
    z-index: 5000; display: flex; flex-direction: column; gap: 12px; align-items: flex-end;
}
.toast {
    display: flex; align-items: center; gap: 12px; min-width: 270px; max-width: 90vw;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: 14px;
    padding: 14px 18px; box-shadow: var(--shadow-hover);
    transform: translateY(24px) scale(0.94); opacity: 0;
    transition: transform 0.45s var(--ease-out-back), opacity 0.35s ease;
    position: relative; overflow: hidden;
}
.toast.show { transform: none; opacity: 1; }
.toast .toast-icon { font-size: 20px; color: #16a34a; }
.toast.toast-error .toast-icon { color: #ef4444; }
.toast.toast-info  .toast-icon { color: #3b82f6; }
.toast-bar {
    position: absolute; inset-block-end: 0; inset-inline-start: 0; height: 3px; width: 100%;
    background: var(--accent); transform-origin: right; animation: toast-timer linear forwards;
}
[dir="ltr"] .toast-bar { transform-origin: left; }
@keyframes toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ==========================================================================
   11) نظرة سريعة
   ========================================================================== */
.quick-view-overlay {
    position: fixed; inset: 0; z-index: 4200; display: grid; place-items: center;
    background: rgba(2, 6, 23, 0.62); backdrop-filter: blur(8px);
    opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s; padding: 20px;
}
.quick-view-overlay.open { opacity: 1; visibility: visible; }
.quick-view-modal {
    background: var(--surface); border-radius: 22px; border: 1px solid var(--border);
    width: min(880px, 100%); max-height: 88vh; overflow-y: auto; position: relative;
    transform: translateY(30px) scale(0.95); opacity: 0;
    transition: transform 0.5s var(--ease-out-back), opacity 0.35s ease;
    box-shadow: 0 40px 80px -30px rgba(0,0,0,0.55);
}
.quick-view-overlay.open .quick-view-modal { transform: none; opacity: 1; }
.quick-view-close {
    position: absolute; inset-block-start: 14px; inset-inline-end: 14px; z-index: 2;
    width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--bg-color); color: var(--text); cursor: pointer; transition: var(--transition);
}
.quick-view-close:hover { background: #ef4444; color: #fff; transform: rotate(90deg); }
.qv-grid { display: grid; grid-template-columns: 260px 1fr; gap: 28px; padding: 28px; }
.qv-cover { border-radius: 16px; overflow: hidden; aspect-ratio: 3/4; background: var(--bg-color); }
.qv-cover img { width: 100%; height: 100%; object-fit: cover; }
.qv-title { font-size: 26px; font-weight: 900; margin-bottom: 6px; }
.qv-author { color: var(--text-light); margin-bottom: 14px; }
.qv-price { font-size: 26px; font-weight: 900; color: var(--accent); margin: 16px 0; }
.qv-desc { color: var(--text-light); line-height: 1.9; max-height: 160px; overflow: hidden; }
.qv-meta { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.qv-meta span { background: var(--bg-color); border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; font-size: 13px; }
.qv-actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
@media (max-width: 700px) { .qv-grid { grid-template-columns: 1fr; padding: 20px; } }

/* ==========================================================================
   12) زر العودة للأعلى مع حلقة تقدّم
   ========================================================================== */
.back-to-top {
    position: fixed; inset-block-end: 26px; inset-inline-start: 26px; z-index: 900;
    width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--surface); color: var(--accent); box-shadow: var(--shadow-hover);
    display: grid; place-items: center;
    opacity: 0; transform: translateY(20px) scale(0.8); pointer-events: none;
    transition: opacity 0.35s ease, transform 0.45s var(--ease-out-back);
}
.back-to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.back-to-top:hover { transform: translateY(-4px); }
.back-to-top svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.back-to-top circle { fill: none; stroke-width: 2.5; }
.btt-track { stroke: var(--border); }
.btt-progress {
    stroke: var(--accent); stroke-linecap: round;
    stroke-dasharray: 100.5; stroke-dashoffset: var(--btt-offset, 100.5);
    transition: stroke-dashoffset 0.1s linear;
}
.back-to-top i { font-size: 16px; }

/* ==========================================================================
   13) النشرة البريدية
   ========================================================================== */
.newsletter-section { padding: 60px 0; }
.newsletter-card {
    position: relative; overflow: hidden; border-radius: 26px; padding: 44px;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    display: flex; align-items: center; justify-content: space-between; gap: 30px; flex-wrap: wrap;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.newsletter-glow {
    position: absolute; width: 460px; height: 460px; border-radius: 50%;
    background: radial-gradient(circle, rgba(212,175,55,0.4), transparent 65%);
    inset-block-start: -55%; inset-inline-end: -12%; filter: blur(20px);
    animation: sa-float 9s ease-in-out infinite;
}
.newsletter-text h3 { color: #fff; font-size: 26px; margin-bottom: 8px; }
.newsletter-text h3 i { color: var(--accent); }
.newsletter-text p { color: rgba(255,255,255,0.72); }
.newsletter-form { display: flex; gap: 10px; position: relative; z-index: 2; flex-wrap: wrap; }
.newsletter-form input {
    padding: 15px 20px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.09); color: #fff; font-family: inherit; font-size: 15px; min-width: 260px;
    transition: var(--transition);
}
.newsletter-form input::placeholder { color: rgba(255,255,255,0.55); }
.newsletter-form input:focus { outline: 0; border-color: var(--accent); background: rgba(255,255,255,0.16); }

/* ==========================================================================
   14) الفوتر
   ========================================================================== */
.footer { position: relative; overflow: hidden; }
.footer-clouds { position: absolute; inset: 0; pointer-events: none; opacity: 0.05; }
.footer-clouds span {
    position: absolute; border-radius: 50%; background: #fff; filter: blur(30px);
}
.footer-clouds span:nth-child(1) { width: 300px; height: 120px; top: 10%; inset-inline-start: 5%;  animation: sa-float 12s ease-in-out infinite; }
.footer-clouds span:nth-child(2) { width: 220px; height: 90px;  top: 55%; inset-inline-start: 45%; animation: sa-float 16s ease-in-out infinite reverse; }
.footer-clouds span:nth-child(3) { width: 260px; height: 100px; top: 25%; inset-inline-start: 78%; animation: sa-float 14s ease-in-out infinite; }
.footer-social { display: flex; gap: 12px; margin-top: 18px; }
.footer-social a {
    width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
    background: rgba(255,255,255,0.07); color: #fff;
    transition: transform 0.3s var(--ease-out-back), background 0.3s;
}
.footer-social a:hover { transform: translateY(-5px) rotate(-8deg); background: var(--accent); color: #0f172a; }
.footer-links a { display: inline-block; transition: transform 0.3s var(--ease-out-soft), color 0.3s; }
.footer-links a:hover { transform: translateX(-6px); color: var(--accent); }
[dir="ltr"] .footer-links a:hover { transform: translateX(6px); }

/* ==========================================================================
   15) الشريط السفلي للموبايل
   ========================================================================== */
/* الشريط ثابت أسفل الشاشة (position: fixed في style.css) — الحبة تتموضع بالنسبة له */
.mobile-nav-pill {
    position: absolute; inset-block-start: 6px; height: calc(100% - 12px);
    border-radius: 14px; background: color-mix(in srgb, var(--accent) 15%, transparent);
    transition: transform 0.45s var(--ease-out-back), width 0.45s var(--ease-out-back);
    pointer-events: none; z-index: 0; opacity: 0;
}
.mobile-nav-pill.ready { opacity: 1; }
.mobile-nav-item { position: relative; z-index: 1; transition: transform 0.3s var(--ease-out-back); }
.mobile-nav-item:active { transform: scale(0.9); }
.mobile-nav-item.active i { animation: sa-pop 0.5s var(--ease-out-back); }

/* شريط الشراء الثابت في صفحة الكتاب */
.sticky-buy-bar {
    position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 950;
    background: var(--surface-glass); backdrop-filter: blur(16px);
    border-top: 1px solid var(--border); padding: 12px 18px;
    display: flex; align-items: center; gap: 14px;
    transform: translateY(120%); transition: transform 0.45s var(--ease-out-back);
}
.sticky-buy-bar.show { transform: none; }
.sticky-buy-bar .sbb-title { font-weight: 800; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sticky-buy-bar .sbb-price { color: var(--accent); font-weight: 900; white-space: nowrap; }
@media (max-width: 768px) { .sticky-buy-bar { inset-block-end: 70px; } }

/* ==========================================================================
   16) شريط المؤلفين المتحرك (Marquee)
   ========================================================================== */
.marquee {
    overflow: hidden; position: relative; padding: 22px 0;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
            mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track { display: flex; gap: 46px; width: max-content; animation: sa-drift 38s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-item {
    display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
    font-size: 20px; font-weight: 800; color: var(--text-light);
    transition: color 0.3s ease, transform 0.3s ease;
}
.marquee-item:hover { color: var(--accent); transform: scale(1.06); }
.marquee-item i { color: var(--accent); font-size: 14px; }

/* ==========================================================================
   17) الكاروسيل بالسحب
   ========================================================================== */
.drag-carousel {
    display: flex; gap: 22px; overflow-x: auto; scroll-snap-type: x mandatory;
    padding: 10px 4px 26px; cursor: grab;
    scrollbar-width: thin; scroll-behavior: smooth;
}
.drag-carousel.dragging { cursor: grabbing; scroll-behavior: auto; scroll-snap-type: none; }
.drag-carousel.dragging * { pointer-events: none; }
.drag-carousel > * { scroll-snap-align: start; flex: 0 0 clamp(200px, 24vw, 260px); }
.drag-carousel::-webkit-scrollbar { height: 6px; }
.drag-carousel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.drag-carousel::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.carousel-nav { display: flex; gap: 8px; }
.carousel-nav button {
    width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); cursor: pointer;
    transition: transform 0.28s var(--ease-out-back), background 0.25s, color 0.25s;
}
.carousel-nav button:hover { background: var(--accent); color: #0f172a; transform: translateY(-3px); }

/* ==========================================================================
   18) التقييم بالنجوم التفاعلي
   ========================================================================== */
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 6px; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label {
    font-size: 30px; color: var(--border); cursor: pointer;
    transition: transform 0.25s var(--ease-out-back), color 0.2s ease;
}
.star-input label:hover,
.star-input label:hover ~ label,
.star-input input:checked ~ label { color: var(--accent); }
.star-input label:hover { transform: scale(1.25) rotate(-8deg); }

/* انفجار القلوب عند الإضافة للمفضلة */
.heart-particle {
    position: fixed; pointer-events: none; z-index: 5000; color: #e74c3c; font-size: 14px;
    animation: sa-heart-burst 0.85s var(--ease-out-soft) forwards;
}

/* ==========================================================================
   19) الحالات الفارغة
   ========================================================================== */
.empty-state { text-align: center; padding: 70px 20px; }
.empty-state i {
    font-size: 64px; color: var(--border); margin-bottom: 18px; display: block;
    animation: sa-float-slow 4s ease-in-out infinite;
}
.empty-state h3 { font-size: 22px; margin-bottom: 8px; }
.empty-state p { color: var(--text-light); margin-bottom: 22px; }

/* ==========================================================================
   20) عناوين الأقسام
   ========================================================================== */
.section-title { position: relative; display: inline-block; }
.section-title::after {
    content: ''; position: absolute; inset-block-end: -10px; inset-inline-start: 0;
    height: 4px; width: 0; border-radius: 4px;
    background: linear-gradient(90deg, var(--accent), transparent);
    transition: width 0.9s var(--ease-out-soft) 0.25s;
}
.section-title.is-visible::after { width: 72px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }

/* الأقسام */
.category-item { position: relative; overflow: hidden; transition: transform 0.4s var(--ease-out-back), box-shadow 0.4s ease; }
.category-item:hover { transform: translateY(-8px) scale(1.02); }
.category-item i { transition: transform 0.45s var(--ease-out-back); }
.category-item:hover i { transform: scale(1.25) rotate(-10deg); }
.category-item::before {
    content: ''; position: absolute; inset: 0; opacity: 0;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, transparent), transparent);
    transition: opacity 0.4s ease;
}
.category-item:hover::before { opacity: 1; }

/* بطاقات الثقة */
.trust-item { transition: transform 0.4s var(--ease-out-back), box-shadow 0.4s ease; }
.trust-item:hover { transform: translateY(-6px); }
.trust-item i { transition: transform 0.45s var(--ease-out-back); }
.trust-item:hover i { transform: scale(1.2) rotate(8deg); }

/* ==========================================================================
   21) آراء القراء
   ========================================================================== */
.testimonial-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
    padding: 28px; position: relative; transition: transform 0.4s var(--ease-out-back), box-shadow 0.4s ease;
}
.testimonial-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); }
.testimonial-card::before {
    content: '\201D'; position: absolute; inset-block-start: 6px; inset-inline-end: 22px;
    font-size: 78px; color: var(--accent); opacity: 0.18; line-height: 1; font-family: Georgia, serif;
}
.testimonial-stars { color: var(--accent); margin-bottom: 12px; }
.testimonial-body { color: var(--text-light); line-height: 1.9; margin-bottom: 18px; }
.testimonial-author { display: flex; align-items: center; gap: 12px; }
.testimonial-avatar {
    width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), #f1c40f); color: #0f172a; font-weight: 900;
}

/* ==========================================================================
   22) صفحة 404
   ========================================================================== */
.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 60px 20px; }
.error-code {
    font-size: clamp(90px, 18vw, 180px); font-weight: 900; line-height: 1;
    background: linear-gradient(135deg, var(--accent), #f1c40f, var(--accent));
    background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: sa-shimmer 3.5s linear infinite;
}
.error-cloud { font-size: 70px; color: var(--accent); animation: sa-float 5s ease-in-out infinite; margin-bottom: 10px; }

/* ==========================================================================
   23) لمسات إضافية
   ========================================================================== */
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
}

img { background-color: color-mix(in srgb, var(--border) 40%, transparent); }
img[loading="lazy"] { transition: opacity 0.5s ease; }

.section-space { content-visibility: auto; contain-intrinsic-size: auto 500px; }

/* شريط تحميل داخلي للأزرار */
.btn.is-loading { pointer-events: none; opacity: 0.75; }
.btn.is-loading .btn-label { visibility: hidden; }
.btn.is-loading::after {
    content: ''; position: absolute; inset: 0; margin: auto;
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
    animation: sa-spin 0.7s linear infinite;
}

@media (max-width: 992px) {
    .nav-indicator { display: none; }
    .hero-stats { gap: 22px; }
    .stat-value { font-size: 27px; }
    .book-3d { width: 180px; height: 260px; }
}
@media (max-width: 768px) {
    #toast-container { inset-inline: 16px; inset-block-end: 88px; align-items: stretch; }
    .toast { min-width: 0; }
    .back-to-top { inset-block-end: 88px; inset-inline-start: 16px; width: 46px; height: 46px; }
    .newsletter-card { padding: 30px 22px; }
    .newsletter-form { width: 100%; }
    .newsletter-form input { min-width: 0; flex: 1; }
    .search-overlay { padding-top: 6vh; }
}

/* ==========================================================================
   24) مكوّنات جديدة
   ========================================================================== */

/* تقييم داخل الكارت */
.book-rating { display: flex; align-items: center; gap: 3px; font-size: 12px; color: var(--accent); margin-bottom: 12px; }
.book-rating span { color: var(--text-light); margin-inline-start: 5px; }

/* شارة نفاد الكمية */
.book-badge-out {
    inset-block-start: auto; inset-block-end: 16px;
    background: #ef4444; color: #fff;
}
.book-card.is-sold-out .book-cover img,
.book-card.is-sold-out .book-cover-fallback { filter: grayscale(0.75); opacity: 0.75; }
.add-to-cart-btn.is-disabled { opacity: 0.45; cursor: not-allowed; }
.book-card.is-sold-out:hover .add-to-cart-btn { background: var(--bg-color); color: var(--text); transform: none; }

/* عدد الكتب داخل بطاقة القسم */
.category-count { display: block; font-size: 13px; color: var(--text-light); margin-top: 6px; font-weight: 600; }

/* آراء القرّاء */
.testimonials-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 26px; margin-top: 34px; }

/* تلميح الكاروسيل */
.carousel-hint { text-align: center; color: var(--text-light); font-size: 13px; margin-top: 4px; }
.carousel-hint i { color: var(--accent); margin-inline-end: 6px; }

/* شريط المؤلفين */
.authors-marquee-section { padding: 10px 0; border-block: 1px solid var(--border); }

/* مسار التنقل */
.breadcrumbs { padding: 18px 0; font-size: 14px; color: var(--text-light); }
.breadcrumbs a { color: var(--text-light); transition: color 0.25s; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs i { margin: 0 9px; font-size: 11px; opacity: 0.6; }
.breadcrumbs span { color: var(--text); font-weight: 700; }

/* شبكة الفلاتر */
.filters-bar {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 20px; margin-bottom: 28px;
}
.filters-bar select, .filters-bar input {
    padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--bg-color); color: var(--text); font-family: inherit; font-size: 14px;
    transition: var(--transition);
}
.filters-bar select:focus, .filters-bar input:focus { outline: 0; border-color: var(--accent); }
.filter-chip {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
    border-radius: 99px; background: var(--accent-light); color: var(--accent);
    font-size: 13px; font-weight: 700; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    transition: transform 0.25s var(--ease-out-back);
}
.filter-chip:hover { transform: translateY(-2px); }
.filter-chip i { font-size: 11px; }

/* الترقيم */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 44px; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 42px; height: 42px; display: grid; place-items: center; padding: 0 12px;
    border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font-weight: 700;
    transition: transform 0.25s var(--ease-out-back), background 0.25s, color 0.25s, border-color 0.25s;
}
.pagination a:hover { background: var(--accent); color: #0f172a; border-color: var(--accent); transform: translateY(-3px); }
.pagination .is-current { background: var(--accent); color: #0f172a; border-color: var(--accent); }
.pagination .is-disabled { opacity: 0.4; pointer-events: none; }

/* بطاقات عامة */
.panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 26px;
}
.form-field { margin-bottom: 20px; }
.form-field label { display: block; margin-bottom: 8px; font-weight: 700; }
.form-field input, .form-field select, .form-field textarea {
    width: 100%; padding: 13px 16px; border: 1px solid var(--border); border-radius: 12px;
    font-family: inherit; font-size: 15px; background: var(--bg-color); color: var(--text);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    outline: 0; border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.alert {
    display: flex; align-items: center; gap: 10px; padding: 14px 18px;
    border-radius: 12px; margin-bottom: 20px; font-weight: 600;
    animation: sa-fade-down 0.45s var(--ease-out-soft) both;
}
.alert-error   { background: color-mix(in srgb, #ef4444 12%, transparent); color: #dc2626; }
.alert-success { background: color-mix(in srgb, #16a34a 12%, transparent); color: #15803d; }
.alert-info    { background: color-mix(in srgb, #3b82f6 12%, transparent); color: #2563eb; }

/* ==========================================================================
   25) صفحة الكتب / السلة الجانبية
   ========================================================================== */
.books-banner-sub { opacity: 0.85; margin-top: 8px; font-size: 16px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.filter-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.filter-check input { accent-color: var(--accent); width: 17px; height: 17px; }
.books-categories-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.books-chip { padding: 9px 18px; font-size: 14px; border-radius: 99px; }

/* عناصر السلة الجانبية */
.side-cart-item {
    display: flex; gap: 14px; align-items: flex-start;
    padding-bottom: 15px; margin-bottom: 15px; border-bottom: 1px solid var(--border);
    animation: sa-fade-side 0.45s var(--ease-out-soft) both;
}
.sci-cover { width: 60px; height: 80px; border-radius: 8px; overflow: hidden; background: var(--bg-color); flex: 0 0 auto; }
.sci-cover img { width: 100%; height: 100%; object-fit: cover; }
.sci-fallback {
    width: 100%; height: 100%; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
}
.sci-body { flex: 1; min-width: 0; }
.sci-title { font-size: 14px; font-weight: 700; color: var(--text); display: block; margin-bottom: 5px; line-height: 1.5; }
.sci-title:hover { color: var(--accent); }
.sci-qty { font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.sci-price { font-weight: 800; color: var(--accent); }
.sci-remove {
    background: none; border: 0; color: #ef4444; cursor: pointer; padding: 6px;
    border-radius: 8px; transition: transform 0.25s var(--ease-out-back), background 0.25s;
}
.sci-remove:hover { background: color-mix(in srgb, #ef4444 12%, transparent); transform: scale(1.15) rotate(-8deg); }
.side-cart-total {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 18px; font-weight: 800; padding: 16px 0; border-top: 2px solid var(--border);
}
.side-cart-total strong { color: var(--accent); font-size: 21px; }

/* شريط الشحن المجاني */
.free-ship-hint {
    background: var(--bg-color); border: 1px dashed var(--border);
    border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--text-light); margin-top: 6px;
}
.free-ship-hint i { color: var(--accent); margin-inline-end: 6px; }
.free-ship-hint strong { color: var(--accent); }
.free-ship-hint.is-done { border-style: solid; border-color: #16a34a; color: #16a34a; }
.free-ship-hint.is-done i { color: #16a34a; }
.free-ship-bar { height: 6px; background: var(--border); border-radius: 99px; margin-top: 10px; overflow: hidden; }
.free-ship-bar span {
    display: block; height: 100%; border-radius: 99px;
    background: linear-gradient(90deg, var(--accent), #f1c40f);
    transition: width 0.7s var(--ease-out-soft);
}

/* نظرة سريعة — تفاصيل */
.qv-author i { color: var(--accent); margin-inline-end: 6px; }
.qv-author a:hover { color: var(--accent); }
.qv-out { color: #ef4444 !important; border-color: #ef4444 !important; }
.qv-notify { display: flex; gap: 8px; flex-wrap: wrap; }
.qv-notify input {
    padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--bg-color); color: var(--text); font-family: inherit; min-width: 220px;
}

/* ==========================================================================
   دار السحاب — أشكال ثلاثية الأبعاد وفيكتورات عائمة (3D Floating Shapes & Vectors)
   ========================================================================== */

/* كبسولة الأشكال ثلاثية الأبعاد العائمة */
.floating-3d-canvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.shape-3d {
    position: absolute;
    transform-style: preserve-3d;
    will-change: transform;
    pointer-events: none;
}

/* كرة زجاجية ثلاثية الأبعاد مع انعكاسات ضوئية */
.shape-3d--orb {
    border-radius: 50%;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 
        inset -8px -8px 24px rgba(0, 0, 0, 0.5),
        inset 8px 8px 24px rgba(255, 255, 255, 0.4),
        0 18px 45px rgba(0, 0, 0, 0.45);
}

.shape-3d--orb-gold {
    width: 68px;
    height: 68px;
    top: 15%;
    inset-inline-start: 6%;
    background: radial-gradient(circle at 32% 32%, rgba(255, 235, 175, 0.85) 0%, rgba(232, 161, 58, 0.55) 45%, rgba(184, 107, 23, 0.3) 85%);
    border: 1px solid rgba(255, 230, 160, 0.45);
    animation: float-3d-orb 8s ease-in-out infinite alternate;
}

.shape-3d--orb-dusk {
    width: 90px;
    height: 90px;
    bottom: 12%;
    inset-inline-end: 8%;
    background: radial-gradient(circle at 35% 30%, rgba(190, 165, 255, 0.75) 0%, rgba(90, 74, 140, 0.5) 48%, rgba(20, 15, 45, 0.35) 90%);
    border: 1px solid rgba(210, 190, 255, 0.35);
    animation: float-3d-orb 11s ease-in-out infinite alternate-reverse;
}

.shape-3d--orb-teal {
    width: 48px;
    height: 48px;
    top: 45%;
    inset-inline-end: 18%;
    background: radial-gradient(circle at 30% 30%, rgba(140, 245, 230, 0.8) 0%, rgba(30, 160, 150, 0.5) 50%, rgba(10, 50, 60, 0.3) 90%);
    border: 1px solid rgba(160, 255, 240, 0.4);
    animation: float-3d-orb 7s ease-in-out infinite alternate;
}

@keyframes float-3d-orb {
    0% {
        transform: perspective(800px) translateY(0) rotateX(0deg) rotateY(0deg);
    }
    50% {
        transform: perspective(800px) translateY(-22px) rotateX(15deg) rotateY(20deg) scale(1.05);
    }
    100% {
        transform: perspective(800px) translateY(8px) rotateX(-10deg) rotateY(-15deg) scale(0.96);
    }
}

/* حلقة ذهبية ثلاثية الأبعاد تدور في الفضاء (3D Torus Ring) */
.shape-3d--torus {
    width: 130px;
    height: 130px;
    top: 25%;
    inset-inline-start: 12%;
    border-radius: 50%;
    border: 7px solid transparent;
    border-top: 7px solid rgba(255, 216, 117, 0.85);
    border-right: 7px solid rgba(232, 161, 58, 0.7);
    border-bottom: 7px solid rgba(210, 85, 58, 0.3);
    border-left: 7px solid rgba(255, 240, 180, 0.5);
    box-shadow: 
        0 0 25px rgba(232, 161, 58, 0.35),
        inset 0 0 15px rgba(255, 216, 117, 0.3);
    transform-origin: center;
    animation: rotate-3d-torus 18s linear infinite;
    filter: drop-shadow(0 15px 25px rgba(0,0,0,0.5));
}

@keyframes rotate-3d-torus {
    0% {
        transform: perspective(900px) rotateX(65deg) rotateY(15deg) rotateZ(0deg);
    }
    100% {
        transform: perspective(900px) rotateX(65deg) rotateY(15deg) rotateZ(360deg);
    }
}

/* بلورة هندسية ثلاثية الأبعاد (3D Gem) */
.shape-3d--gem {
    width: 44px;
    height: 44px;
    top: 65%;
    inset-inline-start: 22%;
    background: linear-gradient(135deg, rgba(255, 216, 117, 0.8), rgba(210, 85, 58, 0.6));
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    box-shadow: 0 0 20px rgba(232, 161, 58, 0.5);
    animation: float-3d-gem 9s ease-in-out infinite alternate;
}

@keyframes float-3d-gem {
    0% {
        transform: perspective(600px) translateY(0) rotateX(20deg) rotateY(0deg) rotateZ(0deg) scale(1);
    }
    50% {
        transform: perspective(600px) translateY(-18px) rotateX(50deg) rotateY(180deg) rotateZ(45deg) scale(1.15);
    }
    100% {
        transform: perspective(600px) translateY(12px) rotateX(20deg) rotateY(360deg) rotateZ(90deg) scale(0.9);
    }
}

/* نجوم فيكتور رباعية لامعة (Sparkle Stars) */
.shape-3d--sparkle {
    position: absolute;
    color: #ffd875;
    font-size: 18px;
    animation: sparkle-pulse 3.5s ease-in-out infinite;
    text-shadow: 0 0 12px rgba(255, 216, 117, 0.8);
}
.shape-3d--sparkle-1 { top: 18%; inset-inline-end: 25%; font-size: 24px; animation-delay: 0s; }
.shape-3d--sparkle-2 { bottom: 28%; inset-inline-start: 16%; font-size: 16px; animation-delay: 1.2s; }
.shape-3d--sparkle-3 { top: 58%; inset-inline-end: 12%; font-size: 20px; animation-delay: 2.1s; }

@keyframes sparkle-pulse {
    0%, 100% { opacity: 0.25; transform: scale(0.8) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.3) rotate(45deg); filter: drop-shadow(0 0 10px #ffd875); }
}

/* وهج إشعاعي ثلاثي الأبعاد خلف كتاب الهيرو */
.stage-ambient-glow {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232, 161, 58, 0.35) 0%, rgba(210, 85, 58, 0.2) 40%, transparent 75%);
    filter: blur(40px);
    pointer-events: none;
    z-index: 1;
    animation: ambient-breathe 6s ease-in-out infinite alternate;
}

@keyframes ambient-breathe {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.6; }
    100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.95; }
}

/* شريط استكشاف المزاج والقراءة التفاعلي (Interactive Mood & Vibe Bar) */
.mood-navigator-wrap {
    margin-top: -30px;
    margin-bottom: 45px;
    position: relative;
    z-index: 10;
}

.mood-navigator {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
    padding: 12px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: 0 18px 40px -15px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    scrollbar-width: none;
}
.mood-navigator::-webkit-scrollbar { display: none; }

.mood-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none !important;
    white-space: nowrap;
    background: var(--bg-color);
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.mood-pill-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.mood-pill:hover {
    transform: translateY(-3px) scale(1.03);
    color: #fff !important;
    box-shadow: 0 8px 22px -4px rgba(0, 0, 0, 0.25);
}

.mood-pill:hover .mood-pill-icon {
    transform: scale(1.25) rotate(10deg);
}

/* ألوان حيوية لكل كبسولة مزاج */
.mood-pill--mystery:hover { background: linear-gradient(135deg, #1e1b4b, #4338ca); border-color: #6366f1; }
.mood-pill--history:hover { background: linear-gradient(135deg, #78350f, #d97706); border-color: #f59e0b; }
.mood-pill--philosophy:hover { background: linear-gradient(135deg, #311042, #7c3aed); border-color: #a855f7; }
.mood-pill--growth:hover { background: linear-gradient(135deg, #064e3b, #059669); border-color: #10b981; }
.mood-pill--literature:hover { background: linear-gradient(135deg, #881337, #e11d48); border-color: #f43f5e; }
.mood-pill--kids:hover { background: linear-gradient(135deg, #0369a1, #0284c7); border-color: #38bdf8; }

@media (prefers-reduced-motion: reduce) {
    .shape-3d,
    .shape-3d--orb,
    .shape-3d--torus,
    .shape-3d--gem,
    .shape-3d--sparkle,
    .stage-ambient-glow {
        animation: none !important;
    }
}

