/* ==========================================
   إلكترو يوسف - Style.css  (ملف واحد لكل الصفحات)
   الألوان: أسود / ذهبي / أبيض  |  Mobile First

   الفهرس:
   1) الأساسيات: المتغيرات، الأزرار، الحقول، الرسائل
   2) Admin.html: تسجيل الدخول
   3) Admin.html: لوحة التحكم، المنتجات، رفع الصور، الطلبات، GIF
   4) المتجر (مشترك): الهيدر، البطاقات، Footer
   5) Index.html: الصفحة الرئيسية
   6) Product.html: صفحة المنتج
   7) Thanks.html: صفحة الشكر
   8) Admin: رابط عرض المتجر وحذف الطلبات
   ========================================== */

/* ---------- المتغيرات ---------- */
:root {
  --black: #0b0b0b;
  --card: #151515;
  --line: #2a2a2a;
  --gold: #d4af37;
  --gold-dark: #b8932a;
  --white: #ffffff;
  --muted: #a8a8a8;
  --danger: #ff6b6b;
  --success: #4cd08a;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
}

/* ---------- الأساسيات ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif;
  line-height: 1.6;
  color: var(--white);
  background: var(--black);
  overflow-x: hidden;
}

[hidden] { display: none !important; }

button, input { font-family: inherit; }

/* ---------- الأزرار ---------- */
.btn {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .1s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-gold { background: var(--gold); color: var(--black); }
.btn-gold:hover:not(:disabled) { background: var(--gold-dark); }

.btn-outline { background: transparent; color: var(--gold); border-color: var(--gold); }
.btn-outline:hover { background: rgba(212, 175, 55, .12); }

/* ---------- الحقول ---------- */
.field { margin-bottom: 16px; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: .95rem;
  color: var(--muted);
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font-size: 16px; /* يمنع تكبير الشاشة تلقائيًا في iPhone */
  color: var(--white);
  background: var(--black);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, .2);
}

.password-box { position: relative; }
.password-box input { padding-left: 76px; }

.toggle-btn {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  min-height: 36px;
  padding: 0 12px;
  font-size: .85rem;
  color: var(--gold);
  background: transparent;
  border: 0;
  cursor: pointer;
}

/* ---------- الرسائل ---------- */
.message {
  margin-bottom: 16px;
  padding: 10px 14px;
  font-size: .95rem;
  text-align: center;
  border-radius: var(--radius);
  border: 1px solid;
}
.message.error   { color: var(--danger);  border-color: var(--danger);  background: rgba(255, 107, 107, .08); }
.message.success { color: var(--success); border-color: var(--success); background: rgba(76, 208, 138, .08); }

/* ---------- صفحة تسجيل الدخول ---------- */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(circle at top, #1e1a0c 0%, var(--black) 60%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 28px 20px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.login-card form { text-align: right; }

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  font-size: 1.8rem;
  color: var(--black);
  background: var(--gold);
  border-radius: 50%;
}

.login-title { margin: 0 0 4px; font-size: 1.5rem; color: var(--gold); }
.login-sub   { margin: 0 0 24px; font-size: .95rem; color: var(--muted); }

/* ---------- شاشات أكبر ---------- */
@media (min-width: 480px) {
  .login-card { padding: 36px 32px; }
}

/* ==========================================
   لوحة التحكم (Admin Dashboard)
   ========================================== */

.admin-body { background: var(--black); }

.btn-sm { display: inline-block; width: auto; min-height: 40px; margin-top: 8px; padding: 8px 18px; font-size: .95rem; }

/* ---------- الشريط العلوي ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.topbar h2 { flex: 1; margin: 0; font-size: 1.15rem; }

.menu-btn {
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
  color: var(--gold);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.admin-chip {
  max-width: 120px;
  padding: 4px 12px;
  overflow: hidden;
  font-size: .85rem;
  color: var(--gold);
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* ---------- الشريط الجانبي ---------- */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: 260px;
  max-width: 82vw;
  padding: 16px;
  background: var(--card);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform .25s ease;
}
.sidebar.open { transform: none; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, .65);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.overlay.show { opacity: 1; pointer-events: auto; }

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 20px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold);
}
.side-brand .logo { width: 40px; height: 40px; margin: 0; font-size: 1rem; }

.side-nav { display: flex; flex: 1; flex-direction: column; gap: 6px; }

.nav-btn {
  min-height: 46px;
  padding: 10px 14px;
  font-size: 1rem;
  text-align: right;
  color: var(--white);
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.nav-btn:hover { background: rgba(212, 175, 55, .12); }
.nav-btn.active { font-weight: 700; color: var(--black); background: var(--gold); }
.nav-btn.logout { margin-top: 12px; color: var(--danger); border-top: 1px solid var(--line); border-radius: 0; }

/* ---------- المحتوى ---------- */
.content { max-width: 1200px; margin: 0 auto; padding: 16px; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 16px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
}
.stat-num { font-size: 1.35rem; font-weight: 700; color: var(--gold); overflow-wrap: anywhere; }
.stat-label { font-size: .9rem; color: var(--muted); }

.panel { padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.panel h3 { margin: 0 0 12px; font-size: 1.05rem; }

/* ---------- الجداول ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table th { font-weight: 700; color: var(--gold); }
.table .cell-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }

.state-msg { padding: 24px 12px; text-align: center; color: var(--muted); }

/* ---------- شارات الحالة ---------- */
.badge { display: inline-block; padding: 2px 12px; font-size: .82rem; border-radius: 999px; border: 1px solid; }
.badge-new       { color: var(--gold);  border-color: var(--gold); }
.badge-confirmed { color: #5aa9ff;      border-color: #5aa9ff; }
.badge-shipped   { color: #b48cff;      border-color: #b48cff; }
.badge-delivered { color: var(--success); border-color: var(--success); }
.badge-cancelled { color: var(--danger);  border-color: var(--danger); }

/* ---------- شاشات أكبر ---------- */
@media (min-width: 900px) {
  .sidebar { transform: none; }
  .overlay { display: none; }
  .menu-btn { display: none; }
  .app-main { margin-right: 260px; }
  .content { padding: 24px; }
  .stats { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .stat-num { font-size: 1.6rem; }
}

/* ==========================================
   إدارة المنتجات
   ========================================== */

.section-head { display: flex; gap: 10px; margin-bottom: 16px; }
.section-head .btn-sm { margin-top: 0; }

.btn-danger { color: var(--white); background: #c0392b; }
.btn-danger:hover:not(:disabled) { background: #a93226; }

/* ---------- بطاقات المنتجات ---------- */
.pgrid { display: grid; grid-template-columns: 1fr; gap: 14px; }

.pcard { display: flex; flex-direction: column; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.pcard.is-off .pimg img { opacity: .45; }

.pimg { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; overflow: hidden; background: #0e0e0e; }
.pimg img { width: 100%; height: 100%; object-fit: contain; }
.pimg.no-img::before { content: "لا توجد صورة"; font-size: .9rem; color: var(--muted); }
.pimg .badge { position: absolute; top: 8px; right: 8px; background: rgba(0, 0, 0, .7); }

.badge-active   { color: var(--success); border-color: var(--success); }
.badge-inactive { color: var(--muted);   border-color: var(--muted); }

.pinfo { display: flex; flex: 1; flex-direction: column; gap: 4px; padding: 12px; }
.pname { display: -webkit-box; margin: 0; overflow: hidden; font-size: 1rem; font-weight: 700; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pprice { font-size: 1.05rem; font-weight: 700; color: var(--gold); }
.pold { margin-right: 8px; font-size: .85rem; font-weight: 400; color: var(--muted); text-decoration: line-through; }
.pstock { font-size: .88rem; color: var(--muted); }

.pactions { display: flex; gap: 8px; padding: 0 12px 12px; }
.pactions .btn { flex: 1; width: auto; }
.btn-mini { min-height: 42px; padding: 8px 10px; font-size: .95rem; }
.btn-outline.danger { color: var(--danger); border-color: var(--danger); }
.btn-outline.danger:hover { background: rgba(255, 107, 107, .12); }

/* ---------- النوافذ المنبثقة ---------- */
.no-scroll { overflow: hidden; }

.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, .72); }

.modal-box { display: flex; flex-direction: column; width: 100%; max-width: 640px; max-height: 92vh; max-height: 92dvh; background: var(--card); border: 1px solid var(--line); border-radius: 16px 16px 0 0; }
.modal-box.small { max-width: 420px; }
.modal-box form { display: flex; flex: 1; flex-direction: column; min-height: 0; }

.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 1.1rem; color: var(--gold); }
.modal-close { width: 40px; height: 40px; font-size: 1.7rem; line-height: 1; color: var(--muted); background: transparent; border: 0; cursor: pointer; }

.modal-body { flex: 1; padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--line); }
.modal-foot .message { margin-bottom: 12px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; width: auto; }
.confirm-text { margin: 0; line-height: 1.8; }

.field-row { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.field textarea, .field select {
  width: 100%;
  padding: 10px 14px;
  font-size: 16px;
  color: var(--white);
  background: var(--black);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}
.field textarea { resize: vertical; min-height: 96px; }
.field select { min-height: 48px; }
.field textarea:focus, .field select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, .2); }
.field input[dir="ltr"] { text-align: left; }

/* ---------- رسالة النجاح العائمة ---------- */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 80;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  color: var(--white);
  text-align: center;
  background: var(--card);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--danger); }

@media (min-width: 520px) {
  .modal { align-items: center; padding: 16px; }
  .modal-box { border-radius: 16px; }
  .field-row { grid-template-columns: 1fr 1fr; }
  .pgrid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .pgrid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
}

/* ==========================================
   رفع الصور
   ========================================== */

.uploads { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.uslot { position: relative; }

.uframe {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  overflow: hidden;
  color: var(--gold);
  background: var(--black);
  border: 1px dashed var(--gold);
  border-radius: var(--radius);
  cursor: pointer;
}
.uframe img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.uplus { font-size: 2rem; line-height: 1; }
.uslot.has-img .uplus { display: none; }

.ustatus {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 4px;
  font-size: .78rem;
  text-align: center;
  color: var(--white);
  background: rgba(0, 0, 0, .78);
}

.uremove {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  width: 30px;
  height: 30px;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--white);
  background: rgba(192, 57, 43, .92);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.ucap { display: block; margin-top: 4px; font-size: .78rem; text-align: center; color: var(--muted); }
.hint { display: block; margin-top: 8px; font-size: .82rem; color: var(--muted); }

@media (min-width: 520px) {
  .uploads { grid-template-columns: repeat(4, 1fr); }
}

/* ==========================================
   إدارة الطلبات
   ========================================== */

.table-wide { min-width: 1150px; }
.table .cell-wrap { max-width: 240px; white-space: normal; line-height: 1.5; }
.table .cell-phone { direction: ltr; text-align: right; }
.table .cell-phone a { color: var(--white); text-decoration: none; }
.table .cell-phone a:hover { color: var(--gold); }

.status-select {
  min-height: 38px;
  padding: 4px 12px;
  font-size: .9rem;
  font-weight: 700;
  color: var(--white);
  background: var(--black);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.status-select:disabled { opacity: .6; cursor: wait; }
.status-select option { color: var(--white); background: var(--card); }

.st-new       { color: var(--gold);    border-color: var(--gold); }
.st-confirmed { color: #5aa9ff;        border-color: #5aa9ff; }
.st-shipped   { color: #b48cff;        border-color: #b48cff; }
.st-delivered { color: var(--success); border-color: var(--success); }
.st-cancelled { color: var(--danger);  border-color: var(--danger); }

/* ==========================================
   GIF في الوصف
   ========================================== */

.gif-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gif-list:empty { display: none; }
.gitem { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: #0e0e0e; border: 1px solid var(--line); border-radius: var(--radius); }
.gitem img { width: 100%; height: 100%; object-fit: cover; }
.field .btn-sm { margin-top: 10px; }

@media (min-width: 520px) {
  .gif-list { grid-template-columns: repeat(4, 1fr); }
}

/* ==========================================
   المتجر - الصفحة الرئيسية (الأبيض هو اللون الرئيسي)
   ========================================== */

:root {
  --ink: #141414;
  --ink-soft: #5f5f5f;
  --line-light: #ececec;
  --green: #1e8e4e;
  --red: #c0392b;
}

html { scroll-behavior: smooth; }

.store-body { color: var(--ink); background: #fff; }
.store-body a { color: inherit; text-decoration: none; }
.store-body .btn-gold { color: var(--black); }
.store-body .btn-dark { color: #fff; background: var(--black); border-color: var(--black); }
.store-body .btn-dark:hover { background: #2a2a2a; }

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}

/* تحسينات اللمس */
.store-body { -webkit-tap-highlight-color: transparent; }
.store-body a, .store-body button { touch-action: manipulation; }

/* ---------- الهيدر (صف واحد مضغوط على الهاتف) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  background: #fff;
  border-bottom: 1px solid var(--line-light);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .05);
}
.header-row { display: flex; align-items: center; gap: 10px; min-height: 60px; padding-top: 8px; padding-bottom: 8px; }

.brand { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 800; color: var(--ink); }
.brand-logo { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; color: var(--gold); background: var(--black); border-radius: 12px; }

.header-actions { display: flex; gap: 8px; margin-inline-start: auto; }
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-size: 1.3rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-light);
  border-radius: 12px;
  cursor: pointer;
}
.icon-btn:active { background: #f4f4f4; }
.icon-btn[aria-expanded="true"] { background: #fbf6e4; border-color: var(--gold); }

/* القائمة والبحث: لوحتان منسدلتان تحت الهيدر على الهاتف */
.main-nav, .search-panel {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  padding: 10px 16px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line-light);
  box-shadow: 0 12px 24px rgba(0, 0, 0, .08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.main-nav.open, .search-panel.open { opacity: 1; visibility: visible; transform: none; }

.main-nav { display: flex; flex-direction: column; gap: 2px; }
.main-nav a { padding: 13px 14px; font-weight: 700; color: var(--ink-soft); border-radius: 10px; }
.main-nav a:active { background: #f6f6f6; }
.main-nav a.active { color: var(--ink); background: #fbf6e4; box-shadow: inset -3px 0 0 var(--gold); }

.search { display: flex; align-items: center; background: #f4f4f4; border: 1px solid transparent; border-radius: 999px; transition: background .2s, border-color .2s, box-shadow .2s; }
.search:focus-within { background: #fff; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, .2); }
.search input { flex: 1; min-width: 0; min-height: 46px; padding: 0 16px; font-size: 16px; color: var(--ink); background: transparent; border: 0; outline: none; }
.search input::placeholder { color: #8a8a8a; }
.search button { flex: none; width: 42px; height: 42px; margin: 2px; color: var(--gold); background: var(--black); border: 0; border-radius: 50%; cursor: pointer; }

/* ---------- Hero ---------- */
.hero {
  padding: 26px 0 30px;
  text-align: center;
  background: radial-gradient(circle at 50% 0, rgba(212, 175, 55, .2), transparent 62%), linear-gradient(#fffdf6, #fff);
  border-bottom: 1px solid var(--line-light);
}
.hero h1 { margin: 0; font-size: clamp(1.55rem, 5.5vw, 2.6rem); line-height: 1.4; color: var(--ink); }
.hero h1::after { content: ""; display: block; width: 64px; height: 4px; margin: 12px auto 0; background: var(--gold); border-radius: 4px; }
.hero p { max-width: 560px; margin: 12px auto 18px; color: var(--ink-soft); }
.hero-btn { display: inline-flex; align-items: center; justify-content: center; width: auto; min-width: 200px; }

/* ---------- المنتجات ---------- */
.shop { padding: 28px 0 44px; scroll-margin-top: 76px; }
.shop-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.shop-head h2 { margin: 0; font-size: 1.4rem; }
.shop-count { font-size: .9rem; color: var(--ink-soft); }

.shop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.shop-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-light);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 6px 18px rgba(0, 0, 0, .04);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}

.shop-img { position: relative; display: block; aspect-ratio: 1 / 1; background: #fff; border-bottom: 1px solid var(--line-light); }
.shop-img img { width: 100%; height: 100%; object-fit: contain; }
.shop-img.no-img { display: flex; align-items: center; justify-content: center; background: #f7f7f7; }
.shop-img.no-img::before { content: "لا توجد صورة"; font-size: .9rem; color: #9a9a9a; }

.shop-off { position: absolute; top: 8px; right: 8px; padding: 3px 10px; font-size: .78rem; font-weight: 800; color: var(--gold); background: var(--black); border-radius: 999px; }

.shop-body { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 12px; }
.shop-name { display: -webkit-box; min-height: 2.9em; margin: 0; overflow: hidden; font-size: .98rem; font-weight: 700; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.shop-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.shop-now { font-size: 1.1rem; font-weight: 800; color: var(--ink); }
.shop-was { font-size: .85rem; color: #8a8a8a; text-decoration: line-through; }
.shop-stock { margin-bottom: 6px; font-size: .82rem; font-weight: 700; }
.shop-stock.is-in { color: var(--green); }
.shop-stock.is-out { color: var(--red); }
.shop-card.is-out .shop-img img { opacity: .5; }

.shop-btn { display: flex; align-items: center; justify-content: center; min-height: 44px; margin-top: auto; font-size: .95rem; }

.shop-state { padding: 40px 12px; text-align: center; color: var(--ink-soft); }

/* هيكل التحميل (Skeleton) */
.shop-card.skeleton .shop-img { background: linear-gradient(90deg, #eee 25%, #f8f8f8 37%, #eee 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
.skel-line { display: block; height: 14px; background: #eee; border-radius: 6px; }
.skel-line.short { width: 55%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .shop-card.skeleton .shop-img { animation: none; } }

/* ---------- Footer ---------- */
.site-footer { padding: 32px 0 calc(20px + env(safe-area-inset-bottom, 0px)); color: #cfcfcf; background: var(--black); border-top: 3px solid var(--gold); }
.footer-grid { display: grid; gap: 24px; }
.footer-title { margin: 0 0 10px; font-size: 1.1rem; color: var(--gold); }
.footer-text { max-width: 460px; margin: 0; line-height: 1.8; }
.socials { display: flex; flex-wrap: wrap; gap: 10px; }
.socials a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; color: var(--gold); border: 1px solid #3a3a3a; border-radius: 999px; }
.socials a:hover { background: rgba(212, 175, 55, .12); border-color: var(--gold); }
.copy { margin: 24px 0 0; padding-top: 14px; font-size: .85rem; text-align: center; color: #8f8f8f; border-top: 1px solid #262626; }

/* ---------- تابلت ---------- */
@media (min-width: 640px) {
  .shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .footer-grid { grid-template-columns: 1.6fr 1fr; }
  .hero { padding: 52px 0 56px; }
}

/* ---------- كمبيوتر ---------- */
@media (min-width: 900px) {
  .wrap { padding: 0 24px; }
  .header-actions { display: none; }
  .main-nav, .search-panel {
    position: static;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }
  .main-nav { flex-direction: row; gap: 4px; margin-inline-start: 12px; }
  .search-panel { width: 340px; margin-inline-start: auto; }
  .shop { scroll-margin-top: 80px; }
}
@media (min-width: 1024px) {
  .shop-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
}
@media (hover: hover) {
  .shop-card:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 10px 28px rgba(0, 0, 0, .1); }
}

/* ---------- عرض المزيد + العودة للأعلى ---------- */
.shop-more { margin-top: 20px; text-align: center; }
.shop-more .btn { display: inline-block; width: auto; min-width: 200px; }

.to-top {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  z-index: 40;
  width: 46px;
  height: 46px;
  font-size: 1.3rem;
  color: var(--gold);
  background: var(--black);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .2s, transform .2s, visibility .2s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }

/* ---------- الهواتف الصغيرة (320px - 380px) ---------- */
@media (max-width: 380px) {
  .shop-grid { gap: 10px; }
  .shop-body { padding: 10px; }
  .shop-name { font-size: .9rem; }
  .shop-now { font-size: 1rem; }
  .shop-btn { font-size: .9rem; }
  .brand-name { font-size: 1rem; }
}

/* ضغطة اللمس على البطاقة */
@media (hover: none) {
  .shop-card:active { transform: scale(.985); }
}

/* ==========================================
   Product.html: صفحة المنتج
   ========================================== */

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-inline-start: auto;
  padding: 0 16px;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-light);
  border-radius: 12px;
}
.back-link:active { background: #f4f4f4; }

.product-page { padding-top: 0; padding-bottom: 96px; }
.crumbs { display: none; }
.muted { color: var(--ink-soft); }
.shop-state .btn-sm { margin: 8px 4px 0; }
.shop-state a.btn { display: inline-block; }

.pview { display: grid; gap: 14px; }

/* بطاقات الأقسام */
.pmain, .pdesc, .orderbox {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line-light);
  border-radius: 16px;
}
.pdesc h2, .orderbox h2, .related h2 { margin: 0 0 12px; font-size: 1.15rem; }
.pdesc h2::after, .related h2::after { content: ""; display: block; width: 36px; height: 3px; margin-top: 6px; background: var(--gold); border-radius: 3px; }

/* ---------- المعرض (ملء العرض على الهاتف) ---------- */
.pgallery { margin-inline: -16px; }
.gwrap { position: relative; }

.gtrack {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  background: #fff;
  border-bottom: 1px solid var(--line-light);
}
.gtrack::-webkit-scrollbar { display: none; }
.gslide { flex: 0 0 100%; aspect-ratio: 1 / 1; scroll-snap-align: center; background: #fff; cursor: zoom-in; }
.gslide img { width: 100%; height: 100%; object-fit: contain; }
.gslide.no-img { display: flex; align-items: center; justify-content: center; background: #f7f7f7; cursor: default; }
.gslide.no-img::before { content: "لا توجد صورة"; color: #9a9a9a; }

.gcount { position: absolute; top: 12px; left: 12px; padding: 3px 12px; font-size: .8rem; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .62); border-radius: 999px; pointer-events: none; }
.gzoom { position: absolute; right: 12px; bottom: 12px; padding: 4px 12px; font-size: .78rem; color: #fff; background: rgba(0, 0, 0, .55); border-radius: 999px; pointer-events: none; }

.gdots { position: absolute; bottom: 14px; left: 50%; display: flex; gap: 6px; transform: translateX(-50%); pointer-events: none; }
.gdots i { width: 7px; height: 7px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(255, 255, 255, .8); border-radius: 999px; transition: width .2s, background .2s; }
.gdots i.active { width: 20px; background: var(--gold); }
.gdots:empty { display: none; }

.gthumbs { display: none; gap: 8px; margin: 10px 16px 0; overflow-x: auto; scrollbar-width: none; }
.gthumbs::-webkit-scrollbar { display: none; }
.gthumb { flex: none; width: 64px; height: 64px; padding: 0; overflow: hidden; background: #fff; border: 2px solid var(--line-light); border-radius: 12px; cursor: pointer; opacity: .75; transition: opacity .2s, border-color .2s; }
.gthumb img { width: 100%; height: 100%; object-fit: cover; }
.gthumb.active { border-color: var(--gold); opacity: 1; }

/* ---------- المعلومات ---------- */
.ptitle { margin: 0 0 10px; font-size: 1.3rem; line-height: 1.5; }
.pprice2 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.pnow { font-size: 1.75rem; font-weight: 800; color: var(--ink); }
.pwas { font-size: 1.05rem; color: #8a8a8a; text-decoration: line-through; }
.poff { padding: 3px 12px; font-size: .85rem; font-weight: 800; color: var(--gold); background: var(--black); border-radius: 999px; }
.psave { margin: 6px 0 0; font-size: .9rem; font-weight: 700; color: var(--green); }
.pmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-light); }
.pill { padding: 4px 14px; font-size: .85rem; font-weight: 700; border-radius: 999px; }
.pill.in { color: var(--green); background: #e9f7ef; }
.pill.out { color: var(--red); background: #fdecea; }
.pstock2 { font-size: .9rem; color: var(--ink-soft); }
.share-btn { min-height: 38px; margin-inline-start: auto; padding: 0 16px; font-size: .9rem; font-weight: 700; color: var(--ink); background: #fff; border: 1px solid var(--line-light); border-radius: 999px; cursor: pointer; }
.share-btn:active { background: #f4f4f4; }

/* ---------- الوصف ---------- */
.pdesc p { margin: 0 0 12px; line-height: 1.95; color: #2b2b2b; overflow-wrap: anywhere; }
.desc-gifs { display: grid; gap: 12px; margin-top: 8px; }
.desc-gif { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; background: #f4f4f4; border: 1px solid var(--line-light); border-radius: 12px; }

/* ---------- نموذج الطلب ---------- */
.orderbox { scroll-margin-top: 76px; background: #fffdf6; border-color: #efe4bd; }

.osum { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 10px; background: #fff; border: 1px solid var(--line-light); border-radius: 12px; }
.osum img { flex: none; width: 56px; height: 56px; object-fit: contain; background: #fff; border: 1px solid var(--line-light); border-radius: 10px; }
.osum-text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.osum-text strong { overflow: hidden; font-size: .95rem; text-overflow: ellipsis; white-space: nowrap; }
.osum-text span { font-weight: 800; }

.osteps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; counter-reset: step; }
.osteps li { font-size: .78rem; line-height: 1.5; text-align: center; color: var(--ink-soft); counter-increment: step; }
.osteps li::before { content: counter(step); display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin: 0 auto 4px; font-weight: 800; color: var(--black); background: var(--gold); border-radius: 50%; }

.ofield { margin-bottom: 14px; }
.ofield label { display: block; margin-bottom: 6px; font-size: .95rem; font-weight: 700; color: var(--ink); }
.ofield label b { color: var(--red); }
.ofield input, .ofield textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 12px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.ofield textarea { min-height: 76px; resize: vertical; }
.ofield input:focus, .ofield textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, .22); }
.ofield input:disabled, .ofield textarea:disabled { color: #8a8a8a; background: #f3f3f3; }
.ofield input.is-invalid, .ofield textarea.is-invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(192, 57, 43, .12); }
.ofield input[type="tel"] { direction: ltr; text-align: right; }
.ferr { display: block; margin-top: 4px; font-size: .82rem; color: var(--red); }
.ferr:empty { display: none; }

.qty { display: flex; align-items: center; gap: 8px; }
.qty button { flex: none; width: 48px; height: 48px; font-size: 1.5rem; line-height: 1; color: var(--ink); background: #fff; border: 1px solid #d9d9d9; border-radius: 12px; cursor: pointer; }
.qty button:active:not(:disabled) { background: #f4f4f4; }
.qty button:disabled { opacity: .5; }
.qty input { width: 84px; font-weight: 700; text-align: center; }

.ototal { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 12px; padding: 12px 14px; background: #fff; border: 1px dashed var(--gold); border-radius: 12px; }
.ototal strong { font-size: 1.25rem; }

.omsg { margin-bottom: 12px; padding: 10px 14px; font-size: .95rem; border-radius: 12px; }
.omsg.error { color: var(--red); background: #fdecea; border: 1px solid #f5c6c0; }
.omsg.success { color: var(--green); background: #e9f7ef; border: 1px solid #bfe5cf; }
.omsg.info { color: var(--ink-soft); background: #f3f3f3; border: 1px solid #e2e2e2; }

.obtn { min-height: 54px; font-size: 1.05rem; }
.obtn:disabled { opacity: .7; }

/* ---------- منتجات أخرى ---------- */
.related { padding: 22px 0 8px; }
.related-track { display: flex; gap: 12px; margin-inline: -16px; padding: 4px 16px 10px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
.related-track::-webkit-scrollbar { display: none; }
.rcard { display: flex; flex: 0 0 44%; flex-direction: column; gap: 6px; max-width: 200px; padding-bottom: 12px; overflow: hidden; background: #fff; border: 1px solid var(--line-light); border-radius: 14px; scroll-snap-align: start; }
.rimg { display: block; aspect-ratio: 1 / 1; border-bottom: 1px solid var(--line-light); }
.rimg img { width: 100%; height: 100%; object-fit: contain; }
.rimg.no-img { display: flex; align-items: center; justify-content: center; background: #f7f7f7; }
.rimg.no-img::before { content: "لا توجد صورة"; font-size: .8rem; color: #9a9a9a; }
.rname { display: -webkit-box; padding: 0 10px; overflow: hidden; font-size: .9rem; font-weight: 700; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rprice { padding: 0 10px; font-weight: 800; }

/* ---------- شريط الطلب السريع (الهاتف) ---------- */
.buybar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left));
  background: #fff;
  border-top: 1px solid var(--line-light);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, .08);
  transform: translateY(110%);
  transition: transform .25s ease;
}
.buybar.show { transform: none; }
.buybar-price { display: flex; flex-direction: column; line-height: 1.3; }
.buybar-price span { font-size: .78rem; color: var(--ink-soft); }
.buybar-price strong { font-size: 1.15rem; }
.buybar .btn { flex: 1; max-width: 220px; }

/* ---------- عرض الصورة بملء الشاشة ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: #000; }
.lb-track { display: flex; flex: 1; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; touch-action: pan-x pinch-zoom; }
.lb-track::-webkit-scrollbar { display: none; }
.lb-slide { display: flex; flex: 0 0 100%; align-items: center; justify-content: center; scroll-snap-align: center; }
.lb-slide img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-close { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; z-index: 2; width: 44px; height: 44px; font-size: 1.2rem; color: #fff; background: rgba(255, 255, 255, .16); border: 0; border-radius: 50%; cursor: pointer; }
.lb-count { position: absolute; top: calc(22px + env(safe-area-inset-top, 0px)); left: 16px; z-index: 2; font-size: .95rem; font-weight: 700; color: #fff; }

/* ---------- هيكل التحميل ---------- */
.pskel-wrap { display: grid; gap: 18px; margin-inline: -16px; }
.pskel-col { display: grid; gap: 12px; padding: 0 16px; }
.pskel { background: linear-gradient(90deg, #eee 25%, #f8f8f8 37%, #eee 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
.pskel-img { aspect-ratio: 1 / 1; }
.pskel-line { height: 20px; border-radius: 8px; }
.pskel-line.short { width: 55%; }
@media (prefers-reduced-motion: reduce) { .pskel { animation: none; } }

/* ---------- تحسينات السلاسة على الهاتف ---------- */
/* هامش ثابت 16px حتى يطابق الهامش السالب للمعرض (لا تمرير جانبي) */
.product-page.wrap { padding-left: 16px; padding-right: 16px; }
/* الأقسام أسفل الشاشة لا تُرسم إلا عند الاقتراب منها */
.product-body .related, .product-body .site-footer { content-visibility: auto; contain-intrinsic-size: auto 360px; }
/* حتى لا يغطي الشريط الثابت آخر الصفحة */
.product-body .site-footer { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
.dskel { display: grid; gap: 10px; }
.desc-gif { min-height: 160px; }
.desc-gif.loaded { min-height: 0; }
.buybar .btn:disabled { opacity: .6; }
.buybar .btn { min-height: 50px; font-size: 1.02rem; }

/* ---------- تابلت (640px فأكثر) ---------- */
@media (min-width: 640px) {
  .product-page { padding-top: 18px; }
  .crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; font-size: .88rem; color: var(--ink-soft); }
  .crumbs a:hover { color: var(--ink); text-decoration: underline; }
  .crumbs span:last-child { color: var(--ink); font-weight: 700; }
  .pgallery { margin-inline: 0; }
  .gtrack { border: 1px solid var(--line-light); border-radius: 16px; }
  .gdots { display: none; }
  .gthumbs { display: flex; margin: 10px 0 0; }
  .gthumbs:empty { display: none; }
  .pskel-wrap { margin-inline: 0; }
  .pskel-img { border-radius: 16px; }
  .pskel-col { padding: 0; }
  .related-track { margin-inline: 0; padding-inline: 0; }
}

/* ---------- كمبيوتر (900px فأكثر) ---------- */
@media (min-width: 900px) {
  .product-page { padding-top: 24px; padding-bottom: 48px; }
  .pview {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "gallery main" "gallery order" "desc desc";
    gap: 20px 40px;
    align-items: start;
  }
  .pgallery { grid-area: gallery; position: sticky; top: 84px; }
  .pmain { grid-area: main; }
  .orderbox { grid-area: order; scroll-margin-top: 80px; }
  .pdesc { grid-area: desc; }
  .ptitle { font-size: 1.7rem; }
  .buybar { display: none; }
  .product-page.wrap { padding-left: 24px; padding-right: 24px; }
  .product-body .site-footer { padding-bottom: 20px; }
  .pskel-wrap { grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
  .pskel-col { align-content: start; }
  .related-track { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; overflow: visible; }
  .rcard { max-width: none; }
}

/* ==========================================
   Thanks.html: صفحة الشكر
   ========================================== */

.thanks-page { padding-top: 24px; padding-bottom: 48px; }

.thanks-card {
  max-width: 520px;
  margin: 0 auto;
  padding: 32px 20px 24px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line-light);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .07);
}

.check { width: 96px; height: 96px; margin: 0 auto 18px; }
.check svg { display: block; width: 100%; height: 100%; }
.check-ring { fill: #e9f7ef; stroke: var(--green); stroke-width: 2; }
.check-mark { fill: none; stroke: var(--green); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw-check .6s .25s ease forwards; }
@keyframes draw-check { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .check-mark { animation: none; stroke-dashoffset: 0; } }

.thanks-title { margin: 0 0 10px; font-size: 1.6rem; line-height: 1.4; }
.thanks-title::after { content: ""; display: block; width: 56px; height: 4px; margin: 12px auto 0; background: var(--gold); border-radius: 4px; }
.thanks-text { margin: 12px 0 0; font-size: 1.02rem; color: var(--ink-soft); }

.tsum { margin: 22px 0 0; padding: 4px 16px; text-align: right; background: #fffdf6; border: 1px solid #efe4bd; border-radius: 14px; }
.tsum div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid #f0e8cc; }
.tsum div:last-child { border-bottom: 0; }
.tsum dt { flex: none; font-size: .9rem; color: var(--ink-soft); }
.tsum dd { min-width: 0; margin: 0; font-weight: 800; overflow-wrap: anywhere; text-align: left; }

.thanks-note { margin: 18px 0 0; font-size: .9rem; color: var(--ink-soft); }
.thanks-actions { display: grid; gap: 10px; margin-top: 22px; }
.thanks-actions .btn { display: flex; align-items: center; justify-content: center; min-height: 52px; font-size: 1.05rem; }

@media (min-width: 640px) {
  .thanks-page { padding-top: 56px; padding-bottom: 72px; }
  .thanks-card { padding: 44px 40px 32px; }
}

/* ==========================================
   Admin: رابط عرض المتجر وحذف الطلبات
   ========================================== */

a.nav-btn { display: flex; align-items: center; text-decoration: none; }
.nav-btn.store-link { margin-top: 12px; color: var(--gold); border-top: 1px solid var(--line); border-radius: 0; }
.nav-btn.store-link + .logout { margin-top: 0; border-top: 0; }

.store-chip {
  padding: 6px 14px;
  font-size: .85rem;
  font-weight: 700;
  color: var(--black);
  white-space: nowrap;
  text-decoration: none;
  background: var(--gold);
  border-radius: 999px;
}
.store-chip:hover { background: var(--gold-dark); }

.order-del { width: auto; min-height: 38px; padding: 4px 16px; font-size: .9rem; }

@media (max-width: 519px) {
  .admin-chip { display: none; }
}