/* مزارع الثنيان - متجر */
:root {
  --color-primary: #1a365d;
  --color-primary-light: #2c5282;
  --color-bg: #f7fafc;
  --color-card: #ffffff;
  --color-text: #1a202c;
  --color-text-muted: #4a5568;
  --color-border: #e2e8f0;
  --color-open: #276749;
  --color-btn: #e2e8f0;
  --color-btn-hover: #cbd5e0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --font: 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  padding-bottom: 72px; /* مكان لشريط السلة */
  direction: rtl;
}

/* الهيدر */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--color-card);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.cart-btn-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.cart-icon {
  width: 22px;
  height: 22px;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.store-name {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--color-text);
}

.store-name-en {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.menu-btn {
  width: 40px;
  height: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.menu-btn span {
  display: block;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
}

/* معلومات المتجر */
.store-info {
  background: var(--color-card);
  padding: 20px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.store-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--color-text);
}

.service-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--color-btn);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--color-text);
}

.tag-icon {
  flex-shrink: 0;
}

.store-details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.store-details span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.open-badge em {
  color: var(--color-open);
  font-style: normal;
  font-weight: 600;
}

/* قائمة المنتجات */
.products-section {
  padding: 0 16px 24px;
}

.products-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.product-card {
  display: flex;
  align-items: stretch;
  gap: 14px;
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.product-card:active {
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.product-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--color-text);
  line-height: 1.35;
}

.product-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.product-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
}

.btn-add {
  padding: 10px 20px;
  background: var(--color-btn);
  color: var(--color-text);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-add:hover {
  background: var(--color-btn-hover);
}

.btn-add:active {
  transform: scale(0.98);
}

/* زيادة/نقصان الكمية في بطاقة المنتج (الصفحة الأولى) */
.product-qty-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 24px;
  padding: 6px 8px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
}

.btn-qty {
  width: 32px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  padding: 0;
}

.btn-qty:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-qty:active {
  transform: scale(0.95);
}

.product-qty-value {
  min-width: 24px;
  text-align: center;
  font-size: 0.95rem;
}

/* إشعار تمت إضافة المنتج */
.store-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
}

.store-toast.store-toast-show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.product-image-wrap {
  flex-shrink: 0;
  width: 110px;
  height: 110px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-border);
}

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

/* شريط السلة السفلي */
.cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--color-primary);
  color: #fff;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
}

.cart-bar-content {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: #fff;
  font-family: var(--font);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: none;
}

.arrow-icon {
  width: 20px;
  height: 20px;
  transform: scaleX(-1);
}

.cart-summary {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-total {
  font-weight: 700;
  font-size: 1rem;
}

.cart-count-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* تحسينات للشاشات الأكبر */
@media (min-width: 480px) {
  .product-image-wrap {
    width: 130px;
    height: 130px;
  }

  .products-list {
    max-width: 520px;
    margin: 0 auto;
  }

  .store-info {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ========== صفحة السلة ========== */
body.page-cart {
  padding-bottom: 76px;
}

.store-info-cart .store-details {
  display: none;
}

.tag-active {
  background: var(--color-btn-hover);
  font-weight: 600;
}

.cart-card,
.delivery-card {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 16px 16px;
  box-shadow: var(--shadow);
}

@media (min-width: 480px) {
  .cart-card,
  .delivery-card {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
  }
}

.cart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.cart-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
}

.cart-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.btn-trash {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.btn-trash:hover {
  background: var(--color-btn);
  color: var(--color-text);
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.cart-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

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

.cart-item-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.cart-item-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
}

.btn-remove-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid #e53e3e;
  color: #e53e3e;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-remove-item:hover {
  background: #e53e3e;
  color: #fff;
}

.cart-item-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

.btn-special-request {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--color-btn);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--color-text);
  cursor: pointer;
  margin-bottom: 10px;
}

.btn-special-request:hover {
  background: var(--color-btn-hover);
}

.cart-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.cart-item-price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
}

.quantity-control {
  display: flex;
  align-items: center;
  background: #2d3748;
  color: #fff;
  border-radius: 24px;
  padding: 6px 4px;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
}

.quantity-control button {
  width: 32px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: 4px;
}

.quantity-control button:hover {
  background: rgba(255,255,255,0.15);
}

.quantity-control span {
  min-width: 28px;
  text-align: center;
}

.cart-item-image-wrap {
  flex-shrink: 0;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-border);
}

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

.cart-empty {
  display: none;
  text-align: center;
  padding: 24px 16px;
}

.cart-empty.show {
  display: block;
}

.cart-empty p {
  margin-bottom: 12px;
  color: var(--color-text-muted);
}

.btn-back-shop {
  display: inline-block;
  padding: 10px 20px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}

.btn-back-shop:hover {
  background: var(--color-primary-light);
}

.cart-card .cart-items.hide {
  display: none;
}

/* بطاقة موقع التسليم */
.delivery-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--color-text);
}

.delivery-address {
  position: relative;
  padding-inline-end: 36px;
}

.delivery-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
}

.delivery-hint {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
  line-height: 1.4;
}

.delivery-free {
  font-size: 0.9rem;
  color: var(--color-open);
  font-weight: 600;
}

.delivery-icon {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 1.5rem;
}

/* شريط المتابعة للدفع */
.cart-bar-checkout .cart-bar-content {
  text-decoration: none;
  color: #fff;
}

.cart-bar-checkout .cart-status {
  font-weight: 600;
}

/* ========== صفحة إتمام الطلب (Checkout) ========== */
body.page-checkout {
  background: #2d3748;
  padding: 0;
  min-height: 100vh;
}

.checkout-header {
  padding: 20px 16px;
  text-align: center;
}

.checkout-store-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
}

.checkout-card {
  background: var(--color-card);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 16px 32px;
  margin: 0;
  min-height: calc(100vh - 70px);
  box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.15);
}

@media (min-width: 480px) {
  .checkout-card {
    max-width: 480px;
    margin: 0 auto;
    border-radius: var(--radius);
    min-height: auto;
  }
}

.checkout-section {
  margin-bottom: 24px;
}

.checkout-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 14px;
}

.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkout-input,
.checkout-textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-btn);
  font-family: var(--font);
  font-size: 1rem;
  color: var(--color-text);
}

.checkout-input::placeholder,
.checkout-textarea::placeholder {
  color: var(--color-text-muted);
}

.checkout-textarea {
  resize: vertical;
  min-height: 90px;
}

/* طريقة الدفع */
.payment-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--color-btn);
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}

.payment-option:has(.payment-radio:checked) {
  border-color: var(--color-primary);
  background: rgba(26, 54, 93, 0.06);
}

.payment-radio {
  width: 20px;
  height: 20px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.payment-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.payment-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.payment-logo {
  height: 40px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}

/* ملخص الطلب */
.checkout-summary {
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

.summary-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.summary-total-label {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

.summary-total-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-text);
}

/* زر متابعة الدفع */
.btn-checkout-submit {
  width: 100%;
  padding: 16px 24px;
  margin-top: 8px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-checkout-submit:hover {
  background: var(--color-primary-light);
}

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

/* نافذة الدفع الآمن */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  position: relative;
  transform: scale(0.95);
  transition: transform 0.25s;
}

.modal-overlay.is-open .modal-dialog {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--color-text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.modal-close:hover {
  color: var(--color-text);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
  margin: 0 0 20px 0;
  padding-top: 8px;
}

.modal-body {
  margin-bottom: 20px;
}

.modal-text {
  font-size: 1rem;
  color: var(--color-text);
  margin: 0 0 10px 0;
  line-height: 1.5;
  text-align: center;
}

.modal-text-knet {
  font-weight: 600;
  margin-bottom: 14px;
}

.modal-text-note {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.55;
}

.btn-modal-continue {
  width: 100%;
  padding: 14px 24px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-modal-continue:hover {
  background: var(--color-primary-light);
}
