/* ===================================================
   قريب (Qareeb) - الأنماط الرئيسية
   RTL - Arabic - Modern UI
   =================================================== */

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

/* ===== المتغيرات ===== */
:root {
  --green: #2AA33B;
  --green-dark: #218A2E;
  --green-light: #E8F5EA;
  --green-mid: #4CAF50;
  --orange: #FF8A00;
  --orange-light: #FFF3E0;
  --orange-dark: #E07000;
  --white: #FFFFFF;
  --bg: #F5F6FA;
  --bg2: #FAFBFE;
  --border: #E8EAEF;
  --text: #1A1A2E;
  --text-mid: #444460;
  --text-light: #7A7A9A;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.13);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: all 0.25s ease;
  --header-h: 70px;
}

/* ===== ريست عام ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Cairo', sans-serif;
  direction: rtl;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
button { cursor: pointer; font-family: 'Cairo', sans-serif; border: none; background: none; }
input, select, textarea { font-family: 'Cairo', sans-serif; }

/* ===== الهيدر ===== */
.header {
  position: fixed;
  top: 0; right: 0; left: 0;
  z-index: 1000;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  height: var(--header-h);
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.logo img {
  height: 44px;
  width: auto;
  object-fit: contain;
}
.logo-text {
  font-size: 22px;
  font-weight: 900;
  color: var(--green);
  letter-spacing: -0.5px;
}
.logo-text span { color: var(--orange); }
.search-bar {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 50px;
  padding: 0 16px;
  gap: 10px;
  transition: var(--transition);
  max-width: 600px;
}
.search-bar:focus-within {
  border-color: var(--green);
  background: var(--white);
  box-shadow: 0 0 0 3px var(--green-light);
}
.search-bar input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  color: var(--text);
  padding: 10px 0;
}
.search-bar input::placeholder { color: var(--text-light); }
.search-bar .search-icon {
  color: var(--text-light);
  font-size: 16px;
}
.search-bar button {
  background: var(--green);
  color: white;
  border-radius: 50px;
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}
.search-bar button:hover { background: var(--green-dark); }
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.header-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  transition: var(--transition);
  cursor: pointer;
}
.header-btn:hover { background: var(--bg); color: var(--green); }
.header-btn .icon { font-size: 18px; }
.location-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 12px;
  color: var(--text-mid);
  cursor: pointer;
  transition: var(--transition);
  max-width: 140px;
}
.location-btn:hover { border-color: var(--green); color: var(--green); }
.location-btn .pin { color: var(--orange); font-size: 13px; }
.location-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--green);
  color: white;
  padding: 9px 18px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 700;
  transition: var(--transition);
}
.cart-btn:hover { background: var(--green-dark); transform: translateY(-1px); }
.cart-count {
  background: var(--orange);
  color: white;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

/* ===== شريط التنقل ===== */
.nav-bar {
  background: var(--green);
  padding: 0;
  position: sticky;
  top: var(--header-h);
  z-index: 900;
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar { display: none; }
.nav-link {
  color: rgba(255,255,255,0.85);
  padding: 13px 18px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
  border-bottom: 3px solid transparent;
}
.nav-link:hover, .nav-link.active {
  color: white;
  border-bottom-color: var(--orange);
  background: rgba(255,255,255,0.1);
}

/* ===== محتوى الصفحة ===== */
.page-content {
  padding-top: calc(var(--header-h) + 48px);
  min-height: 100vh;
}

/* ===== البطاقات ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* ===== الأزرار ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 700;
  transition: var(--transition);
  cursor: pointer;
  border: none;
}
.btn-green { background: var(--green); color: white; }
.btn-green:hover { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(42,163,59,0.35); }
.btn-orange { background: var(--orange); color: white; }
.btn-orange:hover { background: var(--orange-dark); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(255,138,0,0.35); }
.btn-outline { background: transparent; color: var(--green); border: 2px solid var(--green); }
.btn-outline:hover { background: var(--green); color: white; }
.btn-ghost { background: var(--bg); color: var(--text-mid); }
.btn-ghost:hover { background: var(--border); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-lg { padding: 15px 32px; font-size: 17px; }
.btn-full { width: 100%; }

/* ===== العناوين ===== */
.section-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.section-subtitle {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 24px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-header .view-all {
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
}
.section-header .view-all:hover { text-decoration: underline; }

/* ===== Badge ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
}
.badge-green { background: var(--green-light); color: var(--green-dark); }
.badge-orange { background: var(--orange-light); color: var(--orange-dark); }
.badge-red { background: #FEE2E2; color: #DC2626; }
.badge-gray { background: #F1F1F5; color: var(--text-light); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--green); }
.toast.error { background: #DC2626; }

/* ===== شريط الموبايل السفلي ===== */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-top: 1px solid var(--border);
  padding: 8px 0 12px;
  z-index: 999;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.mobile-nav-inner {
  display: flex;
  justify-content: space-around;
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 12px;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 600;
  transition: var(--transition);
}
.mobile-nav-item.active, .mobile-nav-item:hover { color: var(--green); }
.mobile-nav-item .icon { font-size: 20px; }

/* ===== الفوتر ===== */
.footer {
  background: #1A1A2E;
  color: rgba(255,255,255,0.8);
  padding: 48px 0 24px;
  margin-top: 60px;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.footer-brand .logo-text { color: white; margin-bottom: 12px; }
.footer-brand p { font-size: 13px; line-height: 1.8; color: rgba(255,255,255,0.6); }
.footer-col h4 { color: white; font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.footer-col a { display: block; color: rgba(255,255,255,0.6); font-size: 13px; margin-bottom: 10px; transition: var(--transition); }
.footer-col a:hover { color: var(--green-mid); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}
.social-links { display: flex; gap: 12px; }
.social-link {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 14px;
  transition: var(--transition);
}
.social-link:hover { background: var(--green); }

/* ===== Container ===== */
.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }

/* ===== الشبكات ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }

/* ===== Divider ===== */
.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* ===== المدخلات ===== */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 600; color: var(--text-mid); margin-bottom: 8px; }
.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: var(--transition);
  outline: none;
  direction: rtl;
}
.form-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-light); }
.form-input::placeholder { color: var(--text-light); }
textarea.form-input { resize: vertical; min-height: 100px; }
select.form-input { appearance: none; cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== محدد الكمية ===== */
.qty-selector {
  display: flex;
  align-items: center;
  gap: 0;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.qty-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  transition: var(--transition);
}
.qty-btn:hover { background: var(--green); color: white; }
.qty-val {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  min-width: 40px;
  padding: 0 8px;
}

/* ===== التقييم ===== */
.stars { color: #FFC107; font-size: 14px; }
.rating-text { font-size: 13px; color: var(--text-light); }

/* ===== Breadcrumb ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 24px;
}
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--green); }
.breadcrumb .sep { font-size: 12px; }
.breadcrumb .current { color: var(--text); font-weight: 600; }

/* ===== Tab ===== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab-btn {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}
.tab-btn.active { color: var(--green); border-bottom-color: var(--green); }
.tab-btn:hover { color: var(--green); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 480px;
  width: 90%;
  position: relative;
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-close {
  position: absolute;
  top: 16px; left: 16px;
  width: 32px; height: 32px;
  background: var(--bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition);
}
.modal-close:hover { background: var(--border); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
}

@media (max-width: 768px) {
  .search-bar { display: none; }
  .location-btn, .header-btn:not(.cart-btn) { display: none; }
  .mobile-nav { display: block; }
  .page-content { padding-top: calc(var(--header-h) + 40px); padding-bottom: 80px; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; gap: 16px; text-align: center; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .grid-3, .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .section-title { font-size: 18px; }
}
