@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

/* ============ الثيمات ============
   لايت: نفس هوية Vitwar الوردية الأصلية
   دارك: نفس ألوان البراند لكن على خلفية غامقة حقيقية
=================================== */
:root,
[data-theme="light"] {
  --bg: #fff6fc;
  --surface: #ffffff;
  --surface-2: #fff0fa;
  --ink: #4a1140;
  --muted: #9c5a8f;
  --accent: #ec3da7;
  --accent-2: #7c48ff;
  --accent-3: #ff8ccf;
  --line: #f2b9df;
  --shadow: 0 20px 55px rgba(122, 44, 108, 0.18);
  --radius: 26px;
  --glass-bg: linear-gradient(135deg, rgba(255, 75, 178, 0.55), rgba(124, 72, 255, 0.55));
  --glass-border: rgba(255, 255, 255, 0.55);
  --glass-highlight: rgba(255, 255, 255, 0.65);
}

[data-theme="dark"] {
  --bg: #170a1c;
  --surface: #251230;
  --surface-2: #2d1638;
  --ink: #f7e9f7;
  --muted: #c79bcb;
  --accent: #ff59b8;
  --accent-2: #a276ff;
  --accent-3: #ff8ccf;
  --line: #402249;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.55);
  --radius: 26px;
  --glass-bg: linear-gradient(135deg, rgba(255, 89, 184, 0.35), rgba(162, 118, 255, 0.35));
  --glass-border: rgba(255, 255, 255, 0.22);
  --glass-highlight: rgba(255, 255, 255, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
  direction: rtl;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(255, 124, 196, 0.18) 0, transparent 30%),
    radial-gradient(circle at 82% 18%, rgba(124, 72, 255, 0.14) 0, transparent 25%),
    var(--bg);
  transition: background-color .3s ease, color .3s ease;
  padding-bottom: 100px;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

.container { width: min(1180px, 92%); margin-inline: auto; }

/* ============ الهيدر ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 44px; height: 44px; border-radius: 14px; object-fit: cover; }
.brand-name { font-weight: 800; font-size: 1.25rem; color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 10px; }

/* ============ أزرار زجاج (iPhone glass) ============ */
.glass-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    inset 0 -6px 14px rgba(0, 0, 0, 0.08),
    0 10px 24px rgba(124, 44, 108, 0.28);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.glass-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.glass-btn:active { transform: translateY(0) scale(.98); box-shadow: inset 0 1px 0 var(--glass-highlight), inset 0 -2px 6px rgba(0,0,0,.12); }

/* زرار زجاج دائري صغير (أيقونات) */
.glass-icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: #fff;
  cursor: pointer;
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  box-shadow: inset 0 1px 0 var(--glass-highlight), 0 8px 18px rgba(124, 44, 108, 0.25);
  transition: transform .15s ease, filter .15s ease;
  font-size: 1.1rem;
}
.glass-icon-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* زرار زجاج ثانوي (فاتح شفاف، من غير التدرج الملون) */
.glass-btn-secondary {
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  color: var(--ink);
  border: 1px solid var(--line);
}

/* ============ التصنيفات ============ */
.categories-bar {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 16px 0 6px;
}
.category-chip {
  white-space: nowrap;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
}
.category-chip.active {
  background: var(--glass-bg);
  color: #fff;
  border-color: var(--glass-border);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* ============ شبكة المنتجات ============ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  padding: 18px 0 40px;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.product-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}
.product-card .info { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product-card h3 { margin: 0; font-size: 1.05rem; }
.product-card p.desc { margin: 0; font-size: .85rem; color: var(--muted); line-height: 1.5; min-height: 2.6em; }
.product-card .row { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.price { font-weight: 800; color: var(--accent); font-size: 1.05rem; }
.unavailable-badge {
  position: absolute;
  margin: 10px;
  background: rgba(0,0,0,.55);
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .75rem;
}
.product-card .img-wrap { position: relative; }

/* ============ السلة ============ */
.cart-fab {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 40;
}
.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent-2);
  color: #fff;
  font-size: .7rem;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}
.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}
.cart-drawer.open { display: block; }
.cart-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.cart-panel {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: min(420px, 92vw);
  background: var(--surface);
  padding: 20px;
  overflow-y: auto;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cart-item {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  background: var(--surface-2);
}
.cart-item img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; }
.cart-item .grow { flex: 1; }
.qty-controls { display: flex; align-items: center; gap: 8px; }
.qty-controls button {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 800; cursor: pointer;
}
.cart-total-row { display: flex; justify-content: space-between; font-weight: 800; font-size: 1.1rem; padding-top: 10px; border-top: 1px dashed var(--line); }
.empty-cart { text-align: center; color: var(--muted); padding: 40px 0; }

/* ============ فوتر ============ */
.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 30px 0 10px;
  font-size: .85rem;
}

/* ============ لوحة الأدمن ============ */
.admin-shell { min-height: 100vh; padding: 30px 0; }
.admin-login-box {
  max-width: 380px;
  margin: 10vh auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: .9rem; color: var(--muted); }
.field input, .field select, .field textarea {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-size: .95rem;
}
.error-msg { color: #e5484d; font-size: .9rem; }
.success-msg { color: #1a9e5c; font-size: .9rem; }

.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.admin-grid { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }

.panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.panel-card h2 { margin-top: 0; font-size: 1.1rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: right; }
td img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.row-actions { display: flex; gap: 8px; }
.small-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  font-weight: 700;
  font-size: .8rem;
  cursor: pointer;
}
.small-btn.edit { background: var(--accent-2); color: #fff; }
.small-btn.delete { background: #e5484d; color: #fff; }

.theme-toggle {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

/* ============ مودال اختيار المنتج / إتمام الطلب ============ */
.product-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
}
.product-modal.open { display: block; }
.product-modal-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.modal-product-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 18px;
}

/* الخانة الزجاجية الوردية اللي فيها الاختيارات + الإضافات + الكمية */
.option-box {
  margin: 14px 0;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--accent-2) 14%, transparent));
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.variant-group-label { font-weight: 800; font-size: .92rem; color: var(--ink); }
.variant-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.variant-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  color: var(--ink);
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  transition: all .15s ease;
}
.variant-pill.active {
  background: var(--glass-bg);
  color: #fff;
  border-color: transparent;
  box-shadow: inset 0 1px 0 var(--glass-highlight), 0 6px 14px rgba(124,44,108,.3);
}
.pill-price { font-size: .75rem; opacity: .85; }

.addons-group { display: flex; flex-direction: column; gap: 8px; }
.addon-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
}
.addon-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

.qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.qty-row .qty-controls button {
  background: var(--glass-bg);
  color: #fff;
  border: none;
}

/* ============ اختيار طريقة الطلب ============ */
.order-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.order-type-btn {
  flex-direction: column;
  padding: 18px 8px;
  font-size: .9rem;
  line-height: 1.8;
}

/* ============ إشعار زجاجي عائم ============ */
.glass-note {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--glass-bg);
  color: #fff;
  padding: 14px 22px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  box-shadow: inset 0 1px 0 var(--glass-highlight), 0 14px 30px rgba(124,44,108,.3);
  font-weight: 700;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: all .3s ease;
  white-space: nowrap;
}
.glass-note.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ============ تحسينات لشاشات لابتوب/ماك/PC (ديسكتوب) ============ */
@media (min-width: 900px) {
  .cart-panel {
    width: 420px;
    border-radius: 0 0 0 var(--radius);
  }
  .product-modal-panel {
    width: min(520px, 90vw);
  }
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
  .header-inner { padding-inline: 4px; }
  .glass-btn:hover { transform: translateY(-2px); }
  .product-card:hover {
    box-shadow: 0 26px 60px rgba(122, 44, 108, 0.22);
    transform: translateY(-2px);
    transition: all .2s ease;
  }
}
@media (min-width: 1200px) {
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
}

/* شاشات صغيرة جدًا (موبايل) */
@media (max-width: 480px) {
  .order-type-grid { gap: 8px; }
  .order-type-btn { padding: 14px 4px; font-size: .8rem; }
  .cart-panel { width: 100vw; }
}

/* ============ تبويبات لوحة الأدمن ============ */
.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.admin-tab {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.admin-tab.active {
  background: var(--glass-bg);
  color: #fff;
  border-color: transparent;
}
.tab-badge {
  background: #e5484d;
  color: #fff;
  font-size: .7rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ============ منشئ مجموعات الاختيارات (أدمن) ============ */
.vg-block {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin-top: 10px;
  background: var(--surface-2);
}
.vg-block .vg-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.vg-block .vg-header input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.vg-option-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  align-items: center;
}
.vg-option-row input {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.vg-option-row input.opt-label { flex: 2; }
.vg-option-row input.opt-price { flex: 1; width: 70px; }
.addon-checklist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

/* ============ بطاقات الطلبات (أدمن) ============ */
.order-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
}
.order-card::before {
  content: "";
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 6px;
}
.order-card.type-cafe::before { background: #ff9f43; }
.order-card.type-delivery::before { background: #7c48ff; }
.order-card.type-pickup::before { background: #1a9e5c; }
.order-card .order-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}
.order-type-tag {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  color: #fff;
}
.order-type-tag.type-cafe { background: #ff9f43; }
.order-type-tag.type-delivery { background: #7c48ff; }
.order-type-tag.type-pickup { background: #1a9e5c; }
.order-time { color: var(--muted); font-size: .78rem; }
.order-items-list { font-size: .88rem; margin: 6px 0; }
.order-fields { font-size: .85rem; color: var(--muted); margin: 6px 0; }
.order-total { font-weight: 800; }
