/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #6366F1;
  --primary-dark: #4F46E5;
  --primary-light: #818CF8;
  --accent: #F59E0B;
  --bg: #F8FAFC;
  --bg-2: #EEF2FF;
  --card: #FFFFFF;
  --card-2: #F1F5F9;
  --text: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --success: #10B981;
  --error: #EF4444;
  --shadow: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --radius: 12px;
  --radius-sm: 8px;
  --font-ar: 'Noto Sans Arabic', 'Inter', sans-serif;
  --font-en: 'Inter', 'Noto Sans Arabic', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ar);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  direction: rtl;
}

[dir="ltr"] body, [data-lang="en"] body { font-family: var(--font-en); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* === HEADER === */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex; align-items: center; gap: 24px;
  height: 64px;
}

.logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--text);
  font-weight: 700; font-size: 18px;
}

.main-nav {
  display: flex; gap: 24px; margin-right: auto;
}

.main-nav a {
  text-decoration: none; color: var(--text-muted);
  font-size: 14px; font-weight: 500;
  transition: color .2s;
}

.main-nav a:hover { color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: 12px; }

.lang-toggle {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  transition: all .2s;
}

.lang-toggle:hover { border-color: var(--primary); color: var(--primary); }

.cart-btn {
  position: relative; background: transparent; border: none;
  cursor: pointer; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  transition: background .2s;
}

.cart-btn:hover { background: var(--bg-2); }

.cart-count {
  position: absolute; top: 2px; left: 2px;
  background: var(--primary); color: white;
  font-size: 10px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.cart-count:empty, .cart-count[data-count="0"] { display: none; }

/* === HERO === */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 50%, #C7D2FE 100%);
  padding: 80px 0 100px;
}

.hero-bg-pattern {
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 2px 2px, rgba(99,102,241,.12) 1px, transparent 0);
  background-size: 28px 28px;
  pointer-events: none;
}

.hero-content {
  position: relative; text-align: center;
  max-width: 720px; margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px; border-radius: 20px;
  background: var(--primary); color: white;
  font-size: 13px; font-weight: 600;
  margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800; line-height: 1.2;
  color: var(--text); margin-bottom: 16px;
}

.hero-sub {
  font-size: 18px; color: var(--text-muted);
  margin-bottom: 32px; max-width: 580px; margin-inline: auto;
}

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 28px; border-radius: var(--radius);
  background: var(--primary); color: white;
  text-decoration: none; font-weight: 600; font-size: 15px;
  border: none; cursor: pointer;
  transition: all .2s;
  box-shadow: var(--shadow);
}

.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-primary:active { transform: translateY(0); }

/* === PRODUCTS === */
.products-section { padding: 64px 0; }

.section-header { text-align: center; margin-bottom: 40px; }

.section-title {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800; color: var(--text);
  margin-bottom: 8px;
}

.section-sub { font-size: 16px; color: var(--text-muted); }

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

.product-card {
  background: var(--card); border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all .25s;
  display: flex; flex-direction: column;
}

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

.product-image-wrap {
  position: relative; aspect-ratio: 1;
  overflow: hidden; background: var(--bg-2);
}

.product-image-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s;
}

.product-card:hover .product-image-wrap img { transform: scale(1.05); }

.product-badge {
  position: absolute; top: 12px; right: 12px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  background: var(--accent); color: white;
}

.product-info { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }

.product-name {
  font-size: 15px; font-weight: 700; color: var(--text);
  line-height: 1.4;
}

.product-desc {
  font-size: 13px; color: var(--text-muted);
  line-height: 1.5;
}

.product-price {
  font-size: 20px; font-weight: 800;
  color: var(--primary);
  margin-top: auto;
}

.product-price span { font-size: 14px; font-weight: 500; color: var(--text-muted); }

.product-actions { padding: 0 16px 16px; display: flex; gap: 8px; }

.btn-add-cart {
  flex: 1; padding: 10px; border-radius: var(--radius-sm);
  background: var(--primary); color: white;
  border: none; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: background .2s;
}

.btn-add-cart:hover { background: var(--primary-dark); }

.btn-wishlist {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--border);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all .2s;
}

.btn-wishlist:hover { border-color: var(--primary); color: var(--primary); }
.btn-wishlist.active { background: #FEE2E2; border-color: var(--error); color: var(--error); }

/* === FEATURES === */
.features-section { padding: 64px 0; background: var(--bg-2); }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}

.feature-card {
  background: var(--card); border-radius: var(--radius);
  padding: 28px 20px; text-align: center;
  box-shadow: var(--shadow);
}

.feature-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--bg-2);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: var(--primary);
}

.feature-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.feature-card p { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* === ABOUT === */
.about-section { padding: 64px 0; }

.about-content { max-width: 720px; margin: 0 auto; text-align: center; }
.about-content h2 { font-size: 32px; font-weight: 800; margin-bottom: 16px; }
.about-content p { font-size: 16px; color: var(--text-muted); line-height: 1.8; }

/* === CONTACT === */
.contact-section { padding: 64px 0; background: var(--bg-2); }

.contact-form {
  max-width: 600px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 16px;
}

.contact-form input, .contact-form textarea {
  width: 100%; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; font-family: var(--font-ar);
  background: var(--card); color: var(--text);
  transition: border-color .2s;
}

[dir="ltr"] .contact-form input,
[dir="ltr"] .contact-form textarea { font-family: var(--font-en); }

.contact-form input:focus, .contact-form textarea:focus {
  outline: none; border-color: var(--primary);
}

.btn-submit {
  width: 100%; padding: 14px;
  background: var(--primary); color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: var(--font-ar);
  transition: background .2s;
}

[dir="ltr"] .btn-submit { font-family: var(--font-en); }
.btn-submit:hover { background: var(--primary-dark); }

/* === FOOTER === */
.site-footer {
  background: var(--text); color: #CBD5E1;
  padding: 48px 0 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 32px;
  padding-bottom: 40px;
}

.footer-logo {
  display: flex; align-items: center; gap: 8px;
  color: white; font-weight: 700; font-size: 18px;
  margin-bottom: 12px;
}

.footer-desc { font-size: 13px; line-height: 1.6; color: #94A3B8; }

.footer-col h4 { color: white; font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-col ul a { color: #94A3B8; text-decoration: none; font-size: 14px; transition: color .2s; }
.footer-col ul a:hover { color: white; }
.footer-col p { font-size: 14px; color: #94A3B8; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 20px 0; text-align: center;
  font-size: 13px; color: #64748B;
}

/* === CART DRAWER === */
.cart-drawer { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.cart-drawer.open { pointer-events: all; }

.cart-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.4);
  opacity: 0; transition: opacity .3s;
}

.cart-drawer.open .cart-overlay { opacity: 1; }

.cart-panel {
  position: absolute; top: 0; right: 0;
  width: 400px; max-width: 100vw;
  height: 100%; background: var(--card);
  box-shadow: -4px 0 20px rgba(0,0,0,.15);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s;
}

.cart-drawer.open .cart-panel { transform: translateX(0); }

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

.cart-header h3 { font-size: 18px; font-weight: 700; }

.cart-close {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); display: flex; align-items: center;
  padding: 6px; border-radius: var(--radius-sm);
  transition: background .2s;
}

.cart-close:hover { background: var(--bg-2); }

.cart-items { flex: 1; overflow-y: auto; padding: 16px 20px; }

.cart-empty {
  text-align: center; color: var(--text-muted);
  font-size: 15px; padding: 40px 20px;
  display: none;
}

.cart-items:empty + .cart-empty, .cart-items.cart-empty-state + .cart-empty { display: block; }

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

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

.cart-item-img {
  width: 64px; height: 64px; border-radius: var(--radius-sm);
  overflow: hidden; flex-shrink: 0; background: var(--bg-2);
}

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

.cart-item-info { flex: 1; }
.cart-item-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.cart-item-price { font-size: 14px; color: var(--primary); font-weight: 700; }
.cart-item-qty { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

.qty-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--border); background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600;
  transition: all .2s;
}

.qty-btn:hover { border-color: var(--primary); color: var(--primary); }

.qty-num { font-size: 14px; font-weight: 600; min-width: 20px; text-align: center; }

.cart-item-remove {
  background: transparent; border: none; cursor: pointer;
  color: var(--error); font-size: 12px;
  padding: 4px 8px; border-radius: 4px;
  transition: background .2s;
}

.cart-item-remove:hover { background: #FEE2E2; }

.cart-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: none;
}

.cart-footer.active { display: block; }

.cart-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; font-size: 16px; font-weight: 700;
}

.cart-total span:last-child { color: var(--primary); font-size: 20px; }

.cart-checkout-btn {
  width: 100%; padding: 12px;
  background: var(--accent); color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 700;
  cursor: pointer; font-family: var(--font-ar);
  transition: background .2s; margin-top: 8px;
}

.cart-checkout-btn:hover { background: #D97706; }

.paypal-checkout-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px 20px;
  background: #FFC439; color: #003087;
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font-ar); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .2s; margin-bottom: 8px;
}

[dir="ltr"] .paypal-checkout-btn { font-family: var(--font-en); }
.paypal-checkout-btn:hover { background: #e6b030; }

.paypal-divider {
  text-align: center; position: relative;
  margin: 4px 0; color: var(--text-muted); font-size: 12px;
}

.paypal-divider::before, .paypal-divider::after {
  content: ''; position: absolute; top: 50%;
  width: 40%; height: 1px; background: var(--border);
}

.paypal-divider::before { right: 0; }
.paypal-divider::after { left: 0; }

/* === MODAL === */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .3s;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-box {
  background: var(--card); border-radius: var(--radius);
  padding: 32px; width: 100%; max-width: 500px;
  max-height: 90vh; overflow-y: auto;
  position: relative; box-shadow: var(--shadow-lg);
  transform: scale(.95); transition: transform .3s;
}

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

.modal-close {
  position: absolute; top: 16px; left: 16px;
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); display: flex;
  padding: 4px; border-radius: 4px;
  transition: background .2s;
}

.modal-close:hover { background: var(--bg-2); }

.modal-title { font-size: 22px; font-weight: 700; margin-bottom: 20px; color: var(--text); }

.checkout-summary {
  background: var(--bg-2); border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 20px;
  max-height: 200px; overflow-y: auto;
}

.checkout-summary-item {
  display: flex; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.checkout-summary-item:last-child { border-bottom: none; }
.checkout-summary-total { font-weight: 700; font-size: 16px; color: var(--primary); margin-top: 8px; text-align: left; }

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

.form-row { display: flex; gap: 12px; }

.checkout-form input, .checkout-form textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: var(--font-ar);
  background: var(--bg); color: var(--text);
  transition: border-color .2s;
}

[dir="ltr"] .checkout-form input,
[dir="ltr"] .checkout-form textarea { font-family: var(--font-en); }

.checkout-form input:focus, .checkout-form textarea:focus {
  outline: none; border-color: var(--primary);
}

/* === SUCCESS === */
.success-box { text-align: center; }

.success-icon {
  width: 80px; height: 80px; border-radius: 50%;
  background: #D1FAE5; display: flex;
  align-items: center; justify-content: center;
  margin: 0 auto 20px;
}

.success-box h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.success-box p { color: var(--text-muted); font-size: 15px; margin-bottom: 8px; }

.success-id {
  font-size: 13px; color: var(--primary);
  font-weight: 600; margin-bottom: 20px;
  font-family: monospace;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .main-nav { display: none; }
  .header-inner { gap: 12px; }
  .hero { padding: 60px 0 80px; }
  .hero-title { font-size: 28px; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
  .product-info { padding: 12px; }
  .product-price { font-size: 17px; }
  .cart-panel { width: 100%; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-name { font-size: 13px; }
  .product-desc { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
}