/* Lougha Books storefront — built on leads7-base.css tokens. Mobile first. */

[dir="rtl"] { --font-sans: 'IBM Plex Sans Arabic', 'Geist', system-ui, sans-serif; }
[dir="rtl"] .display { font-family: 'IBM Plex Sans Arabic', serif; font-weight: 700; }
.display { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }

body { font-size: 15px; background: var(--bg); }
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border-subtle); }
.topbar .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lougha); box-shadow: 0 0 0 4px var(--lougha-soft); }
.topbar .spacer { flex: 1; }
.topbar select { height: 34px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; padding: 0 8px; }
.topbar .btn { height: 34px; }

/* Hero */
.hero { padding: 40px 0 24px; }
.hero h1 { font-size: clamp(28px, 6vw, 44px); line-height: 1.15; margin: 0 0 10px; }
.hero p { color: var(--text-secondary); font-size: 17px; margin: 0; max-width: 620px; }

/* Grid of books */
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-tertiary); margin: 28px 0 12px; font-weight: 600; }
[dir="rtl"] .section-title { text-transform: none; letter-spacing: 0; font-size: 15px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow-sm); transition: box-shadow var(--motion-normal) var(--ease), transform var(--motion-normal) var(--ease); }
.card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.cover { aspect-ratio: 3 / 4; background: var(--surface-sunken); display: grid; place-items: center; position: relative; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-fallback { width: 100%; height: 100%; display: grid; place-items: center; color: #fff; font-family: var(--font-display); font-size: 44px; font-weight: 700; }
.lvl-A0, .lvl-A1 { background: linear-gradient(160deg, oklch(0.62 0.16 150), oklch(0.48 0.14 170)); }
.lvl-A2, .lvl-B1 { background: linear-gradient(160deg, oklch(0.62 0.17 230), oklch(0.46 0.20 264)); }
.lvl-B2, .lvl-C1, .lvl-C2 { background: linear-gradient(160deg, oklch(0.58 0.20 300), oklch(0.44 0.20 280)); }
.lvl-ALL { background: linear-gradient(160deg, oklch(0.70 0.15 60), oklch(0.55 0.18 30)); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { font-weight: 600; font-size: 16px; color: var(--text); text-decoration: none; }
.card-sub { color: var(--text-secondary); font-size: 13.5px; }
.meta { display: flex; gap: 8px; align-items: center; color: var(--text-tertiary); font-size: 12.5px; }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.price { font-size: 18px; font-weight: 700; color: var(--text); margin-top: auto; padding-top: 6px; }
.card-actions { display: flex; gap: 8px; margin-top: 8px; }
.card-actions .btn { flex: 1; }

/* Book page */
.book { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 32px; padding: 28px 0 40px; }
@media (max-width: 760px) { .book { grid-template-columns: 1fr; gap: 16px; padding-top: 16px; } .book .cover { max-width: 180px; margin-inline: auto; } }
.book .cover { border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.book h1 { font-size: clamp(24px, 5vw, 34px); margin: 0 0 6px; line-height: 1.2; }
.book .desc { color: var(--text-secondary); white-space: pre-line; }
.buybox { margin-top: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.buybox .price { font-size: 26px; padding: 0 0 10px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; margin: 8px 0 12px; color: var(--text-secondary); }
.check input { margin-top: 3px; }
.gift-fields { border-inline-start: 3px solid var(--lougha); padding-inline-start: 12px; margin: 4px 0 12px; }
.note { font-size: 12.5px; color: var(--text-tertiary); margin: 6px 0 0; }
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 14px; margin: 12px 0; }
.alert-warn { background: var(--warning-soft); color: var(--text); }
.alert-err { background: var(--danger-soft); color: var(--text); }
.alert-ok { background: var(--success-soft); color: var(--text); }

/* Panels (thanks, my books, download errors, legal) */
.panel { max-width: 620px; margin: 36px auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.panel h1 { margin: 0 0 8px; font-size: 26px; }
.list { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 10px; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius); background: var(--surface-sunken); }
.legal { white-space: pre-line; color: var(--text-secondary); }

/* WhatsApp floating button */
.wa-float { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 20; display: inline-flex; align-items: center; gap: 8px;
  background: var(--wa); color: #fff; text-decoration: none; padding: 12px 16px; border-radius: var(--radius-pill); box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14px; }
.wa-float:hover { background: var(--wa-dark); }

footer.site { border-top: 1px solid var(--border-subtle); margin-top: 48px; padding: 20px 0 80px; color: var(--text-tertiary); font-size: 13px; }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 16px; }
footer.site a { color: var(--text-secondary); text-decoration: none; }

.spin { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: lbSpin .8s linear infinite; vertical-align: middle; }

/* Links styled as buttons/cards never show the underline. */
a.btn, .card a, .brand { text-decoration: none; }
.brand { white-space: nowrap; }

/* Phone: compact horizontal cards (cover on the side), tighter top bar. */
@media (max-width: 600px) {
  .topbar .wrap { gap: 6px; }
  .brand { font-size: 15px; }
  .topbar .btn { padding: 0 10px; font-size: 13px; }
  .topbar select { padding: 0 4px; }
  .hero { padding: 24px 0 8px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .card { flex-direction: row; }
  .card > a:first-child { flex: 0 0 112px; }
  .card .cover { aspect-ratio: auto; height: 100%; min-height: 150px; }
  .card .cover-fallback { font-size: 30px; }
  .card-body { padding: 12px; gap: 4px; }
  .card-title { font-size: 15px; }
  .price { font-size: 16px; padding-top: 2px; }
  .card-actions { flex-direction: column; gap: 6px; margin-top: 6px; }
  .card-actions .btn { height: 34px; }
}

/* Quiz */
.quiz .q { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 12px; background: var(--surface-sunken); }
.quiz legend { font-weight: 600; font-size: 15px; padding: 0 4px; }
.quiz .opt { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-radius: var(--radius-sm); cursor: pointer; }
.quiz .opt:hover { background: var(--surface-hover); }
.panel .grid { grid-template-columns: 1fr; }

/* Chat widget */
#lbChat { position: fixed; bottom: 18px; inset-inline-start: 18px; z-index: 30; }
.chat-fab { background: var(--accent); color: var(--accent-fg); border: 0; border-radius: var(--radius-pill); padding: 12px 18px; font: inherit; font-weight: 600; box-shadow: var(--shadow-lg); cursor: pointer; }
.chat-fab:hover { background: var(--accent-hover); }
.chat-panel { position: absolute; bottom: 56px; inset-inline-start: 0; width: min(360px, calc(100vw - 36px)); height: min(480px, 70vh); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-sunken); }
.chat-x { border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-secondary); }
.chat-log { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 85%; padding: 8px 12px; border-radius: var(--radius-bubble); white-space: pre-line; font-size: 14px; line-height: 1.45; }
.msg-them { background: var(--surface-sunken); align-self: flex-start; border-end-start-radius: 4px; }
.msg-me { background: var(--accent); color: var(--accent-fg); align-self: flex-end; border-end-end-radius: 4px; }
.msg .btn { margin-top: 6px; height: 30px; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.chat-form .input { padding: 8px 12px; }
