/*
Theme Name: Bahr Next
Theme URI: https://tawfirbahr.com/
Description: قالب وفر فلوسك مع بحر: عروض وكوبونات بواجهة عربية RTL. نسخة للتجربة على موقع تجريبي.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: bahr-next
*/

:root {
	--navy: #0b2a4a;
	--navy-2: #14406b;
	--gold: #f2b705;
	--gold-dk: #7a5a00;
	--ink: #0f2238;
	--muted: #566579;
	--line: #dfe5ec;
	--bg: #f3f6fa;
	--card: #ffffff;
	--off: #c8372d;
	--ok: #0d6b4f;
	--font: "Tajawal", "Noto Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.7 var(--font); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.35; margin: 0; }
h2 { font-size: 20px; margin-block-end: 12px; }
p { margin: 0 0 12px; }

.wrap { width: 100%; max-width: 1140px; margin-inline: auto; padding-inline: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 8px; inset-block-start: -60px; background: var(--gold); color: var(--ink); padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip:focus { inset-block-start: 8px; }
.hp { position: absolute; inset-inline-start: -9999px; }

/* الرأس */
.site-header { background: var(--navy); color: #fff; position: sticky; inset-block-start: 0; z-index: 20; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; }
.brand { color: #fff; font-size: 20px; font-weight: 500; }
.brand span { color: var(--gold); }
.brand:hover { text-decoration: none; }
.brand img { max-height: 40px; width: auto; }
.tg { background: var(--gold); color: var(--ink); font-weight: 500; font-size: 14px; padding: 6px 14px; border-radius: 8px; white-space: nowrap; }
.tg:hover { text-decoration: none; filter: brightness(.95); }
.nav { padding-block-end: 8px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.menu { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.menu li { flex: none; }
.menu a { display: block; color: #dbe6f2; font-size: 14px; padding: 4px 12px; border-radius: 16px; }
.menu a:hover, .menu .current-menu-item a { background: var(--navy-2); color: #fff; text-decoration: none; }

/* البطل */
.hero { background: var(--navy); color: #fff; padding-block: 28px 0; position: relative; }
.hero h1 { font-size: 30px; font-weight: 500; }
.hero p { color: #c3d3e4; margin-block: 6px 16px; max-width: 46ch; }
.search { display: flex; gap: 8px; max-width: 620px; }
.search input { flex: 1; min-width: 0; font: inherit; padding: 11px 14px; border: 0; border-radius: 8px; background: #fff; color: var(--ink); }
.search button, .news button { font: inherit; font-weight: 500; border: 0; border-radius: 8px; padding: 0 20px; background: var(--gold); color: var(--ink); cursor: pointer; }
.hero .chips { margin-block: 14px 0; }
.wave { display: block; width: 100%; height: 36px; margin-block-start: 22px; fill: var(--bg); }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips--wrap { flex-wrap: wrap; overflow: visible; }
.chip { flex: none; font-size: 14px; padding: 4px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.hero .chip { background: transparent; color: #fff; border-color: #3d6590; }
.chip:hover { text-decoration: none; border-color: var(--navy-2); }

/* البنرات */
.banners { margin-block-start: 8px; }
.track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; scrollbar-width: none; border-radius: 12px; }
.track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: start; }
.slide img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; border-radius: 12px; }

.block { margin-block: 28px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-block-end: 12px; }
.head-row h2 { margin: 0; }

/* المتاجر */
.stores { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.store { display: flex; flex-direction: column; gap: 2px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-inline-start: 4px solid var(--gold); border-radius: 8px; color: var(--ink); }
.store:hover { text-decoration: none; border-color: var(--navy-2); }
.store span { font-size: 13px; color: var(--muted); }

/* البطاقات */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.card-img { background: #fff; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; padding: 8px; }
.card-img img { width: 100%; height: 100%; object-fit: contain; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-title { font-size: 14px; font-weight: 500; }
.card-title a { color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.card .btn { margin-block-start: auto; }

.badges { display: flex; gap: 6px; flex-wrap: wrap; min-height: 22px; }
.bd { font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 4px; }
.bd-store { background: #fff3c4; color: var(--gold-dk); }
.bd-off { background: var(--off); color: #fff; }

.price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price strong { font-size: 17px; font-weight: 500; }
.price s { color: var(--muted); font-size: 13px; }
.price--lg strong { font-size: 28px; }
.save { color: var(--ok); font-size: 13px; font-weight: 500; }
.when { color: var(--muted); font-size: 12px; }

.btn { display: block; text-align: center; background: var(--gold); color: var(--ink); font-weight: 500; font-size: 14px; padding: 9px 14px; border-radius: 8px; border: 0; }
.btn:hover { text-decoration: none; filter: brightness(.95); }
.btn-ghost { background: transparent; border: 1px solid var(--navy-2); color: var(--navy-2); }
.btn--lg { font-size: 17px; padding: 13px 18px; }

/* صيدة اليوم */
.deal { display: grid; grid-template-columns: 110px 1fr; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; align-items: center; }
.deal-img img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; }
.deal-body { display: flex; flex-direction: column; gap: 6px; }
.deal h3 { font-size: 16px; font-weight: 500; }
.deal h3 a { color: var(--ink); }
.deal .btn { align-self: flex-start; }

/* الكوبونات */
.coupons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.coupon { display: flex; flex-direction: column; gap: 4px; padding: 12px; background: var(--card); border: 1px dashed var(--navy-2); border-radius: 8px; color: var(--ink); }
.coupon:hover { text-decoration: none; background: #fffbea; }
.coupon-store { font-weight: 500; }
.coupon-code { font: 500 18px/1.2 ui-monospace, Menlo, Consolas, monospace; direction: ltr; text-align: start; color: var(--navy); }
.coupon-cta { font-size: 12px; color: var(--muted); }
.coupons--compact { margin-block-end: 14px; }
.coupons--compact .coupon { background: transparent; border-color: #3d6590; color: #fff; padding: 8px 10px; }
.coupons--compact .coupon-code { font-size: 15px; color: var(--gold); }
.coupons--compact .coupon-cta { display: none; }

/* النشرة */
.news { background: var(--navy); color: #fff; border-radius: 12px; padding: 20px 16px; }
.news p { color: #c3d3e4; }
.news h2 { margin-block-end: 4px; }
.news-row { display: flex; gap: 8px; max-width: 520px; }
.news-row input[type=email] { flex: 1; min-width: 0; font: inherit; padding: 10px 14px; border: 0; border-radius: 8px; }
.news-row button { padding-block: 10px; }

/* التذييل */
.site-footer { background: var(--navy); color: #c3d3e4; padding-block: 24px; margin-block-start: 32px; }
.foot-nav .menu { flex-wrap: wrap; }
.foot-nav .menu a { color: #fff; }
.disclosure { font-size: 12px; color: var(--muted); margin-block: 12px 0; }
.site-footer .disclosure { color: #9fb4ca; }
.copy { font-size: 12px; margin: 8px 0 0; }

/* الأرشيف */
.page-title { font-size: 24px; font-weight: 500; margin-block-end: 14px; }
.lead { color: var(--muted); margin-block-end: 14px; }
.pager { margin-block-start: 20px; }
.pager .nav-links { display: flex; gap: 6px; flex-wrap: wrap; }
.pager .page-numbers { padding: 4px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
.pager .current { background: var(--navy); color: #fff; border-color: var(--navy); }
.empty { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.empty .btn { display: inline-block; margin-block-start: 8px; }

/* صفحة المنتج */
.single { padding-block: 20px 40px; }
.single h1 { font-size: 24px; font-weight: 500; margin-block: 8px; }
.pdp { display: grid; gap: 18px; }
.pdp-img { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.pdp-img img { width: 100%; max-height: 420px; object-fit: contain; margin-inline: auto; }
.pdp-info { display: flex; flex-direction: column; gap: 8px; }
.history { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; color: var(--navy-2); }
.chart { width: 100%; height: 80px; display: block; }
.hist-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-block-start: 6px; }
.entry { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; max-width: 76ch; overflow-wrap: anywhere; }
.is-article .entry { margin-block-start: 14px; }

.buybar { position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: #fff; border-block-start: 1px solid var(--line); }
.buybar strong { font-weight: 500; white-space: nowrap; }
.buybar .btn { flex: 1; }
.is-product { padding-block-end: 90px; }

@media (min-width: 640px) {
	.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.hero h1 { font-size: 38px; }
	.deal { grid-template-columns: 180px 1fr; padding: 16px; }
}
@media (min-width: 900px) {
	.grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
	.stores, .coupons { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.coupons--compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.pdp { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 28px; align-items: start; }
	.buybar { display: none; }
	.is-product { padding-block-end: 40px; }
}
@media (prefers-reduced-motion: reduce) {
	* { scroll-behavior: auto !important; transition: none !important; }
}
