@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700;800&family=Scheherazade+New:wght@400;600;700&display=swap');

:root {
  --primary: #1D4ED8;
  --primary-dark: #1E40AF;
  --primary-light: #3B82F6;
  --primary-ghost: #EFF6FF;
  --accent: #111827;
  --bg: #F9FAFB;
  --bg2: #F3F4F6;
  --bg3: #E5E7EB;
  --card: #FFFFFF;
  --text: #111827;
  --text2: #374151;
  --text3: #6B7280;
  --text4: #9CA3AF;
  --border: #E5E7EB;
  --border2: #D1D5DB;
  --success: #059669;
  --danger: #DC2626;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
  --radius: 10px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
body.rtl { font-family: 'Scheherazade New', serif; font-size: 16px; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }

/* ── NAV ── */
.navbar {
  background: #0F172A;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}
.nav-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; height: 62px;
}
.nav-logo {
  font-size: 20px; font-weight: 800; color: #fff;
  letter-spacing: -0.5px; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.nav-logo span { color: var(--primary-light); }
.rtl .nav-logo { font-family: 'Scheherazade New', serif; font-size: 22px; }
.nav-search {
  flex: 1; max-width: 400px;
  display: flex; align-items: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; padding: 0 14px; gap: 8px; height: 38px;
  transition: border-color .2s;
}
.nav-search:focus-within { border-color: var(--primary-light); }
.nav-search input {
  background: none; border: none; outline: none;
  color: #fff; font-size: 14px; flex: 1; font-family: inherit;
}
.nav-search input::placeholder { color: rgba(255,255,255,0.35); }
.nav-search button { background: none; border: none; color: rgba(255,255,255,0.5); cursor: pointer; font-size: 15px; padding: 0; }
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav-links a {
  color: rgba(255,255,255,0.7); font-size: 14px; font-weight: 500;
  padding: 6px 12px; border-radius: 6px; transition: all .15s; white-space: nowrap;
}
.nav-links a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-cart { position: relative; }
.cart-badge {
  position: absolute; top: -2px; right: 2px;
  background: var(--primary); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}
.lang-switcher { display: flex; gap: 4px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,0.1); }
.lang-btn {
  padding: 4px 9px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.15);
  background: none; color: rgba(255,255,255,0.55); cursor: pointer;
  font-size: 12px; font-weight: 600; transition: all .15s; font-family: 'DM Sans', sans-serif;
}
.lang-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.lang-btn:hover:not(.active) { color: #fff; border-color: rgba(255,255,255,0.3); }

/* ── HERO ── */
.hero {
  background: linear-gradient(135deg, #0F172A 0%, #1E3A5F 60%, #1D4ED8 100%);
  padding: 64px 24px; text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(59,130,246,0.15) 0%, transparent 60%);
}
.hero-content { position: relative; max-width: 560px; margin: 0 auto; }
.hero h1 { font-size: 38px; font-weight: 800; color: #fff; margin-bottom: 10px; line-height: 1.2; }
.hero h1 span { color: #93C5FD; }
.hero p { color: rgba(255,255,255,0.65); font-size: 16px; margin-bottom: 32px; }
.rtl .hero h1 { font-family: 'Scheherazade New', serif; font-size: 42px; }

/* ── BANNER SLIDER ── */
.banner-slider { position: relative; overflow: hidden; border-radius: var(--radius-lg); margin: 28px auto; max-width: 1280px; }
.banner-track { display: flex; transition: transform .5s ease; }
.banner-slide { min-width: 100%; position: relative; aspect-ratio: 4/1; }
.banner-slide img { width: 100%; height: 100%; object-fit: cover; }
.banner-slide .banner-text {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  justify-content: center; padding: 40px;
  background: linear-gradient(90deg, rgba(0,0,0,0.65) 0%, transparent 65%);
}
.banner-text h2 { color: #fff; font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.banner-text p { color: rgba(255,255,255,0.8); font-size: 15px; }
.banner-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.banner-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); cursor: pointer; transition: all .2s; }
.banner-dot.active { background: var(--primary); width: 20px; border-radius: 3px; }

/* ── LAYOUT ── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.section { padding: 36px 0; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-size: 19px; font-weight: 700; color: var(--text); }
.view-all { color: var(--primary); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.view-all:hover { text-decoration: underline; }

/* ── CATEGORIES ── */
.cat-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-chip {
  padding: 7px 16px; border-radius: 20px; cursor: pointer; font-size: 13px; font-weight: 500;
  border: 1.5px solid var(--border); background: var(--card); color: var(--text2);
  transition: all .15s; white-space: nowrap;
}
.cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.cat-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── PRODUCT GRID ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}
.product-card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
  cursor: pointer; transition: box-shadow .2s, transform .2s;
  box-shadow: var(--shadow);
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border2); }
.product-img-wrap { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--bg2); }
.product-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.product-card:hover .product-img-wrap img { transform: scale(1.04); }
.badge-discount, .badge-sold {
  position: absolute; top: 8px; left: 8px;
  padding: 2px 7px; border-radius: 5px; font-size: 11px; font-weight: 700;
}
.badge-discount { background: var(--danger); color: #fff; }
.badge-sold { background: var(--text3); color: #fff; }
.product-info { padding: 12px 14px 14px; }
.product-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-price { font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.product-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text4); margin-bottom: 10px; }
.btn-cart {
  width: 100%; padding: 8px; border-radius: 7px;
  background: var(--accent); color: #fff; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s;
  font-family: inherit;
}
.btn-cart:hover { background: #1F2937; }

/* ── FILTERS ── */
.filters {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
  margin-bottom: 20px; box-shadow: var(--shadow);
}
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-group label { font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; }
.filter-group select, .filter-group input {
  padding: 8px 12px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 14px;
  outline: none; font-family: inherit; transition: border-color .15s; min-width: 140px;
}
.filter-group select:focus, .filter-group input:focus { border-color: var(--primary); }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer; font-size: 14px; font-weight: 600; transition: all .15s; font-family: inherit; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #1F2937; }
.btn-outline { background: none; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-ghost { background: var(--bg2); color: var(--text2); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg3); }

/* ── PRODUCT DETAIL ── */
.product-detail {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 48px; padding: 40px 0 60px; align-items: start;
}
.product-detail-img {
  position: sticky; top: 80px;
  border-radius: var(--radius-lg);
  background: var(--bg2); border: 1px solid var(--border); padding: 16px;
}
.product-detail-img > img,
.product-detail-img #gallery-main {
  width: 100%; max-height: 420px; object-fit: contain;
  border-radius: var(--radius); display: block; background: var(--bg2);
}
.product-detail-img .gthumb {
  width: 68px; height: 68px; object-fit: cover; border-radius: 7px;
  cursor: pointer; border: 2px solid var(--border);
  transition: border-color .15s, transform .15s; flex-shrink: 0;
}
.product-detail-img .gthumb:hover { transform: scale(1.05); border-color: var(--primary-light); }
.product-detail-info { display: flex; flex-direction: column; }
.product-detail-info h1 { font-size: 26px; font-weight: 800; line-height: 1.35; color: var(--text); margin-bottom: 14px; }
.product-detail-price { font-size: 30px; font-weight: 800; color: var(--primary); margin-bottom: 22px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.detail-meta { display: flex; flex-direction: column; gap: 0; margin-bottom: 22px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.detail-row { display: flex; align-items: stretch; font-size: 14px; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-row strong { color: var(--text3); font-weight: 600; min-width: 110px; padding: 10px 14px; background: var(--bg2); border-right: 1px solid var(--border); display: flex; align-items: center; font-size: 13px; }
.detail-row span { padding: 10px 14px; color: var(--text); display: flex; align-items: center; flex: 1; font-size: 14px; }
.seller-card { background: var(--bg2); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; border: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.seller-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 1px; }
.star { color: var(--border2); font-size: 15px; }
.star.filled { color: #F59E0B; }
.detail-actions { display: flex; flex-direction: column; gap: 10px; }
.product-desc-block { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.product-desc-block h3 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text3); margin-bottom: 9px; }
.product-desc-block p { font-size: 14px; line-height: 1.85; color: var(--text2); }

/* ── CART ── */
.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 28px; padding: 32px 0; }
.cart-items { display: flex; flex-direction: column; gap: 12px; }
.cart-item {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 14px 16px; display: flex; gap: 14px; align-items: center;
}
.cart-item img { width: 76px; height: 76px; border-radius: 8px; object-fit: cover; background: var(--bg2); flex-shrink: 0; }
.cart-item-info { flex: 1; }
.cart-item-info h4 { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.cart-item-price { font-size: 15px; font-weight: 700; color: var(--primary); }
.qty-ctrl { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.qty-btn { width: 26px; height: 26px; border-radius: 6px; border: 1.5px solid var(--border); background: var(--bg); cursor: pointer; font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.qty-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.qty-num { font-size: 14px; font-weight: 700; min-width: 26px; text-align: center; }
.cart-remove { background: none; border: none; color: var(--text4); cursor: pointer; font-size: 17px; padding: 4px; transition: color .15s; flex-shrink: 0; }
.cart-remove:hover { color: var(--danger); }
.cart-summary { background: var(--card); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 22px; position: sticky; top: 80px; box-shadow: var(--shadow-md); }
.cart-summary h3 { font-size: 16px; font-weight: 700; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.summary-row { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 14px; color: var(--text2); }
.summary-row.total { font-size: 16px; font-weight: 700; color: var(--text); border-top: 1px solid var(--border); padding-top: 12px; margin-top: 6px; }
.empty-cart { text-align: center; padding: 80px 24px; color: var(--text3); }
.empty-cart .icon { font-size: 56px; margin-bottom: 14px; }
.empty-cart h2 { font-size: 20px; margin-bottom: 6px; color: var(--text2); }

/* ── AUTH ── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0F172A 0%, #1E3A5F 100%); padding: 24px; }
.auth-card { background: var(--card); border-radius: var(--radius-lg); padding: 36px; width: 100%; max-width: 410px; box-shadow: var(--shadow-lg); position: relative; }
.auth-logo { text-align: center; font-size: 24px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.auth-logo .logo-mark { color: var(--primary); }
.rtl .auth-logo { font-family: 'Scheherazade New', serif; font-size: 28px; }
.auth-subtitle { text-align: center; color: var(--text3); margin-bottom: 28px; font-size: 13px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 5px; }
.form-group input {
  width: 100%; padding: 11px 14px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--bg);
  font-size: 14px; font-family: inherit; outline: none; transition: border-color .15s;
}
.form-group input:focus { border-color: var(--primary); background: #fff; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text3); }
.auth-switch a { color: var(--primary); font-weight: 600; }
.auth-tabs { display: flex; border-radius: 8px; overflow: hidden; border: 1.5px solid var(--border); margin-bottom: 24px; background: var(--bg2); }
.auth-tab { flex: 1; padding: 9px; text-align: center; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--text3); transition: all .15s; }
.auth-tab.active { background: var(--primary); color: #fff; }

/* ── PROFILE ── */
.profile-header { background: linear-gradient(135deg, #0F172A, #1E3A5F); color: #fff; padding: 36px 24px; margin-bottom: 28px; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; color: #fff; margin-bottom: 14px; border: 3px solid rgba(255,255,255,0.15); }
.profile-name { font-size: 22px; font-weight: 700; }
.profile-meta { color: rgba(255,255,255,0.55); font-size: 13px; margin-top: 3px; }
.profile-stats { display: flex; gap: 28px; margin-top: 18px; }
.stat { }
.stat-num { font-size: 22px; font-weight: 800; color: #93C5FD; }
.stat-label { font-size: 11px; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: .05em; margin-top: 1px; }
.order-card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.order-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.order-id { font-size: 13px; font-weight: 700; color: var(--text2); }
.order-status { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.status-pending { background: #FEF9C3; color: #854D0E; }
.status-completed { background: #DCFCE7; color: #166534; }
.status-cancelled { background: #FEE2E2; color: #991B1B; }
.order-items-list { display: flex; flex-direction: column; gap: 8px; }
.order-item-row { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.order-item-row img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--bg2); flex-shrink: 0; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--accent); color: #fff; padding: 11px 22px; border-radius: 8px;
  font-size: 14px; font-weight: 600; z-index: 9999; transition: transform .25s ease;
  box-shadow: var(--shadow-lg); white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.toast-error { background: var(--danger); }

/* ── PAGINATION ── */
.pagination { display: flex; justify-content: center; gap: 6px; padding: 28px 0; }
.page-btn { padding: 7px 13px; border-radius: 7px; border: 1.5px solid var(--border); background: var(--card); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text2); transition: all .15s; }
.page-btn:hover, .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── LOADING ── */
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.9s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state { text-align: center; padding: 60px; color: var(--text3); }

/* ── FOOTER ── */
footer { background: #0F172A; color: rgba(255,255,255,0.6); padding: 36px 0 20px; margin-top: 60px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 28px; margin-bottom: 28px; }
.footer-col h4 { color: rgba(255,255,255,0.85); font-size: 13px; font-weight: 700; margin-bottom: 12px; text-transform: uppercase; letter-spacing: .06em; }
.footer-col a { display: block; color: rgba(255,255,255,0.5); font-size: 13px; margin-bottom: 7px; transition: color .15s; }
.footer-col a:hover { color: #93C5FD; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.08); padding-top: 18px; text-align: center; font-size: 12px; color: rgba(255,255,255,0.35); }
.footer-logo { font-size: 20px; font-weight: 800; color: #fff; margin-bottom: 6px; }
.rtl .footer-logo { font-family: 'Scheherazade New', serif; font-size: 24px; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .product-detail { grid-template-columns: 1fr; gap: 24px; }
  .product-detail-img { position: static; }
  .cart-layout { grid-template-columns: 1fr; }
  .cart-summary { position: static; }
}
@media (max-width: 768px) {
  .nav-search { display: none; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hero h1 { font-size: 28px; }
  .banner-slide { aspect-ratio: 2/1; }
  .nav-inner { padding: 0 16px; }
  .container { padding: 0 16px; }
}
@media (max-width: 480px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .product-info { padding: 10px; }
  .product-title { font-size: 13px; }
}

/* ── RTL ── */
.rtl .badge-discount, .rtl .badge-sold { left: auto; right: 8px; }
.rtl .banner-text { background: linear-gradient(270deg, rgba(0,0,0,0.65) 0%, transparent 65%); }
.rtl .nav-links { margin-left: 0; margin-right: auto; }
.rtl .lang-switcher { padding-left: 0; padding-right: 8px; border-left: none; border-right: 1px solid rgba(255,255,255,0.1); }
.rtl .detail-row strong { border-right: none; border-left: 1px solid var(--border); }
