/* =====================================================================
   RENG Kitchens — حاسبة تكلفة المطبخ — الأنماط
   الألوان من هوية رِنـق: Deep Ocean, Sky, Clouds, Ivoire, Douche, Gris, Walnut
   ===================================================================== */
:root {
  --c-ocean: #3B5160;
  --c-ocean-deep: #2E4150;
  --c-sky: #A9B5C3;
  --c-sky-20: #E8ECF0;
  --c-clouds: #BCC1C3;
  --c-ivoire: #FAF8F6;
  --c-douche: #DDD6CE;
  --c-gris: #B7B3AC;
  --c-walnut: #6E503E;
  --c-ink: #22303A;
  --c-ink-60: #5C6B75;
  --c-ink-30: #B8C0C6;
  --c-white: #FFFFFF;
  --c-error: #A23B2E;
  --c-error-bg: #FBEDEA;

  --font: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px -14px rgba(34, 48, 58, 0.25);
  --shadow-sm: 0 2px 8px -2px rgba(34, 48, 58, 0.12);
  --gutter: 20px;
  --max: 560px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2,.7,.2,1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--c-ivoire);
  color: var(--c-ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p, figure { margin: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--c-ocean); outline-offset: 3px; border-radius: 6px; }

.app { max-width: var(--max); margin: 0 auto; min-height: 100vh; min-height: 100dvh; background: var(--c-ivoire); }
@media (min-width: 640px) {
  body { background: #EFEBE6; }
  .app { box-shadow: 0 0 0 1px rgba(34,48,58,.06), 0 30px 80px -40px rgba(34,48,58,.4); margin: 24px auto; min-height: auto; border-radius: 28px; overflow: hidden; }
}

/* ---------- العلامة ---------- */
.brand-mark, .brand-small {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; letter-spacing: 0; line-height: 1;
}
.brand-mark { font-size: 22px; color: var(--c-white); }
.brand-small { font-size: 15px; color: var(--c-ocean); }
.brand-mark img, .brand-small img { height: 2.1em; width: auto; }
.brand-mark img { height: 2.6em; }
.brand-glyph { display: inline-block; width: 1.1em; height: 1.1em; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 12px 24px; border-radius: 999px; border: 0;
  font-weight: 600; font-size: 17px; text-decoration: none; transition: transform .15s var(--ease), background .15s, opacity .15s;
  touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn-lg { min-height: 58px; padding: 14px 34px; font-size: 18px; }
.btn-primary { background: var(--c-ocean); color: var(--c-white); }
.btn-primary:disabled { background: var(--c-clouds); color: var(--c-white); cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--c-ocean); border: 1.5px solid var(--c-douche); }
.btn-dark { background: var(--c-ink); color: var(--c-white); }

/* ---------- الشاشة الافتتاحية ---------- */
.hero { position: relative; min-height: 86vh; min-height: 86dvh; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; background: var(--c-ocean-deep); }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(34,48,58,.92) 0%, rgba(34,48,58,.55) 42%, rgba(34,48,58,.05) 75%); }
.hero-brand { position: absolute; top: calc(18px + var(--safe-t)); right: var(--gutter); }
.hero-text { position: relative; padding: 0 var(--gutter) 34px; color: var(--c-white); }
.hero-text h1 { font-size: clamp(30px, 8.5vw, 40px); line-height: 1.25; font-weight: 700; margin-bottom: 12px; max-width: 14ch; }
.hero-text p { font-size: 17px; line-height: 1.7; color: rgba(255,255,255,.88); max-width: 36ch; margin-bottom: 24px; font-weight: 300; }
.hero-text .btn-primary { background: var(--c-white); color: var(--c-ocean); width: 100%; }
.reassure { margin-top: 12px !important; font-size: 14px !important; color: rgba(255,255,255,.75) !important; text-align: center; }
.intro-notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 22px var(--gutter) calc(90px + var(--safe-b)); }
.note { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; font-size: 13px; color: var(--c-ink-60); line-height: 1.3; }
.note-num { font-size: 28px; font-weight: 700; color: var(--c-ocean); line-height: 1; }

/* ---------- رأس المعالج ---------- */
.wizard-head { position: sticky; top: 0; z-index: 5; background: rgba(250,248,246,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: calc(12px + var(--safe-t)) var(--gutter) 0; }
.wizard-head-row { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; }
.step-label { font-size: 14px; color: var(--c-ink-60); font-weight: 500; }
.progress { height: 3px; background: var(--c-douche); border-radius: 3px; overflow: hidden; margin: 0 calc(-1 * var(--gutter)); }
.progress span { display: block; height: 100%; background: var(--c-ocean); width: 20%; transition: width .4s var(--ease); }

/* ---------- الخطوات ---------- */
.step { padding: 26px var(--gutter) 24px; animation: step-in .35s var(--ease) both; }
@keyframes step-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.step-q { font-size: clamp(24px, 6.4vw, 30px); font-weight: 700; line-height: 1.3; margin-bottom: 8px; }
.step-q-sub { font-size: 21px; font-weight: 700; margin-bottom: 8px; }
.step-hint { color: var(--c-ink-60); font-size: 15px; margin-bottom: 20px; line-height: 1.7; }
.subsection { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--c-douche); animation: step-in .35s var(--ease) both; }
.subsection.is-waiting { opacity: .45; pointer-events: none; }

.callout { margin-top: 22px; padding: 16px 18px; background: var(--c-sky-20); border-radius: var(--radius); border-right: 4px solid var(--c-ocean); }
.callout strong { display: block; font-size: 16px; color: var(--c-ocean); margin-bottom: 2px; }
.callout p { font-size: 14px; color: var(--c-ink-60); line-height: 1.6; }
.callout-quiet { background: var(--c-white); border-right-color: var(--c-douche); }

/* ---------- بطاقات الاختيار ---------- */
.choice-grid { display: grid; gap: 12px; }
.choice-grid-2 { grid-template-columns: repeat(2, 1fr); }
.choice-grid-3 { grid-template-columns: repeat(3, 1fr); }
.choice-grid-1 { grid-template-columns: 1fr; }
@media (max-width: 360px) { .choice-grid-3 { grid-template-columns: repeat(2, 1fr); } }
.choice-list { display: grid; gap: 10px; }

.choice {
  position: relative; display: flex; flex-direction: column; text-align: right;
  background: var(--c-white); border: 2px solid var(--c-douche); border-radius: var(--radius);
  padding: 0; overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s var(--ease);
  min-height: 56px;
}
.choice:active { transform: scale(.985); }
.choice[aria-checked="true"] { border-color: var(--c-ocean); box-shadow: 0 0 0 3px var(--c-sky-20), var(--shadow-sm); }
.choice-media { position: relative; aspect-ratio: 4 / 3; background: var(--c-douche); overflow: hidden; }
.choice-media img { width: 100%; height: 100%; object-fit: cover; }
.choice-media.is-diagram { background: var(--c-ivoire); display: flex; align-items: center; justify-content: center; padding: 14px; }
.choice-media.is-diagram svg { width: 100%; height: 100%; }
.choice-media.is-tall { aspect-ratio: 16 / 10; }
.choice-media.is-contain { background: var(--c-ivoire); }
.choice-media.is-contain img { object-fit: contain; }
.choice-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 2px; }
.choice-title { font-weight: 600; font-size: 16px; line-height: 1.35; }
.choice-desc { font-size: 13.5px; color: var(--c-ink-60); line-height: 1.5; }
.choice-price { font-size: 14px; color: var(--c-ocean); font-weight: 600; margin-top: 4px; }
.choice-price.is-free { color: var(--c-walnut); }
.choice-check {
  position: absolute; top: 10px; left: 10px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--c-white); border: 2px solid var(--c-douche); display: grid; place-items: center; color: transparent; transition: background .15s, border-color .15s;
}
.choice[aria-checked="true"] .choice-check { background: var(--c-ocean); border-color: var(--c-ocean); color: var(--c-white); }
.choice-row { flex-direction: row; align-items: center; gap: 12px; padding: 14px 16px; padding-left: 48px; }
.choice-row .choice-body { padding: 0; flex: 1; }
.choice-row .choice-check { top: 50%; transform: translateY(-50%); }
.choice-row .choice-price { margin-top: 0; }

/* بديل مرتّب للصورة الناقصة */
.ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--c-ink-60); font-size: 12.5px; background: var(--c-ivoire); }
.ph svg { width: 100%; height: 100%; position: absolute; inset: 0; }
.ph span { position: relative; background: rgba(250,248,246,.85); padding: 3px 10px; border-radius: 999px; }

/* ---------- حقل الطول ---------- */
.length-field { display: block; background: var(--c-white); border: 2px solid var(--c-douche); border-radius: var(--radius-lg); padding: 16px 20px 10px; transition: border-color .15s, box-shadow .15s; }
.length-field:focus-within { border-color: var(--c-ocean); box-shadow: 0 0 0 3px var(--c-sky-20); }
.length-field.is-invalid { border-color: var(--c-error); }
.length-field-label { font-size: 14px; color: var(--c-ink-60); font-weight: 500; }
.length-field-row { display: flex; align-items: baseline; gap: 10px; }
#length-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 44px; font-weight: 700; color: var(--c-ocean); padding: 0; text-align: right; direction: rtl; font-variant-numeric: tabular-nums; }
#length-input::placeholder { color: var(--c-clouds); }
.unit { font-size: 20px; color: var(--c-ink-60); font-weight: 500; }
.field-help { font-size: 14px; color: var(--c-ink-60); margin-top: 10px; }
.field-error, .step-error { font-size: 14.5px; color: var(--c-error); background: var(--c-error-bg); padding: 10px 14px; border-radius: var(--radius-sm); margin-top: 10px; line-height: 1.6; }
.step-error { margin: 0 var(--gutter) 12px; }
.measure-guide { margin-top: 24px; background: var(--c-white); border-radius: var(--radius); padding: 16px; border: 1px solid var(--c-douche); }
.measure-svg { width: 100%; height: auto; max-height: 170px; margin-bottom: 8px; }
.measure-guide p { font-size: 14px; color: var(--c-ink-60); line-height: 1.7; }
.adjusted-preview { margin-top: 14px; padding: 12px 16px; background: var(--c-sky-20); border-radius: var(--radius-sm); font-size: 14.5px; color: var(--c-ocean); line-height: 1.7; }
.adjusted-preview b { font-weight: 700; }
.adjusted-preview em { display: block; margin-top: 4px; font-style: italic; font-weight: 600; }

.height-input-wrap { margin-top: 14px; animation: step-in .3s var(--ease) both; }

.step-figure { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; background: var(--c-douche); margin-bottom: 16px; }
.step-figure img { width: 100%; height: 100%; object-fit: cover; }
.step-figure figcaption { position: absolute; bottom: 0; right: 0; left: 0; padding: 24px 14px 10px; font-size: 13px; color: var(--c-white); background: linear-gradient(to top, rgba(34,48,58,.75), transparent); }

/* ---------- شريط الأزرار ---------- */
.action-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; gap: 12px;
  padding: 12px var(--gutter) calc(12px + var(--safe-b));
  background: rgba(250,248,246,.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--c-douche);
}
.action-bar .btn-primary { flex: 1; }
.action-bar .btn-ghost { flex: 0 0 auto; min-width: 100px; }

/* ---------- النتيجة ---------- */
.result-head { padding: calc(22px + var(--safe-t)) var(--gutter) 14px; display: flex; flex-direction: column; gap: 10px; }
.result-head h2 { font-size: clamp(24px, 6.4vw, 30px); font-weight: 700; line-height: 1.3; }

.price-note { margin: 0 var(--gutter) 12px; font-size: 14px; color: var(--c-ink-60); line-height: 1.6; }
.price-card { margin: 0 var(--gutter); background: var(--c-white); border-radius: var(--radius-lg); padding: 24px 22px 20px; box-shadow: var(--shadow); border: 1px solid rgba(221,214,206,.6); }
.price-caption { font-size: 15px; color: var(--c-ink-60); font-weight: 500; }
.price-main { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 4px; color: var(--c-walnut); }
.price-main > span:first-child { font-size: clamp(42px, 12.5vw, 60px); font-weight: 700; line-height: 1.1; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.price-cur { font-size: 20px; font-weight: 500; color: var(--c-ink-60); }
.price-sub { font-size: 14px; color: var(--c-ink-60); line-height: 1.6; }
.price-actions { display: flex; gap: 10px; margin-top: 18px; }
.price-actions .btn { flex: 1; min-height: 48px; font-size: 16px; padding-inline: 12px; }

/* التفصيل */
.breakdown { margin: 22px var(--gutter) 0; display: flex; flex-direction: column; gap: 12px; }
.bd { background: var(--c-white); border: 1px solid var(--c-douche); border-radius: var(--radius); padding: 16px 18px; }
.bd-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.bd-title { font-weight: 700; font-size: 17px; }
.bd-amount { font-weight: 700; font-size: 17px; color: var(--c-ocean); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bd-amount.is-free { color: var(--c-walnut); font-size: 14px; font-weight: 600; }
.bd-rows { margin-top: 10px; display: grid; gap: 6px; }
.bd-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; color: var(--c-ink-60); }
.bd-row b { color: var(--c-ink); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bd-row.is-result { padding-top: 8px; margin-top: 4px; border-top: 1px dashed var(--c-douche); color: var(--c-ink); }
.bd-row.is-result b { color: var(--c-ocean); }
.bd-tag { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--c-ocean); background: var(--c-sky-20); padding: 4px 10px; border-radius: 999px; font-weight: 600; }
.bd details { margin-top: 10px; }
.bd summary { cursor: pointer; font-size: 13.5px; color: var(--c-ocean); font-weight: 500; list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.bd summary::-webkit-details-marker { display: none; }
.bd summary::before { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s; margin-top: -3px; }
.bd details[open] summary::before { transform: rotate(-135deg); margin-top: 3px; }
.bd-formula { margin-top: 6px; font-size: 13.5px; color: var(--c-ink-60); background: var(--c-ivoire); padding: 10px 12px; border-radius: var(--radius-sm); line-height: 1.8; font-variant-numeric: tabular-nums; }
.bd-total { background: var(--c-ocean); color: var(--c-white); border-color: var(--c-ocean); }
.bd-total .bd-title, .bd-total .bd-amount { color: var(--c-white); font-size: 19px; }
.bd-total .bd-row { color: rgba(255,255,255,.8); }
.bd-total .bd-row b { color: var(--c-white); }

.breakdown-intro { margin: 22px var(--gutter) -10px; font-size: 15px; color: var(--c-ink-60); font-weight: 500; }
.bd-simple { padding: 6px 18px; }
.bd-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--c-douche); }
.bd-line:last-child { border-bottom: 0; }
.bd-line > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bd-line-title { font-weight: 600; font-size: 16px; }
.bd-line-sub { font-size: 13px; color: var(--c-ink-60); line-height: 1.5; }
.bd-line-amount { font-weight: 700; font-size: 17px; color: var(--c-ocean); white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: 2px; }
.bd-line-amount.is-free { color: var(--c-walnut); font-size: 14px; font-weight: 600; }
.bd-line-subtotal { border-bottom: 0; padding-bottom: 4px; }
.bd-line-subtotal .bd-line-title, .bd-line-subtotal .bd-line-amount { color: var(--c-ink-60); font-weight: 600; }
.bd-line-total { padding-top: 16px; border-top: 2px solid var(--c-ocean); }
.bd-line-total .bd-line-title, .bd-line-total .bd-line-amount { font-size: 19px; color: var(--c-ink); }
.corner-note { margin-top: 12px; font-size: 13.5px; color: var(--c-ink-60); line-height: 1.6; }
.corner-note em { color: var(--c-ocean); font-weight: 600; }
.disclaimer { margin: 18px var(--gutter) 0; font-size: 13.5px; color: var(--c-ink-60); line-height: 1.7; padding: 12px 14px; border-right: 3px solid var(--c-douche); }

/* الجودة */
.quality { padding: 44px var(--gutter) 10px; }
.section-title { font-size: clamp(23px, 6.2vw, 28px); font-weight: 700; line-height: 1.3; margin-bottom: 8px; }
.section-lead { color: var(--c-ink-60); font-size: 15.5px; line-height: 1.75; margin-bottom: 22px; }
.quality-grid { display: grid; gap: 12px; }
.qc { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; background: var(--c-white); border: 1px solid var(--c-douche); border-radius: var(--radius); overflow: hidden; }
.qc-media { position: relative; height: 100%; min-height: 96px; background: var(--c-douche); }
.qc-media img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.qc-body { padding: 12px 0 12px 14px; }
.qc-title { font-weight: 700; font-size: 16px; line-height: 1.35; }
.qc-desc { font-size: 13.5px; color: var(--c-ink-60); line-height: 1.6; margin-top: 2px; }
.qc.is-wide { grid-template-columns: 1fr; }
.qc.is-wide .qc-media { aspect-ratio: 16 / 9; min-height: 0; }
.qc.is-wide .qc-body { padding: 14px 16px 16px; }

/* تيك توك */
.tiktok { margin: 30px var(--gutter) 0; background: var(--c-ink); color: var(--c-white); border-radius: var(--radius-lg); overflow: hidden; }
.tiktok-figure { position: relative; aspect-ratio: 16 / 10; background: var(--c-ocean-deep); }
.tiktok-figure img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.tiktok-body { padding: 22px 22px 24px; }
.tiktok-body .section-title { color: var(--c-white); }
.tiktok-body p { color: rgba(255,255,255,.8); font-size: 15px; line-height: 1.7; margin-bottom: 18px; }
.tiktok-body .btn { width: 100%; background: var(--c-white); color: var(--c-ink); }

/* معرض المصنع */
.showroom { padding: 44px var(--gutter) 30px; }
.map-card { display: block; text-decoration: none; background: var(--c-white); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); border: 1px solid rgba(221,214,206,.6); transition: transform .15s var(--ease); }
.map-card:active { transform: scale(.985); }
.map-figure { position: relative; aspect-ratio: 16 / 10; background: var(--c-ocean-deep); }
.map-figure img { width: 100%; height: 100%; object-fit: cover; object-position: center 55%; }
.map-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.map-name { font-weight: 700; font-size: 18px; }
.map-hours { font-size: 14.5px; color: var(--c-ink-60); line-height: 1.6; }
.map-cta { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--c-ocean); font-weight: 600; font-size: 15px; min-height: 44px; }

.page-foot { padding: 10px var(--gutter) calc(90px + var(--safe-b)); display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--c-gris); }

/* ---------- زر واتساب العائم ---------- */
.wa-fab {
  position: fixed !important; left: 16px !important; bottom: calc(18px + var(--safe-b)) !important; z-index: 9999 !important;
  width: 64px !important; height: 64px !important; border-radius: 50% !important; background: #25D366 !important; color: #fff !important;
  display: flex !important; align-items: center; justify-content: center; text-decoration: none;
  box-shadow: 0 8px 22px -6px rgba(0,0,0,.4) !important; transition: transform .15s var(--ease), bottom .25s var(--ease);
  -webkit-transform: translateZ(0); transform: translateZ(0);
}
.wa-fab svg { width: 38px; height: 38px; }
.wa-fab:active { transform: scale(.94); }
body.is-wizard .wa-fab { bottom: calc(96px + var(--safe-b)) !important; }

/* ---------- حركة أقل ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
