/* ════════════════════════════════════════════════════════════
   WAAD — EBOOK OPTIONS & LIBRARY STYLES
   أنماط خيارات الشراء الثلاثية ومكتبة المستخدم
═══════════════════════════════════════════════════════════════ */

/* ─── 1. PURCHASE OPTIONS BLOCK ─────────────────────────── */
.waad-options {
  margin: 24px 0 28px;
  padding: 22px;
  background: linear-gradient(180deg, var(--cream-lt, #faf7f2) 0%, var(--cream, #f7f3eb) 100%);
  border: 1px solid var(--cream-mid, #ede6d8);
  border-radius: 16px;
  position: relative;
}

.waad-options::before {
  content: "";
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold, #c49a46) 0%, var(--navy, #11274a) 50%, var(--gold, #c49a46) 100%);
  border-radius: 16px 16px 0 0;
}

.waad-options__head {
  margin-bottom: 18px;
  text-align: center;
}

.waad-options__eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold, #c49a46);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.waad-options__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy, #11274a);
  margin: 0;
}

.waad-options__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.waad-opt {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1.5px solid var(--cream-mid, #ede6d8);
  border-radius: 12px;
  padding: 18px 16px;
  transition: all .25s ease;
  position: relative;
  overflow: hidden;
}

.waad-opt:hover {
  border-color: var(--gold, #c49a46);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(17, 39, 74, .08);
}

.waad-opt--paper { border-top: 3px solid var(--navy, #11274a); }
.waad-opt--ebook { border-top: 3px solid var(--gold, #c49a46); }
.waad-opt--read  { border-top: 3px solid var(--gold-lt, #d9b96a); }

.waad-opt--free::after {
  content: "مجاني";
  position: absolute;
  top: 8px;
  left: 8px;
  background: #16a34a;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

.waad-opt__icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--cream, #f7f3eb);
  color: var(--navy, #11274a);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.waad-opt--ebook .waad-opt__icon { background: rgba(196, 154, 70, .12); color: var(--gold, #c49a46); }
.waad-opt--read  .waad-opt__icon { background: rgba(17, 39, 74, .08);   color: var(--navy, #11274a); }

.waad-opt__info { flex: 1; margin-bottom: 14px; }

.waad-opt__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy, #11274a);
  margin: 0 0 6px;
}

.waad-opt__desc {
  font-size: .82rem;
  color: var(--ink-soft, #526070);
  line-height: 1.55;
  margin: 0 0 10px;
}

.waad-opt__price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy, #11274a);
}

.waad-opt__price--free { color: #16a34a; }

.waad-opt__price del {
  font-size: .85rem;
  color: var(--ink-soft, #526070);
  margin-left: 6px;
  font-weight: 400;
}

.waad-opt__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  background: var(--navy, #11274a);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all .2s;
  width: 100%;
}

.waad-opt__btn:hover:not(:disabled) {
  background: var(--navy-deep, #0b1c35);
  color: #fff;
  transform: scale(1.02);
}

.waad-opt--ebook .waad-opt__btn {
  background: linear-gradient(135deg, var(--gold, #c49a46) 0%, var(--gold-lt, #d9b96a) 100%);
}

.waad-opt--ebook .waad-opt__btn:hover {
  filter: brightness(.95);
}

.waad-opt__btn--ghost {
  background: transparent;
  color: var(--navy, #11274a);
  border: 1.5px solid var(--navy, #11274a);
}

.waad-opt__btn--ghost:hover:not(:disabled) {
  background: var(--navy, #11274a);
  color: #fff;
}

.waad-opt__btn--owned {
  background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
}

.waad-opt__btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.waad-options__note {
  margin-top: 14px;
  padding: 10px 14px;
  background: rgba(196, 154, 70, .08);
  border-right: 3px solid var(--gold, #c49a46);
  border-radius: 6px;
  font-size: .82rem;
  color: var(--ink-mid, #374151);
  display: flex;
  align-items: center;
  gap: 8px;
}

.waad-options__note a {
  color: var(--navy, #11274a);
  font-weight: 700;
  text-decoration: underline;
}

/* Mobile */
@media (max-width: 760px) {
  .waad-options { padding: 16px; }
  .waad-options__grid { grid-template-columns: 1fr; gap: 10px; }
  .waad-opt { flex-direction: row; align-items: center; gap: 14px; padding: 14px; }
  .waad-opt__icon { width: 44px; height: 44px; flex-shrink: 0; margin: 0; }
  .waad-opt__info { margin-bottom: 0; }
  .waad-opt__btn { width: auto; flex-shrink: 0; padding: 10px 14px; font-size: .82rem; }
  .waad-opt__desc { display: none; }
}

@media (max-width: 480px) {
  .waad-opt { flex-direction: column; align-items: stretch; }
  .waad-opt__btn { width: 100%; }
}

/* ─── 2. MY LIBRARY (مكتبتي) ────────────────────────────── */
.waad-library {
  max-width: 1200px;
  margin: 30px auto;
  padding: 24px 16px;
}

.waad-library__head {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--cream-mid, #ede6d8);
}

.waad-library__head h2 {
  font-size: 1.6rem;
  color: var(--navy, #11274a);
  margin: 0 0 6px;
}

.waad-library__head p {
  color: var(--ink-soft, #526070);
  margin: 0;
}

.waad-library__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.waad-lib-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(17, 39, 74, .06);
  transition: transform .25s, box-shadow .25s;
}

.waad-lib-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(17, 39, 74, .12);
}

.waad-lib-card__cover {
  display: block;
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--cream, #f7f3eb);
}

.waad-lib-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}

.waad-lib-card:hover .waad-lib-card__cover img { transform: scale(1.05); }

.waad-lib-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 28, 53, 0) 0%, rgba(11, 28, 53, .85) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 20px;
  color: #fff;
  font-weight: 700;
  gap: 6px;
  opacity: 0;
  transition: opacity .25s;
}

.waad-lib-card:hover .waad-lib-card__overlay { opacity: 1; }

.waad-lib-card__body { padding: 14px; }

.waad-lib-card__title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--navy, #11274a);
  margin: 0 0 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.waad-lib-card__title a { color: inherit; text-decoration: none; }

.waad-lib-card__author {
  font-size: .8rem;
  color: var(--ink-soft, #526070);
}

.waad-library__empty {
  text-align: center;
  padding: 60px 20px;
  background: var(--cream-lt, #faf7f2);
  border-radius: 16px;
  color: var(--ink-soft, #526070);
}

.waad-library__empty svg {
  color: var(--gold, #c49a46);
  margin-bottom: 16px;
}

.waad-library__empty h3 {
  font-size: 1.2rem;
  color: var(--navy, #11274a);
  margin: 0 0 8px;
}

.waad-library__cta {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 24px;
  background: var(--navy, #11274a);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: background .2s;
}

.waad-library__cta:hover { background: var(--navy-deep, #0b1c35); color: #fff; }

.waad-library--login {
  text-align: center;
  padding: 40px;
  background: var(--cream-lt, #faf7f2);
  border-radius: 12px;
}

/* ─── 3. PWA INSTALL BUTTON ─────────────────────────────── */
.waad-pwa-install {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--navy, #11274a);
  color: #fff;
  border: 0;
  border-radius: 50px;
  box-shadow: 0 8px 24px rgba(17, 39, 74, .25);
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: transform .2s;
  font-family: inherit;
}

.waad-pwa-install.is-visible { display: inline-flex; }
.waad-pwa-install:hover { transform: scale(1.05); }
.waad-pwa-install__close {
  background: rgba(255, 255, 255, .2);
  border: 0;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  margin-right: -6px;
}

@media (max-width: 600px) {
  .waad-pwa-install { bottom: 14px; left: 14px; right: 14px; justify-content: center; }
}

/* ─── 4. APP MODE TWEAKS (داخل WebView) ─────────────────── */
body.waad-app-mode {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

body.waad-app-mode .waad-pwa-install { display: none !important; }

/* ─── 1b. WAAD BUY BLOCK — current product template ───────── */
.waad-buy {
  width: 100%;
  margin: 0 0 14px;
  padding: 0;
  direction: rtl;
}

.waad-buy__options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.waad-buy__opt {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(6, 27, 63, .12);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(6, 27, 63, .055);
}

.waad-buy__opt--paper { border-right: 4px solid var(--navy, #11274a); }
.waad-buy__opt--ebook { border-right: 4px solid var(--gold, #c49a46); }
.waad-buy__opt--read  { border-right: 4px solid #16a34a; }

.waad-buy__opt.is-free::after {
  content: "مجاني";
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #16a34a;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.waad-buy__opt-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.waad-buy__opt-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: var(--cream, #f7f3eb);
  color: var(--navy, #11274a);
}

.waad-buy__opt--ebook .waad-buy__opt-icon {
  background: rgba(196, 154, 70, .13);
  color: var(--gold, #c49a46);
}

.waad-buy__opt--read .waad-buy__opt-icon {
  background: rgba(22, 163, 74, .10);
  color: #15803d;
}

.waad-buy__opt-name {
  color: var(--navy, #11274a);
  font-weight: 900;
  line-height: 1.35;
}

.waad-buy__opt-price {
  margin-top: 2px;
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}

.waad-buy__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none !important;
  cursor: pointer;
  font-weight: 900;
  line-height: 1.2;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.waad-buy__btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(6, 27, 63, .12);
}

.waad-buy__btn--solid {
  background: var(--navy, #11274a);
  color: #fff !important;
}

.waad-buy__btn--gold {
  background: linear-gradient(135deg, var(--gold, #c49a46), #d9b96a);
  color: #14213d !important;
}

.waad-buy__btn--owned {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff !important;
}

.waad-buy__btn--ghost {
  background: #fff;
  color: var(--navy, #11274a) !important;
  border-color: rgba(6, 27, 63, .22);
}

.waad-buy__btn--disabled {
  background: #f2f4f7;
  color: #98a2b3 !important;
  border-color: #eaecf0;
  cursor: not-allowed;
  box-shadow: none !important;
  transform: none !important;
}

.waad-buy__vat-note {
  margin: 10px 0 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.7;
}

.waad-buy__preview-bar {
  margin-top: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 14px;
  background: rgba(196, 154, 70, .10);
  border: 1px solid rgba(196, 154, 70, .22);
  color: var(--navy, #11274a);
  font-size: 13px;
  font-weight: 800;
}

.waad-buy__preview-text {
  flex: 1;
}

.waad-buy__preview-link {
  white-space: nowrap;
  color: var(--navy, #11274a) !important;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 900;
}

@media (min-width: 960px) {
  .waad-sp__buycard .waad-buy__options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .waad-buy__preview-bar {
    align-items: flex-start;
    flex-direction: column;
  }
}
