/* ============================================================
   بقالتي - متجر البقالة
   هوية: أخضر داكن / أخضر فاتح / كريمي / لمسات ذهبية
   ============================================================ */

:root {
  --green: #1f7a53;
  --dark-green: #14532d;
  --light-green: #dcf5e7;
  --cream: #fdf9f0;
  --cream-dark: #f5efe1;
  --gold: #e7b54a;
  --gold-light: #f6dfae;
  --text: #20342b;
  --muted: #718078;
  --border: #e8e4d8;
  --white: #ffffff;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(20, 60, 40, 0.08);
  --shadow-sm: 0 4px 14px rgba(20, 60, 40, 0.07);
  --topbar-h: 64px;
  --bottomnav-h: 66px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom));
  color: var(--text);
  background: var(--cream);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

/* تخطي إلى المحتوى */
.skip-link {
  position: absolute;
  top: -60px;
  right: 12px;
  z-index: 200;
  padding: 10px 16px;
  color: white;
  background: var(--dark-green);
  border-radius: 0 0 10px 10px;
  text-decoration: none;
  font-weight: bold;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* ============ الشريط العلوي ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: color-mix(in srgb, var(--cream) 92%, white);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--dark-green), var(--green));
  border-radius: 13px;
  font-size: 22px;
  box-shadow: var(--shadow-sm);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-width: 0;
}

.brand-text b {
  font-size: 19px;
  color: var(--dark-green);
}

.brand-text span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 44vw;
}

.account-button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--dark-green);
  background: var(--light-green);
  border: 1px solid color-mix(in srgb, var(--green) 25%, transparent);
  border-radius: 12px;
  font-weight: bold;
  font-size: 13px;
  text-decoration: none;
}

.account-button:active {
  transform: scale(0.97);
}

/* ============ الواجهة الرئيسية ============ */
.hero {
  min-height: 330px;
  padding: 42px 20px 38px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 85% 15%, rgba(231, 181, 74, 0.35), transparent 45%),
    linear-gradient(120deg, #d6efdd, var(--gold-light));
}

.hero-content {
  max-width: 620px;
  position: relative;
  z-index: 2;
}

.hero-label {
  display: inline-block;
  padding: 5px 12px;
  color: var(--dark-green);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 100px;
  font-size: 12px;
  font-weight: bold;
}

.hero h1 {
  margin: 16px 0 10px;
  font-size: clamp(34px, 8vw, 62px);
  line-height: 1.15;
  color: var(--dark-green);
}

.hero h1 span {
  color: var(--green);
}

.hero p {
  max-width: 460px;
  color: #4a5f55;
  font-size: 15px;
  line-height: 1.8;
}

.primary-button {
  min-height: 48px;
  margin-top: 14px;
  padding: 12px 26px;
  color: white;
  background: var(--dark-green);
  border: 0;
  border-radius: 14px;
  font-weight: bold;
  font-size: 15px;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 8px 20px rgba(20, 83, 45, 0.25);
  transition: transform 0.15s;
}

.primary-button:active {
  transform: scale(0.97);
}

.hero-image {
  position: absolute;
  bottom: -12px;
  left: 8%;
  font-size: 130px;
  opacity: 0.9;
  pointer-events: none;
}

/* ============ المميزات ============ */
.benefits {
  max-width: 1080px;
  margin: -4px auto 0;
  padding: 20px 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  z-index: 3;
}

.benefit {
  padding: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.benefit-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--light-green);
  border-radius: 50%;
  font-size: 20px;
}

.benefit strong {
  display: block;
  font-size: 13px;
  color: var(--dark-green);
}

.benefit small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

/* ============ المتجر ============ */
.store-content {
  max-width: 1240px;
  margin: auto;
  padding: 26px 14px calc(40px + var(--bottomnav-h));
}

.section-heading {
  margin-bottom: 20px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.heading-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.section-heading small {
  color: var(--muted);
  font-size: 12px;
}

.section-heading h2 {
  margin: 2px 0 0;
  font-size: 26px;
  color: var(--dark-green);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.products-count {
  flex: 0 0 auto;
  padding: 6px 12px;
  color: var(--dark-green);
  background: var(--light-green);
  border-radius: 100px;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
}

.back-button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--dark-green);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-weight: bold;
  font-size: 12px;
}

.back-button:active {
  background: var(--light-green);
}

/* ============ أقسام المتجر ============ */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 22px;
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}

.category-card {
  position: relative;
  min-height: 108px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: right;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.category-card:active {
  transform: scale(0.97);
}

.category-card-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  font-size: 26px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
}

.category-card-name {
  font-weight: bold;
  font-size: 13px;
  color: var(--dark-green);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.category-card-count {
  font-size: 11px;
  color: rgba(20, 83, 45, 0.75);
  font-weight: bold;
}

.category-card-all {
  background: linear-gradient(135deg, var(--dark-green), var(--green));
  border-color: transparent;
  color: white;
}

.category-card-all .category-card-name {
  color: white;
}

.category-card-all .category-card-count {
  color: rgba(255, 255, 255, 0.85);
}

.category-card-all .category-card-icon {
  background: rgba(255, 255, 255, 0.18);
}

/* ============ أدوات البحث والفرز ============ */
.toolbar {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.search-box:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(31, 122, 83, 0.08);
}

.search-icon {
  font-size: 16px;
}

.search-box input {
  width: 100%;
  min-height: 46px;
  border: 0;
  outline: 0;
  background: transparent;
}

.sort-box {
  min-height: 48px;
  padding: 0 8px 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.sort-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.sort-box select {
  min-height: 44px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
  font-weight: bold;
  color: var(--dark-green);
}

/* ============ شبكة المنتجات ============ */
.products-grid {
  min-height: 260px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.product-card {
  position: relative;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
}

.product-card:active {
  transform: scale(0.98);
}

.product-media {
  position: relative;
  aspect-ratio: 1 / 0.85;
  width: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--light-green);
  text-decoration: none;
}

.product-media:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: -3px;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-media-emoji {
  font-size: 56px;
  line-height: 1;
  filter: drop-shadow(0 6px 14px rgba(20, 60, 40, 0.18));
}

.stock-ribbon {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: bold;
  color: white;
  background: var(--green);
}

.stock-ribbon.out {
  background: var(--danger);
}

.product-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-code {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.4px;
}

.product-name {
  margin: 4px 0 2px;
  font-size: 13px;
  line-height: 1.5;
  height: 2.6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--text);
  text-decoration: none;
}

.product-name:hover {
  color: var(--green);
}

.product-size {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 8px;
}

.product-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.product-price {
  font-size: 15px;
  font-weight: bold;
  color: var(--dark-green);
  white-space: nowrap;
}

.product-price small {
  font-weight: normal;
  font-size: 10.5px;
  color: var(--muted);
}

/* زر الإضافة */
.add-button {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--dark-green);
  border: 0;
  border-radius: 12px;
  font-size: 22px;
  font-weight: bold;
  line-height: 1;
}

.add-button:active {
  transform: scale(0.92);
}

.add-button.out {
  background: #d7d5cb;
  color: #8b8a82;
}

/* عداد الكمية */
.qty-control {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--light-green);
  border-radius: 12px;
  overflow: hidden;
}

.qty-control button {
  width: 38px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--dark-green);
  font-size: 18px;
  font-weight: bold;
}

.qty-control button:disabled {
  color: #a8bfb2;
}

.qty-control .qty-value {
  min-width: 30px;
  text-align: center;
  font-weight: bold;
  font-size: 14px;
  color: var(--dark-green);
}

/* ============ رسالة عدم وجود نتائج ============ */
.empty-products {
  grid-column: 1 / -1;
  padding: 60px 20px;
  text-align: center;
  background: var(--white);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

.empty-products-icon {
  display: block;
  margin-bottom: 14px;
  font-size: 52px;
}

.empty-products h3 {
  margin: 0 0 6px;
  font-size: 20px;
  color: var(--dark-green);
}

.empty-products p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* ============ عرض المزيد ============ */
.load-more-wrap {
  margin-top: 18px;
  text-align: center;
}

.load-more-button {
  min-height: 46px;
  padding: 10px 34px;
  color: var(--dark-green);
  background: var(--white);
  border: 1.5px solid var(--green);
  border-radius: 100px;
  font-weight: bold;
  font-size: 13px;
}

.load-more-button:active {
  background: var(--light-green);
}

/* ============ حالات تحميل ============ */
.skeleton-card {
  aspect-ratio: 1 / 1.3;
  border-radius: var(--radius-md);
  background: linear-gradient(100deg, #ecebe3 30%, #f6f5ee 50%, #ecebe3 70%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border: 1px solid var(--border);
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ============ الشريط السفلي ============ */
.bottom-navigation {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  height: calc(var(--bottomnav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  justify-content: space-around;
  background: rgba(255, 255, 255, 0.97);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 25px rgba(24, 55, 45, 0.06);
}

.bottom-navigation a {
  flex: 1;
  min-height: 44px;
  align-self: flex-start;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #7c8882;
  background: transparent;
  border: 0;
  font-size: 11px;
  text-decoration: none;
  padding: 0;
  cursor: pointer;
}

.bottom-navigation a.active {
  color: var(--green);
  font-weight: bold;
}

.bottom-navigation b {
  position: relative;
  display: block;
  font-size: 23px;
  line-height: 1;
}

.cart-nav-icon {
  display: inline-block;
  position: relative;
}

.cart-badge {
  position: absolute;
  top: -8px;
  left: -10px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--gold);
  border: 2px solid white;
  border-radius: 100px;
  font-size: 10px;
  font-weight: bold;
  animation: badgePop 0.25s;
}

@keyframes badgePop {
  0% { transform: scale(0.4); }
  100% { transform: scale(1); }
}

/* ============ النوافذ ============ */
.modal-background {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 38, 30, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: min(560px, 100%);
  max-height: 88vh;
  padding: 24px 20px;
  position: relative;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--cream);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: slideUp 0.25s;
}

@keyframes slideUp {
  from { transform: translateY(26px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal h2 {
  margin: 0 0 6px;
  font-size: 22px;
  color: var(--dark-green);
}

.modal-lead {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.close-button {
  width: 40px;
  height: 40px;
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: var(--white);
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}

.close-button:active {
  background: var(--cream-dark);
}

/* ============ استمارات ============ */
.form {
  display: grid;
  gap: 13px;
}

.form label.form-label {
  display: block;
  font-size: 12px;
  font-weight: bold;
  color: var(--dark-green);
}

.form input,
.form textarea,
.form select {
  width: 100%;
  min-height: 46px;
  margin-top: 6px;
  padding: 11px 13px;
  display: block;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: 0;
}

.form textarea {
  min-height: 84px;
  resize: vertical;
}

.form input:focus,
.form textarea:focus,
.form select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(31, 122, 83, 0.08);
}

.form input.invalid,
.form textarea.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(192, 57, 43, 0.08);
}

.field-error {
  margin-top: 4px;
  color: var(--danger);
  font-size: 11px;
}

.address-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.address-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.form-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 12px;
  color: white;
  background: var(--dark-green);
  border: 0;
  border-radius: var(--radius-md);
  font-weight: bold;
  font-size: 15px;
}

.form-submit:active {
  transform: scale(0.99);
}

.form-submit.secondary {
  color: var(--dark-green);
  background: var(--light-green);
}

/* ============ السلة ============ */
.cart-items {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.cart-item {
  display: flex;
  gap: 12px;
  padding: 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  align-items: center;
}

.cart-item-icon {
  position: relative;
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  font-size: 30px;
  background: var(--light-green);
  border-radius: 12px;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  font-weight: bold;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item-meta {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.cart-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.cart-line-price {
  font-weight: bold;
  font-size: 13px;
  color: var(--dark-green);
  white-space: nowrap;
}

.cart-qty {
  display: flex;
  align-items: center;
  background: var(--light-green);
  border-radius: 10px;
  overflow: hidden;
}

.cart-qty button {
  width: 34px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--dark-green);
  font-size: 17px;
  font-weight: bold;
}

.cart-qty button:disabled {
  color: #a8bfb2;
}

.cart-qty .qty-value {
  min-width: 26px;
  text-align: center;
  font-weight: bold;
  font-size: 13px;
}

.remove-item {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 15px;
}

/* مجاميع السلة */
.cart-summary {
  padding: 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: grid;
  gap: 8px;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text);
}

.summary-line.free {
  color: var(--green);
  font-weight: bold;
}

.summary-line.total {
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px dashed var(--border);
  font-size: 16px;
  font-weight: bold;
  color: var(--dark-green);
}

.free-delivery-note {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: var(--light-green);
  border-radius: var(--radius-sm);
  color: var(--dark-green);
  font-size: 12px;
  font-weight: bold;
  text-align: center;
}

/* السلة الفارغة */
.empty-cart {
  padding: 40px 10px;
  text-align: center;
}

.empty-cart span {
  display: block;
  margin-bottom: 12px;
  font-size: 52px;
}

.empty-cart h2 {
  margin-bottom: 4px;
}

.empty-cart p {
  color: var(--muted);
  font-size: 14px;
}

/* ============ إتمام الطلب ============ */
.order-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}

.order-item small {
  color: var(--muted);
}

.address-box {
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.address-box h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--dark-green);
}

.address-box p {
  margin: 0;
  color: var(--text);
  line-height: 1.7;
}

.address-box .edit-link {
  margin-top: 8px;
  display: inline-block;
  color: var(--green);
  font-weight: bold;
  font-size: 12px;
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
}

.payment-options {
  display: grid;
  gap: 10px;
}

.payment-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
}

.payment-option:has(input:checked) {
  border-color: var(--green);
  background: var(--light-green);
}

.payment-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--green);
}

.payment-option-icon {
  font-size: 22px;
}

/* ============ رسالة النجاح ============ */
.success-icon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin: 8px auto 16px;
  color: white;
  background: linear-gradient(135deg, var(--green), var(--dark-green));
  border-radius: 50%;
  font-size: 38px;
  box-shadow: 0 10px 24px rgba(20, 83, 45, 0.3);
}

.order-number {
  text-align: center;
  padding: 10px;
  background: var(--white);
  border: 1px dashed var(--green);
  border-radius: var(--radius-md);
  font-size: 14px;
  margin: 10px 0;
}

.order-number b {
  color: var(--dark-green);
  font-size: 17px;
  letter-spacing: 0.5px;
}

.demo-notice {
  margin-top: 14px;
  padding: 10px 12px;
  background: #fdf3dd;
  border: 1px solid var(--gold-light);
  border-radius: var(--radius-sm);
  color: #7a5b16;
  font-size: 12px;
}

/* ============ شاشة أكبر ============ */
@media (min-width: 640px) {
  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  .category-card {
    min-height: 126px;
    padding: 16px;
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .product-name {
    font-size: 14px;
  }

  .product-price {
    font-size: 16px;
  }
}

@media (min-width: 968px) {
  .topbar {
    padding: 0 4%;
  }

  .store-content {
    padding-right: 4%;
    padding-left: 4%;
  }

  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
  }

  .categories-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
  }

  .category-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
  }
}

@media (min-width: 1280px) {
  .products-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .categories-grid {
    grid-template-columns: repeat(4, 1fr);
    max-width: 1000px;
  }
}

@media (min-width: 1500px) {
  .products-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* أجهزة صغيرة جدًا (320px) */
@media (max-width: 600px) {
  .benefits {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .benefit {
    justify-content: flex-start;
  }
}

@media (max-width: 360px) {
  .account-label {
    display: none;
  }

  .account-button {
    padding: 8px 12px;
  }

  .category-card {
    min-height: 98px;
    padding: 12px;
  }

  .product-body {
    padding: 9px 10px 11px;
  }

  .qty-control button {
    width: 36px;
  }

  .add-button {
    width: 42px;
    height: 42px;
  }

  .benefit-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .hero {
    min-height: 300px;
    padding: 34px 16px;
  }

  .hero-image {
    font-size: 100px;
    left: 4%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   صفحات متعددة (صفحات مستقلة)
   ============================================================ */

/* التنقل السفلي كروابط */
.bottom-navigation a {
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.bottom-navigation a:active {
  transform: scale(0.95);
}

/* ============ حاوية الصفحات العامة ============ */
.page-content {
  max-width: 1080px;
  margin: auto;
  padding: 22px 14px calc(44px + var(--bottomnav-h));
}

.page-section {
  margin-bottom: 26px;
  scroll-margin-top: calc(var(--topbar-h) + 14px);
}

.page-section-head {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-section-head h2 {
  margin: 2px 0 0;
  font-size: 25px;
  color: var(--dark-green);
}

.page-section-head small {
  color: var(--muted);
  font-size: 12px;
}

.text-link {
  color: var(--green);
  font-weight: bold;
  font-size: 13px;
  text-decoration: none;
}

.back-link {
  display: inline-block;
  margin-bottom: 12px;
}

button.back-link {
  padding: 0;
  border: 0;
  background: none;
  text-align: right;
}

/* ============ إشعار الحساب أول مرة ============ */
.account-banner {
  position: relative;
  max-width: 1080px;
  margin: -8px auto 8px;
  padding: 10px 44px 10px 14px;
  display: flex;
  align-items: center;
  background: var(--gold-light);
  border: 1px solid var(--gold);
  border-radius: var(--radius-md);
}

.account-banner p {
  margin: 0;
  font-size: 12.5px;
  color: var(--dark-green);
}

.account-banner a {
  color: var(--dark-green);
  font-weight: bold;
  text-decoration: underline;
}

.banner-close {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--dark-green);
  font-size: 18px;
  line-height: 1;
}

/* ============ الأقسام في الرئيسية ============ */
.home-categories {
  margin-bottom: 4px;
}

.categories-page {
  margin-bottom: 8px;
}

/* ============ صفحة البحث ============ */
.search-hero {
  margin-bottom: 20px;
}

.search-box.big {
  min-height: 54px;
  padding: 0 14px 0 8px;
}

.search-box.big input {
  min-height: 52px;
  font-size: 15px;
}

.clear-search {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: var(--cream-dark);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.result-count {
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: bold;
}

/* ============ صفحة التفاصيل ============ */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 22px;
  align-items: start;
}

.detail-media {
  position: sticky;
  top: calc(var(--topbar-h) + 18px);
  aspect-ratio: 1 / 0.95;
  display: grid;
  place-items: center;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.detail-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail-media .product-media-emoji {
  font-size: 120px;
}

.detail-info {
  display: flex;
  flex-direction: column;
}

.detail-title {
  margin: 8px 0 10px;
  font-size: clamp(22px, 5vw, 30px);
  line-height: 1.35;
  color: var(--dark-green);
}

.detail-info-line {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0;
}

.stock-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: bold;
  color: white;
  background: var(--green);
}

.stock-chip.out {
  background: var(--danger);
}

.detail-category {
  display: inline-block;
  margin: 10px 0 4px;
  padding: 6px 12px;
  color: var(--dark-green);
  background: var(--light-green);
  border-radius: 100px;
  font-size: 12px;
  font-weight: bold;
  text-decoration: none;
  width: fit-content;
}

.detail-price {
  margin: 14px 0 6px;
  font-size: 30px;
  font-weight: bold;
  color: var(--dark-green);
}

.detail-price small {
  font-size: 15px;
  color: var(--muted);
  font-weight: normal;
}

.detail-desc p {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.8;
}

.detail-buy-box {
  margin-top: 18px;
  padding: 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.detail-in-cart {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.detail-add-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.qty-control.large {
  flex: 0 0 auto;
}

.qty-control.large button {
  width: 46px;
  height: 50px;
  font-size: 20px;
}

.qty-control.large .qty-value {
  min-width: 40px;
  font-size: 16px;
}

.add-to-cart-btn {
  flex: 1;
  margin-top: 0;
}

.maxed-note {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 12px;
  font-weight: bold;
}

/* منتجات مشابهة */
.similar-section {
  margin-top: 34px;
}

.similar-section h3 {
  margin: 0 0 14px;
  font-size: 18px;
  color: var(--dark-green);
}

/* ============ صفحة السلة ============ */
.cart-page-items {
  margin: 0 0 16px;
}

.cart-item-media {
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--light-green);
  border-radius: 12px;
  text-decoration: none;
}

.cart-item-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-emoji {
  font-size: 30px;
  line-height: 1;
}

.cart-item-name {
  text-decoration: none;
  color: var(--text);
  font-weight: bold;
}

.cart-item-name:hover {
  color: var(--green);
}

.cart-item-total {
  margin-top: 4px;
  text-align: center;
}

.remove-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: bold;
}

.cart-actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
}

.cart-actions .form-submit {
  margin-top: 0;
  text-decoration: none;
  text-align: center;
}

/* ============ صفحة الحساب ============ */
.form-page {
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}

.success-card {
  padding: 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.success-card .success-icon {
  width: 64px;
  height: 64px;
  font-size: 32px;
  margin-top: 4px;
}

.success-card h3 {
  margin: 10px 0 4px;
  color: var(--dark-green);
}

.success-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

/* ============ صفحة إتمام الطلب ============ */
.checkout-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 18px;
  align-items: start;
}

.checkout-card {
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.checkout-card h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--dark-green);
}

.checkout-card .address-box h4 {
  margin: 0 0 6px;
}

.edit-link {
  margin-top: 8px;
  display: inline-block;
  color: var(--green);
  font-weight: bold;
  font-size: 12px;
  text-decoration: underline;
  background: none;
  border: 0;
  padding: 0;
}

.empty-cart.panel {
  padding: 48px 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}

/* ============ استجابة الصفحات الجديدة ============ */
@media (max-width: 764px) {
  .detail-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .detail-media {
    position: static;
    aspect-ratio: 1 / 0.8;
  }

  .detail-media .product-media-emoji {
    font-size: 84px;
  }

  .checkout-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .detail-add-row {
    flex-direction: column;
  }

  .qty-control.large button {
    width: 44px;
  }

  .cart-actions {
    grid-template-columns: 1fr;
  }

  .cart-item {
    flex-wrap: wrap;
  }

  .cart-item-right {
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }

  .cart-item-total {
    width: 100%;
    text-align: left;
  }
}

@media (max-width: 360px) {
  .page-content {
    padding-right: 10px;
    padding-left: 10px;
  }
}