/* ════════════════════════════════════════════════════════════
   WAAD — Ebook Options, Library & PWA  (v3.0 — Refined)
═══════════════════════════════════════════════════════════════ */

/* ─── 1. PURCHASE OPTIONS (waad-buy block) ─────────────────── */
.waad-buy {
	width: 100%;
	margin: 0 0 16px;
	direction: rtl;
}

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

.waad-buy__opt {
	position: relative;
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 10px;
	padding: 16px;
	border: 1.5px solid rgba(17,39,74,.10);
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 4px 16px rgba(17,39,74,.05);
	transition: border-color .2s, box-shadow .2s, transform .2s;
}

.waad-buy__opt:hover {
	border-color: rgba(196,154,70,.55);
	box-shadow: 0 8px 28px rgba(17,39,74,.09);
	transform: translateY(-1px);
}

.waad-buy__opt--paper { border-right: 4px solid #11274a; }
.waad-buy__opt--ebook { border-right: 4px solid #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 9px;
	border-radius: 999px;
	background: #16a34a;
	color: #fff;
	font-size: 11px;
	font-weight: 800;
}

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

.waad-buy__opt-icon {
	width: 46px; height: 46px;
	flex: 0 0 46px;
	display: inline-flex; align-items: center; justify-content: center;
	border-radius: 14px;
	background: #f7f3eb;
	color: #11274a;
	transition: background .2s;
}
.waad-buy__opt--ebook .waad-buy__opt-icon { background: rgba(196,154,70,.12); color: #c49a46; }
.waad-buy__opt--read  .waad-buy__opt-icon { background: rgba(22,163,74,.10);  color: #15803d; }

.waad-buy__opt-name {
	font-size: 14.5px;
	font-weight: 900;
	color: #11274a;
	line-height: 1.3;
}
.waad-buy__opt-price {
	margin-top: 3px;
	font-size: 13px;
	font-weight: 700;
	color: #6b7280;
}

/* Buttons */
.waad-buy__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	min-height: 40px;
	padding: 9px 16px;
	border-radius: 999px;
	border: 1.5px solid transparent;
	text-decoration: none !important;
	cursor: pointer;
	font-size: 13px;
	font-weight: 900;
	line-height: 1.2;
	white-space: nowrap;
	flex-shrink: 0;
	transition: transform .18s, box-shadow .18s, background .18s, filter .18s;
}
.waad-buy__btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(17,39,74,.13); }

.waad-buy__btn--solid   { background: #11274a; color: #fff !important; }
.waad-buy__btn--gold    { background: linear-gradient(135deg, #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: #11274a !important; border-color: rgba(17,39,74,.22); }
.waad-buy__btn--disabled {
	background: #f3f4f6; color: #9ca3af !important; border-color: #e5e7eb;
	cursor: not-allowed; box-shadow: none !important; transform: none !important;
}

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

.waad-buy__preview-bar {
	margin-top: 12px;
	padding: 11px 14px;
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	border-radius: 12px;
	background: rgba(196,154,70,.08);
	border: 1px solid rgba(196,154,70,.22);
	color: #11274a; font-size: 13px; font-weight: 800;
}
.waad-buy__preview-text { flex: 1; }
.waad-buy__preview-link {
	white-space: nowrap; color: #11274a !important;
	text-decoration: underline; text-underline-offset: 3px; font-weight: 900;
}

/* ─── 2. EXPANDED OPTION CARDS (waad-options block) ────────── */
.waad-options {
	margin: 26px 0 30px;
	padding: 24px;
	background: linear-gradient(180deg, #fdfaf4 0%, #f7f3eb 100%);
	border: 1px solid #ede6d8;
	border-radius: 18px;
	position: relative;
}

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

.waad-options__head { margin-bottom: 20px; text-align: center; }
.waad-options__eyebrow {
	display: inline-block; font-size: 11px; font-weight: 700; color: #c49a46;
	text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 6px;
}
.waad-options__title { font-size: 1.05rem; font-weight: 800; color: #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 #ede6d8;
	border-radius: 14px;
	padding: 20px 18px;
	transition: border-color .22s, transform .22s, box-shadow .22s;
	position: relative; overflow: hidden;
}
.waad-opt:hover { border-color: #c49a46; transform: translateY(-3px); box-shadow: 0 12px 28px rgba(17,39,74,.09); }

.waad-opt--paper { border-top: 3px solid #11274a; }
.waad-opt--ebook { border-top: 3px solid #c49a46; }
.waad-opt--read  { border-top: 3px solid #16a34a; }

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

.waad-opt__icon {
	width: 52px; height: 52px; border-radius: 14px;
	background: #f7f3eb; color: #11274a;
	display: flex; align-items: center; justify-content: center;
	margin-bottom: 14px;
	transition: background .2s;
}
.waad-opt--ebook .waad-opt__icon { background: rgba(196,154,70,.12); color: #c49a46; }
.waad-opt--read  .waad-opt__icon { background: rgba(22,163,74,.10);  color: #15803d; }

.waad-opt__info { flex: 1; margin-bottom: 16px; }
.waad-opt__title { font-size: 1rem; font-weight: 800; color: #11274a; margin: 0 0 7px; }
.waad-opt__desc  { font-size: .82rem; color: #526070; line-height: 1.6; margin: 0 0 12px; }
.waad-opt__price { font-size: 1.05rem; font-weight: 800; color: #11274a; }
.waad-opt__price--free { color: #16a34a; }
.waad-opt__price del { font-size: .85rem; color: #9ca3af; margin-left: 6px; font-weight: 400; }

.waad-opt__btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 12px 16px; background: #11274a; color: #fff;
	border: 0; border-radius: 10px; font-size: .9rem; font-weight: 700;
	text-decoration: none; cursor: pointer; width: 100%;
	transition: background .2s, transform .18s;
}
.waad-opt__btn:hover:not(:disabled) { background: #0b1c35; color: #fff; transform: scale(1.02); }
.waad-opt--ebook .waad-opt__btn { background: linear-gradient(135deg, #c49a46, #d9b96a); color: #14213d; }
.waad-opt--ebook .waad-opt__btn:hover { filter: brightness(.95); }
.waad-opt__btn--ghost { background: transparent; color: #11274a; border: 1.5px solid #11274a; }
.waad-opt__btn--ghost:hover:not(:disabled) { background: #11274a; color: #fff; }
.waad-opt__btn--owned { background: linear-gradient(135deg, #16a34a, #22c55e); color: #fff; }
.waad-opt__btn:disabled { opacity: .45; cursor: not-allowed; }

.waad-options__note {
	margin-top: 16px; padding: 11px 14px;
	background: rgba(196,154,70,.07); border-right: 3px solid #c49a46; border-radius: 8px;
	font-size: .82rem; color: #374151;
	display: flex; align-items: center; gap: 8px;
}
.waad-options__note a { color: #11274a; font-weight: 700; text-decoration: underline; }

/* ─── 3. MY LIBRARY ─────────────────────────────────────────── */
.waad-library { max-width: 1200px; margin: 30px auto; padding: 26px 18px; }

.waad-library__head {
	text-align: center; margin-bottom: 32px; padding-bottom: 22px;
	border-bottom: 1px solid #ede6d8;
}
.waad-library__head h2 { font-size: 1.65rem; color: #11274a; margin: 0 0 7px; }
.waad-library__head p  { color: #526070; margin: 0; }

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

.waad-lib-card {
	background: #fff; border-radius: 14px; overflow: hidden;
	box-shadow: 0 4px 14px rgba(17,39,74,.07);
	border: 1px solid #f0ebe2;
	transition: transform .22s, box-shadow .22s;
}
.waad-lib-card:hover { transform: translateY(-5px); box-shadow: 0 14px 32px rgba(17,39,74,.12); }

.waad-lib-card__cover {
	display: block; position: relative; aspect-ratio: 2/3; overflow: hidden; background: #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, transparent 30%, rgba(11,28,53,.88) 100%);
	display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
	padding: 20px; color: #fff; font-weight: 700; gap: 5px;
	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: 800; color: #11274a; margin: 0 0 5px; 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: #526070; }

.waad-library__empty {
	text-align: center; padding: 60px 24px;
	background: #fdfaf4; border-radius: 18px;
	border: 1px dashed #ede6d8; color: #526070;
}
.waad-library__empty svg { color: #c49a46; margin-bottom: 16px; }
.waad-library__empty h3 { font-size: 1.2rem; color: #11274a; margin: 0 0 8px; }
.waad-library__cta {
	display: inline-block; margin-top: 18px; padding: 12px 26px;
	background: #11274a; color: #fff; border-radius: 10px;
	text-decoration: none; font-weight: 700; transition: background .2s;
}
.waad-library__cta:hover { background: #0b1c35; color: #fff; }

.waad-library--login {
	text-align: center; padding: 44px; background: #fdfaf4; border-radius: 14px; border: 1px solid #ede6d8;
}

/* ─── 4. PWA INSTALL BUTTON ─────────────────────────────────── */
.waad-pwa-install {
	position: fixed; bottom: 22px; left: 22px; z-index: 9999;
	display: none; align-items: center; gap: 10px;
	padding: 13px 20px;
	background: #11274a; color: #fff;
	border: 0; border-radius: 999px;
	box-shadow: 0 8px 28px rgba(17,39,74,.28);
	font-weight: 700; font-size: .9rem; cursor: pointer;
	transition: transform .2s, box-shadow .2s;
	font-family: inherit;
}
.waad-pwa-install.is-visible { display: inline-flex; }
.waad-pwa-install:hover { transform: scale(1.04); box-shadow: 0 12px 36px rgba(17,39,74,.35); }
.waad-pwa-install__close {
	background: rgba(255,255,255,.18); 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: -5px; flex-shrink: 0;
	transition: background .18s;
}
.waad-pwa-install__close:hover { background: rgba(255,255,255,.32); }

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

/* ─── 5. RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 760px) {
	.waad-options { padding: 18px; }
	.waad-options__grid { grid-template-columns: 1fr; gap: 10px; }
}

@media (max-width: 560px) {
	.waad-buy__opt { grid-template-columns: 1fr; gap: 12px; }
}

/* ─── 6. APP MODE ────────────────────────────────────────────── */
body.waad-app-mode { padding-bottom: env(safe-area-inset-bottom, 0); }
body.waad-app-mode .waad-pwa-install { display: none !important; }
