/* Blue Sky shop: Kurdish (RTL), phone first. Rudaw for words, Inter for numbers (like the Blue Sky program). */
@font-face { font-family: 'Nums'; src: url('fonts/inter-500.woff2') format('woff2'); font-weight: 100 600; unicode-range: U+0021-007E, U+00A0-00FF; font-display: swap; }
@font-face { font-family: 'Nums'; src: url('fonts/inter-700.woff2') format('woff2'); font-weight: 601 900; unicode-range: U+0021-007E, U+00A0-00FF; font-display: swap; }
@font-face { font-family: 'Rudaw'; src: url('fonts/rudaw.woff') format('woff'); font-weight: 100 900; font-display: swap; }

:root {
  --navy: #0B2F80;
  --navy-2: #1746B8;
  --ink: #14171C;
  --muted: #6B7385;
  --line: #E6E9F0;
  --bg: #F3F5FA;
  --card: #FFFFFF;
  --green: #1E8E3E;
  --green-bg: #E6F4EA;
  --red: #C62828;
  --red-bg: #FDECEC;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Nums', 'Rudaw', system-ui, sans-serif; font-size: 15px; line-height: 1.5; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
img { display: block; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .94); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-in { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand img { width: 46px; height: 46px; border-radius: 50%; background: #fff; box-shadow: 0 3px 10px rgba(11, 47, 128, .18); }
.brand b { display: block; font-size: 19px; color: var(--navy); line-height: 1.15; letter-spacing: .2px; }
.brand small { display: block; font-size: 10px; color: var(--muted); letter-spacing: 1.6px; }
.cart-btn { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px; border-radius: 14px; background: var(--navy); color: #fff; font-weight: 700; box-shadow: 0 6px 16px rgba(11, 47, 128, .28); }
.cart-btn:active { transform: scale(.97); }
.badge { position: absolute; top: -7px; left: -7px; min-width: 23px; height: 23px; padding: 0 6px; border-radius: 12px; background: #E53935; color: #fff; font-style: normal; font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.badge.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.35); } }

/* ---------- search + groups ---------- */
.tools { position: sticky; top: calc(67px + env(safe-area-inset-top)); z-index: 15; background: var(--bg); }
.tools-in { max-width: 1240px; margin: 0 auto; padding: 12px 16px 6px; }
.search { display: flex; align-items: center; gap: 9px; height: 48px; padding: 0 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); }
.search:focus-within { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(23, 70, 184, .12); }
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 16px; color: var(--ink); }
.search input::-webkit-search-cancel-button { display: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; height: 38px; padding: 0 16px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-weight: 700; font-size: 14.5px; color: #3B4252; white-space: nowrap; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- products ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 6px 16px calc(32px + env(safe-area-inset-bottom)); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.card { position: relative; display: flex; flex-direction: column; text-align: start; background: var(--card); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
@media (hover: hover) { .card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(16, 24, 40, .12); } }
.card:active { transform: scale(.98); }
.pic { position: relative; aspect-ratio: 1 / 1; background: #F7F8FB; display: flex; align-items: center; justify-content: center; color: #C3C9D6; overflow: hidden; }
.pic img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.card.out .pic img { filter: grayscale(1); opacity: .55; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-name { font-weight: 700; font-size: 14.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.price { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; margin-top: auto; }
.price b { font-size: 17px; color: var(--navy); white-space: nowrap; }
.price span { font-size: 12.5px; color: var(--muted); }
.state { position: absolute; top: 9px; right: 9px; height: 25px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.state::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.state.ok { background: var(--green-bg); color: var(--green); }
.state.no { background: var(--red-bg); color: var(--red); }
.skel .pic, .skel .line { background: linear-gradient(90deg, #eef0f5 25%, #f6f7fa 50%, #eef0f5 75%); background-size: 200% 100%; animation: shine 1.2s infinite linear; }
.skel .line { height: 14px; border-radius: 6px; }
@keyframes shine { to { background-position: -200% 0; } }
.empty { text-align: center; color: var(--muted); padding: 60px 16px; font-size: 16px; }
.empty button { margin-top: 14px; color: var(--navy-2); font-weight: 700; }

/* ---------- layers (product, basket, sent) ---------- */
.layer { position: fixed; inset: 0; z-index: 50; background: rgba(15, 20, 35, .5); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
@media (min-width: 640px) { .layer { align-items: center; padding: 20px; } }
@keyframes fade { from { opacity: 0; } }
.sheet { position: relative; width: 100%; max-width: 480px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; background: #fff; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); animation: up .22s ease; }
@media (min-width: 640px) { .sheet { border-radius: 22px; } }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }
.x { position: absolute; top: 12px; left: 12px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .92); box-shadow: 0 2px 8px rgba(0, 0, 0, .15); display: inline-flex; align-items: center; justify-content: center; color: #3B4252; }
.x.flat { position: static; box-shadow: none; background: #F1F3F7; }
.p-pic { aspect-ratio: 4 / 3; background: #F7F8FB; display: flex; align-items: center; justify-content: center; color: #C3C9D6; }
.p-pic img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.p-body { padding: 16px 18px 20px; }
.p-group { font-size: 13px; color: var(--muted); font-weight: 700; }
.p-name { margin: 2px 0 14px; font-size: 20px; line-height: 1.45; }
.units { display: grid; gap: 8px; margin-bottom: 16px; }
.unit { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); text-align: start; }
.unit.on { border-color: var(--navy-2); background: #EEF3FF; box-shadow: 0 0 0 3px rgba(23, 70, 184, .1); }
.unit .u-name { font-weight: 700; font-size: 16px; }
.u-size { font-size: 13px; color: var(--muted); margin-inline-start: 6px; }
.unit .u-price { font-weight: 700; color: var(--navy); font-size: 16.5px; white-space: nowrap; }
.unit.only { border-style: dashed; }
.ask { font-weight: 700; font-size: 16.5px; margin-bottom: 8px; }
.qty { display: flex; align-items: center; gap: 8px; min-width: 0; }
.qty button { width: 44px; height: 44px; border-radius: 12px; background: #F1F3F7; display: inline-flex; align-items: center; justify-content: center; color: var(--navy); flex-shrink: 0; }
.qty button:active { background: #E3E8F2; }
.qty input { width: 64px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); text-align: center; font-size: 18px; font-weight: 700; outline: none; }
.qty input:focus { border-color: var(--navy-2); }
.qty.big button { width: 56px; height: 56px; border-radius: 16px; }
.qty.big input { flex: 1; width: auto; min-width: 0; height: 56px; border-radius: 16px; font-size: 24px; }
.p-total { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 2px 14px; color: var(--muted); font-weight: 700; }
.p-total b { color: var(--ink); font-size: 20px; }
.main-btn { width: 100%; height: 56px; border-radius: 16px; background: var(--navy); color: #fff; font-size: 17px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 9px; box-shadow: 0 8px 20px rgba(11, 47, 128, .28); }
.main-btn:active { transform: scale(.99); }
.main-btn:disabled { background: #B9C0CE; box-shadow: none; cursor: default; }

/* basket */
.cart { display: flex; flex-direction: column; }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; position: sticky; top: 0; background: #fff; z-index: 2; border-bottom: 1px solid var(--line); }
.cart-head h2 { margin: 0; font-size: 20px; }
.cart-lines { padding: 6px 18px; }
.c-line { display: grid; grid-template-columns: 58px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.c-line:last-child { border-bottom: none; }
.c-pic { width: 58px; height: 58px; border-radius: 12px; background: #F7F8FB; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #C3C9D6; }
.c-pic img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.c-name { font-weight: 700; font-size: 14.5px; line-height: 1.4; }
.c-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.c-line .qty { margin-top: 8px; }
.c-line .qty button { width: 36px; height: 36px; border-radius: 10px; }
.c-line .qty input { width: 58px; height: 36px; border-radius: 10px; font-size: 16px; }
.c-end { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; align-self: stretch; justify-content: space-between; }
.c-end b { white-space: nowrap; font-size: 15.5px; }
.c-del { width: 34px; height: 34px; border-radius: 10px; background: var(--red-bg); color: var(--red); display: inline-flex; align-items: center; justify-content: center; }
.c-line.bad .c-name { color: var(--red); }
.cart-foot { padding: 14px 18px 20px; border-top: 1px solid var(--line); background: #FAFBFD; position: sticky; bottom: 0; }
.sum { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; margin-bottom: 12px; }
.sum b { font-size: 22px; color: var(--navy); }
.field { display: block; margin-bottom: 10px; }
.field span { display: block; font-size: 13.5px; font-weight: 700; color: #3B4252; margin-bottom: 5px; }
.field input { width: 100%; height: 50px; border-radius: 13px; border: 1.5px solid var(--line); padding: 0 14px; font-size: 16px; outline: none; background: #fff; }
.field input:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(23, 70, 184, .12); }
.field input.bad { border-color: var(--red); }
.err { color: var(--red); background: var(--red-bg); border-radius: 12px; padding: 10px 12px; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.cart-empty { text-align: center; color: var(--muted); padding: 40px 10px 30px; }
.cart-empty svg { color: #C3C9D6; margin-bottom: 8px; }

/* sent */
.done { text-align: center; padding: 30px 22px 24px; }
.done-ic { width: 76px; height: 76px; border-radius: 50%; background: var(--green); display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 10px 24px rgba(30, 142, 62, .35); }
.done h2 { margin: 16px 0 6px; font-size: 21px; }
.done-code { display: inline-block; direction: ltr; font-weight: 700; color: var(--navy); background: #EEF3FF; padding: 4px 14px; border-radius: 999px; }
.done p { color: var(--muted); margin: 12px 0 20px; }

.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; background: #1F2533; color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: 14.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: calc(100vw - 32px); text-align: center; animation: up .2s ease; }
.toast.ok { background: var(--green); }
