:root {
  color-scheme: light;
  --bg: #f8f9fb;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-strong: #e2e8f0;
  --text: #111827;
  --muted: #6b7280;
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.13);
  --border: rgba(15, 23, 42, 0.08);
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 999;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-inner.header-layout {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}

.header-inner.header-layout .brand {
  justify-self: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand img {
  width: 150px;
  max-height: 100px;
  height: auto;
  border-radius: 18px;
  object-fit: contain;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.brand h1 {
  margin: 0;
  font-size: 1.1rem;
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.site-nav a {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: background 200ms ease;
}

.site-nav a:hover {
  background: var(--accent-soft);
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
}

.hero {
  display: grid;
  gap: 22px;
  padding: 30px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero-text .eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

.hero-text h2 {
  margin: 10px 0 12px;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.05;
}

.hero-text p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  padding: 20px;
  border-radius: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.stat-card span {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
}

.stat-card small {
  color: var(--muted);
}

.status-open {
  color: #16a34a;
}

.products {
  display: contents;
}

.section-title {
  grid-column: 1 / -1;
  margin-bottom: 16px;
}

.section-title h2 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.section-title p {
  margin: 0;
  color: var(--muted);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.product-card {
  border-radius: 24px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.product-card img {
  height: 220px;
  object-fit: cover;
}

.product-content {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.product-content h3 {
  margin: 0;
  font-size: 1.15rem;
}

.product-content p {
  margin: 0;
  color: var(--muted);
}

.product-actions {
  position: relative;
  display: grid;
  gap: 12px;
}

.price {
  font-weight: 700;
  color: #c2410c;
}

.btn-add,
.btn-primary {
  border: none;
  padding: 12px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease, background 150ms ease;
}

.btn-add:hover,
.btn-primary:hover,
.payment-option:hover {
  transform: translateY(-1px);
}

.btn-add.confirm {
  background: linear-gradient(135deg, #10b981, #0f766e);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quantity-picker {
  position: absolute;
  top: -88px;
  left: 0;
  right: 0;
  display: grid;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
  z-index: 2;
}

.quantity-picker span {
  color: var(--muted);
}

.quantity-controls,
.cart-quantity {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.qty-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}

.qty-value {
  min-width: 32px;
  text-align: center;
  display: inline-block;
  font-weight: 700;
}

.quantity-picker.hidden {
  display: none;
}

.page-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header h1,
.page-header h2 {
  margin: 0;
}

.cart-page .cart-table,
.checkout-page .checkout-form {
  display: grid;
  gap: 18px;
}

.cart-summary-card,
.order-summary,
.payment-panel {
  padding: 24px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.payment-panel {
  display: grid;
  gap: 16px;
  background: rgba(249, 115, 22, 0.05);
}

.payment-panel .section-label {
  margin: 0;
  font-size: 1rem;
  color: var(--accent);
  font-weight: 700;
}

.payment-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.payment-methods {
  display: grid;
  gap: 12px;
}

.payment-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 18px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.payment-option:hover {
  border-color: #f97316;
  background: #fff7ed;
  box-shadow: 0 8px 20px rgba(249, 115, 22, 0.08);
}

.payment-option input {
  accent-color: #f97316;
}

.payment-summary {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.cart-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 18px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.cart-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 18px;
}

.item-info {
  display: grid;
  gap: 10px;
}

.item-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.item-controls .qty-btn {
  width: 34px;
  height: 34px;
}

.remove-item {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: rgba(254, 226, 226, 0.8);
  color: #b91c1c;
  cursor: pointer;
  font-weight: 700;
}

.remove-item:hover {
  background: rgba(248, 113, 113, 0.18);
}

.cart-total-line,
.cart-summary-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.cart-empty,
.empty-cart-message {
  color: var(--muted);
  padding: 24px;
  text-align: center;
  border-radius: 20px;
  background: var(--surface-2);
}

.checkout-form {
  display: grid;
  gap: 16px;
}

.checkout-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.checkout-form input,
.checkout-form textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: var(--text);
}

.checkout-form input:hover,
.checkout-form textarea:hover {
  border-color: #94a3b8;
}

.checkout-form input:focus,
.checkout-form textarea:focus {
  outline: none;
  border-color: #f97316;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.12);
}

/* أرقام البطاقة دائماً LTR حتى لا ينعكس الترتيب في الصفحة العربية */
.checkout-form #cardNumber {
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
}

.error-text {
  color: #b91c1c;
  font-weight: 700;
  text-align: right;
  margin-top: -8px;
}

.success-text {
  color: #15803d;
  font-weight: 700;
  text-align: center;
}

.muted-text {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 8px;
}

.checkout-form textarea {
  min-height: 140px;
  resize: vertical;
}

.cart-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.cart-badge {
  display: inline-flex;
  min-width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.85rem;
  margin-inline-start: 6px;
}

.cart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.mobile-cart-bar {
  display: none;
}

@media (max-width: 960px) {
  main,
  .page-shell {
    padding-bottom: 24px;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 760px) {
  .header-inner,
  .hero,
  .site-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero {
    padding: 22px;
  }

  .product-card img {
    height: 180px;
  }

  .cart-item {
    grid-template-columns: 1fr;
  }

  .mobile-cart-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    gap: 12px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    z-index: 998;
  }

  body {
    padding-bottom: 90px;
  }
}

.cart-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.cart-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.close-cart {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
}

.cart-items {
  display: grid;
  gap: 16px;
  margin: 22px 0;
  max-height: calc(100vh - 330px);
  overflow: auto;
}

.cart-item {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.item-info {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.item-info strong {
  font-size: 1rem;
}

.item-info small {
  color: var(--muted);
}

.item-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.cart-total {
  font-size: 1.3rem;
  color: var(--text);
}

.cart-note {
  margin: 18px 0 20px;
  color: var(--muted);
}

.site-footer {
  grid-column: 1 / -1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text);
}

.cart-badge {
  display: inline-flex;
  min-width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.85rem;
  margin-inline-start: 6px;
}

.cart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.mobile-cart-bar {
  display: none;
}

@media (max-width: 960px) {
  main {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 760px) {
  .header-inner,
  .hero,
  .site-footer,
  .cart-panel {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero {
    padding: 22px;
  }

  .product-card img {
    height: 180px;
  }

  .cart-panel {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 80vh;
    border-radius: 24px 24px 0 0;
    z-index: 999;
  }

  .cart-panel.open {
    display: block;
  }

  .mobile-cart-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    gap: 12px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    z-index: 998;
  }

  body {
    padding-bottom: 90px;
  }
}
