/* iOS Mobile Preview Normalization */
html {
  -webkit-text-size-adjust: 100%;
}

* {
  -webkit-tap-highlight-color: transparent;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="search"],
textarea {
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}

select {
  -webkit-appearance: none;
  appearance: none;
  background-color: transparent;
  font-family: inherit;
}

button {
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}

/* End iOS Normalization */

/* ========== CART SIDEBAR STYLES ========== */


.cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1999;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.cart-overlay.active {
  opacity: 1;
  visibility: visible;
}

.cart-sidebar {
  position: fixed;
  top: 0;
  right: -600px;
  width: 600px;
  height: 100%;
  background-color: #fffafa;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transition: right 0.3s ease;
}

.cart-sidebar.active {
  right: 0;
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem;
  border-bottom: 1px solid #e6ded4;
}

.cart-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #5a4538;
  margin: 0;
}

.cart-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  color: #5a4538;
}

.cart-close-btn:hover {
  transform: scale(1.1);
}

.cart-close-btn svg {
  stroke: #5a4538;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
}

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #5a4538;
  opacity: 0.6;
}

.cart-empty svg {
  margin-bottom: 1rem;
  stroke: #5a4538;
}

.cart-empty p {
  font-size: 1.1rem;
  margin: 0;
}

.cart-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #e6ded4;
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-image {
  width: 110px;
  height: 110px;
  border-radius: 8px;
  object-fit: cover;
  background-color: #e6ded4;
}

.cart-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cart-item-name {
  font-size: 1.2rem;
  font-weight: 600;
  color: #5a4538;
  margin: 0;
}

.cart-item-price {
  font-size: 1.15rem;
  color: #5a4538;
  margin: 0;
}

.cart-item-quantity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto;
}

.cart-item-quantity-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #5a4538;
  background-color: transparent;
  color: #5a4538;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.cart-item-quantity-btn:hover {
  background-color: #5a4538;
  color: #fffafa;
}

.cart-item-quantity-value {
  font-size: 1rem;
  font-weight: 500;
  min-width: 20px;
  text-align: center;
}

.cart-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: #5a4538;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  align-self: flex-start;
}

.cart-item-remove:hover {
  opacity: 1;
}

.cart-item-remove svg {
  width: 18px;
  height: 18px;
}

.cart-footer {
  padding: 2rem;
  border-top: 1px solid #e6ded4;
  background-color: #f7f5f2;
}

.cart-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #5a4538;
}

.cart-subtotal-amount {
  font-size: 1.25rem;
}

.cart-checkout-btn,
.cart-continue-btn {
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cart-checkout-btn {
  background-color: #5a4538;
  color: #fffafa;
  margin-bottom: 0.75rem;
}

.cart-checkout-btn:hover {
  background-color: #745948;
}

.cart-continue-btn {
  background-color: transparent;
  color: #5a4538;
  border: 2px solid #5a4538;
}

.cart-continue-btn:hover {
  background-color: #5a4538;
  color: #fffafa;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .cart-sidebar {
    width: 100%;
    right: -100%;
  }
}

@media (max-width: 480px) {
  .cart-header {
    padding: 1.5rem;
  }

  .cart-title {
    font-size: 1.25rem;
  }

  .cart-items {
    padding: 1rem 1.5rem;
  }

  .cart-footer {
    padding: 1.5rem;
  }

  .cart-item-image {
    width: 90px;
    height: 90px;
  }

  .cart-item-name {
    font-size: 1.1rem;
  }

  .cart-item-price {
    font-size: 1.05rem;
  }
}


/* ========== CART COUNT BADGE ========== */
.cart-count-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #e74c3c;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.nav-cart-btn,
.mobile-cart-btn {
  position: relative;
}

/* ========== TOAST NOTIFICATION ========== */
.cart-toast {
  position: fixed;
  top: 100px;
  right: 20px;
  background: white;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.3s ease;
}

.cart-toast.show {
  transform: translateX(0);
  opacity: 1;
}

.cart-toast-success {
  border-left: 4px solid #28a745;
}

.cart-toast-error {
  border-left: 4px solid #dc3545;
}

.cart-toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #333;
}

.cart-toast-success svg {
  color: #28a745;
  flex-shrink: 0;
}

.cart-toast-error svg {
  color: #dc3545;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .cart-toast {
    top: 80px;
    right: 10px;
    left: 10px;
    padding: 14px 18px;
  }

  .cart-toast-content {
    font-size: 0.875rem;
  }
}

/* iOS Mobile Font Size Adjustments — reduce to match Android preview */
@media (max-width: 600px) {
  @supports (-webkit-touch-callout: none) {
    .cart-title { font-size: 1.0rem !important; }
    .cart-item-name { font-size: 0.9rem !important; }
    .cart-item-price { font-size: 0.85rem !important; }
    .cart-item-quantity-value { font-size: 0.85rem !important; }
    .cart-subtotal { font-size: 0.9rem !important; }
    .cart-subtotal-amount { font-size: 1.0rem !important; }
    .cart-checkout-btn { font-size: 0.75rem !important; padding: 0.8rem !important; }
    .cart-continue-btn { font-size: 0.75rem !important; padding: 0.8rem !important; }
    .cart-empty p { font-size: 0.9rem !important; }
  }
}

/* Fix Arabic text disconnection on iOS due to letter-spacing */
html[lang="ar"],
.lang-ar,
.rtl,
[dir="rtl"] {
  letter-spacing: normal !important;
  word-spacing: normal !important;
}

[lang="ar"] *,
.lang-ar *,
.rtl *,
[dir="rtl"] * {
  letter-spacing: normal !important;
  word-spacing: normal !important;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}