@import url('assets/ewan/tools/demo/assets/cairo/cairo-fonts.css');
:root { --navy:#0a1b33; --navy2:#10284a; --navy3:#183761; --gold:#c8a04a; --gold2:#d9b766; --gold-deep:#9c7a2e; --ink:#16202e; --soft:#5b6a80; --line:#e3e6ec; --bg:#f3f5f8; --card:#fff; --ok:#1f9d6b; --warn:#c77d12; --bad:#c0392b; --r:16px; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { font-family: Cairo, 'Segoe UI', Tahoma, sans-serif; font-weight: 700; color: var(--ink); background: var(--bg); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hide { display: none !important; }
.ico { width: 18px; height: 18px; flex: none; }

/* الشريط العلوي */
.top { position: sticky; top: 0; z-index: 20; background: rgba(10,27,51,.96); backdrop-filter: blur(10px); color: #fff; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); padding-top: max(10px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(217,183,102,.25); }
.logo { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(150deg, var(--gold2), var(--gold)); color: var(--navy); display: grid; place-items: center; font: 900 22px 'Segoe UI', sans-serif; box-shadow: 0 4px 12px rgba(0,0,0,.3); flex: none; text-decoration: none; }
.brand { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand b { font-size: 17px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { color: var(--gold2); font-size: 11px; }
.top .grow { flex: 1; }
.icon-btn { border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.07); color: #fff; height: 38px; min-width: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 11px; font-size: 13px; text-decoration: none; }
.icon-btn:hover { background: rgba(255,255,255,.14); }
.icon-btn.gold { background: linear-gradient(150deg, var(--gold2), var(--gold)); border-color: var(--gold); color: var(--navy); }

/* البطل والبحث */
.hero { background: radial-gradient(120% 140% at 85% 0%, #24497f 0%, var(--navy2) 45%, var(--navy) 100%); color: #fff; padding: 34px 18px 64px; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 10% 110%, rgba(200,160,74,.28), transparent 45%); }
.hero::after { content: ''; position: absolute; width: 460px; height: 460px; border-radius: 50%; border: 1.5px solid rgba(217,183,102,.22); top: -210px; left: -120px; box-shadow: 0 0 0 60px rgba(217,183,102,.04), 0 0 0 130px rgba(217,183,102,.03); }
.hero-in { max-width: 980px; margin: 0 auto; position: relative; z-index: 1; }
.eyebrow { color: var(--gold2); font-size: 13px; font-weight: 800; }
.hero h1 { font-size: clamp(26px, 5vw, 40px); font-weight: 900; margin: 4px 0 6px; line-height: 1.3; }
.hero p { color: #cfd9e8; margin: 0 0 22px; font-size: 15px; max-width: 620px; }
.searchbox { position: relative; max-width: 640px; }
.searchbox input { width: 100%; height: 54px; border-radius: 16px; border: 1px solid rgba(255,255,255,.2); background: #fff; color: var(--ink); padding: 0 52px 0 46px; font-size: 16px; outline: none; box-shadow: 0 14px 34px rgba(0,0,0,.28); }
.searchbox input:focus { box-shadow: 0 0 0 4px rgba(217,183,102,.45), 0 14px 34px rgba(0,0,0,.28); }
.searchbox .ico { position: absolute; top: 18px; right: 18px; color: var(--gold-deep); }
.searchbox .clear { position: absolute; top: 11px; left: 10px; width: 32px; height: 32px; border: 0; border-radius: 10px; background: var(--bg); color: var(--soft); }

/* المحتوى */
.wrap { max-width: 1080px; margin: -36px auto 0; padding: 0 16px 60px; position: relative; z-index: 2; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; color: var(--soft); border-radius: 99px; padding: 8px 16px; font-size: 13.5px; font-weight: 800; box-shadow: 0 4px 14px rgba(10,27,51,.06); }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip em { font-style: normal; color: var(--gold); margin-inline-start: 4px; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 900; color: var(--navy); margin: 18px 4px 12px; }
.section-title::before { content: ''; width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg); }
.section-title small { color: var(--soft); font-size: 12px; font-weight: 700; margin-inline-start: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card { background: var(--card); border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(10,27,51,.06); display: flex; flex-direction: column; transition: transform .18s, box-shadow .18s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(10,27,51,.14); }
.thumb { position: relative; aspect-ratio: 210 / 297; overflow: hidden; background: linear-gradient(150deg, var(--navy2), var(--navy)); display: block; }
.thumb img { width: 100%; display: block; transition: transform .35s; }
.card:hover .thumb img { transform: scale(1.04); }
.thumb .badge { position: absolute; top: 10px; right: 10px; background: rgba(10,27,51,.82); color: var(--gold2); font-size: 11px; border-radius: 99px; padding: 2px 10px; backdrop-filter: blur(4px); }
.thumb .badge.hidden-b { right: auto; left: 10px; background: var(--bad); color: #fff; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card h3 { margin: 0; font-size: 15.5px; font-weight: 900; color: var(--navy); line-height: 1.45; }
.card p { margin: 0; color: var(--soft); font-size: 12.5px; font-weight: 600; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; gap: 10px; font-size: 11.5px; color: #8b96a8; margin-top: 2px; flex-wrap: wrap; }
.actions { display: flex; gap: 6px; margin-top: auto; padding-top: 10px; }
.btn { white-space: nowrap; border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 11px; height: 38px; padding: 0 12px; font-size: 13px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; transition: .15s; }
.btn:hover { border-color: var(--gold); background: #fffaf0; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; flex: 1; }
.btn.primary:hover { background: var(--navy3); }
.btn.gold { background: linear-gradient(150deg, var(--gold2), var(--gold)); border-color: var(--gold); color: var(--navy); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.snippet { background: #fffaf0; border: 1px solid #f1e5c6; border-radius: 10px; padding: 6px 9px; font-size: 12px; color: #6b5a33; line-height: 1.8; margin-top: 4px; font-weight: 600; }
.snippet mark { background: var(--gold2); color: var(--navy); border-radius: 3px; padding: 0 2px; }
.empty { text-align: center; padding: 50px 10px; color: var(--soft); }
.empty b { display: block; color: var(--navy); font-size: 18px; margin-bottom: 4px; }
.skel { background: linear-gradient(90deg, #e9edf2 0%, #f5f7fa 50%, #e9edf2 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r); height: 300px; }
@keyframes sk { to { background-position: -200% 0; } }

footer { text-align: center; color: var(--soft); font-size: 12.5px; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
footer a { color: var(--navy); text-decoration: none; font-weight: 800; }

/* لوحة التثبيت والإشعارات */
.sheet-bg { position: fixed; inset: 0; background: rgba(10,27,51,.5); z-index: 40; display: none; align-items: flex-end; justify-content: center; }
.sheet-bg.on { display: flex; }
.sheet-card { background: #fff; width: min(520px, 100%); border-radius: 22px 22px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0,0,0,.25); }
@media (min-width: 600px) { .sheet-bg { align-items: center; } .sheet-card { border-radius: 22px; } }
.sheet-card h3 { margin: 0 0 8px; color: var(--navy); font-weight: 900; }
.sheet-card ol { margin: 0 0 14px; padding-inline-start: 20px; color: var(--soft); line-height: 2; font-weight: 600; }
.toast { position: fixed; bottom: calc(22px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%) translateY(30px); opacity: 0; background: var(--navy); color: #fff; border-radius: 14px; padding: 11px 18px; font-size: 13.5px; box-shadow: 0 12px 30px rgba(10,27,51,.35); transition: .25s; z-index: 60; border: 1px solid rgba(217,183,102,.4); pointer-events: none; max-width: 90vw; text-align: center; }
.toast.on { opacity: 1; transform: translateX(-50%); }
.toast.bad { background: var(--bad); }

/* العارض */
.viewer-body { background: #d9dee6; }
.viewer-stage { padding: 14px 0 90px; }
.viewer-stage iframe { border: 0; display: block; margin: 0 auto; width: 860px; background: transparent; }
.viewer-load { position: fixed; inset: 60px 0 0; display: grid; place-items: center; color: var(--navy); z-index: 5; }
.spin { width: 36px; height: 36px; border: 3px solid #c9d0db; border-top-color: var(--gold); border-radius: 50%; animation: s .8s linear infinite; margin: 0 auto 10px; }
@keyframes s { to { transform: rotate(360deg); } }
.dock { position: fixed; bottom: calc(14px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; background: rgba(10,27,51,.94); padding: 6px; border-radius: 16px; box-shadow: 0 14px 34px rgba(10,27,51,.35); z-index: 10; border: 1px solid rgba(217,183,102,.3); }
.dock .btn { border-color: transparent; background: rgba(255,255,255,.08); color: #fff; }
.dock .btn:hover { background: rgba(255,255,255,.16); }
.dock .btn.gold { background: linear-gradient(150deg, var(--gold2), var(--gold)); color: var(--navy); }
.pages-pill { font-size: 12px; color: var(--gold2); padding: 0 8px; display: flex; align-items: center; white-space: nowrap; }
@media (max-width: 520px) { .hide-sm { display: none !important; } .grid { grid-template-columns: 1fr 1fr; gap: 10px; } .card h3 { font-size: 13.5px; } .card p { display: none; } .actions { display: grid; grid-template-columns: 1fr 34px 34px; gap: 5px; } .actions .btn { padding: 0; height: 36px; } .actions .btn span { display: none; } .card-body { padding: 10px; } .meta span:not(:nth-child(2)) { display: none; } .meta { font-size: 11px; } }
@media (max-width: 360px) { .grid { grid-template-columns: 1fr; } }
