/* ==========================================
   1. Colors & Design System
========================================== */
:root {
  --primary-gold: #D4AF37;
  --primary-gold-dark: #B89320;
  --primary-gold-light: #F4E8C1;
  
  /* الوضع النهاري */
  --bg-color: #FAFAFA;
  --card-bg: #FFFFFF;
  --text-color: #1A1A1A;
  --text-muted: #666666;
  --border-color: #EAEAEA;
  --input-bg: #FFFFFF;
  --shadow-color: rgba(0, 0, 0, 0.05);
  --shadow-hover: rgba(212, 175, 55, 0.2);
}

/* الوضع الليلي المحسّن بالكامل للقراءة الواضحة */
body.dark-mode {
  --bg-color: #121212;
  --card-bg: #1E1E1E;
  --text-color: #F5F5F7;      /* نص ناصع ومريح للعين */
  --text-muted: #B0B0B0;      /* نص رمادي روشن غير باهت */
  --border-color: #2D2D2D;
  --input-bg: #262626;
  --shadow-color: rgba(0, 0, 0, 0.4);
  --shadow-hover: rgba(212, 175, 55, 0.3);
}

/* ==========================================
   2. Reset & Smooth Animations
========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  direction: rtl;
  line-height: 1.6;
  transition: background-color 0.4s ease, color 0.4s ease;
}

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

/* ==========================================
   3. Header & Brand Text
========================================== */
.main-header {
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 999;
  box-shadow: 0 4px 15px var(--shadow-color);
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-text {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-color);
  text-decoration: none;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.3s ease;
}

.brand-text:hover {
  transform: scale(1.02);
}

.gold-icon {
  color: var(--primary-gold);
}

.main-nav {
  display: flex;
  gap: 10px;
}

.main-nav button {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  font-size: 1.1rem;
  color: var(--text-color);
  cursor: pointer;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-nav button:hover {
  color: var(--primary-gold);
  border-color: var(--primary-gold);
  transform: translateY(-2px);
}

/* ==========================================
   4. Controls & Search Box
========================================== */
.controls-section {
  padding: 24px 15px 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-gold);
  transition: transform 0.3s ease;
}

.search-box input {
  width: 100%;
  padding: 14px 48px 14px 18px;
  border: 1px solid var(--border-color);
  border-radius: 30px;
  background-color: var(--input-bg);
  color: var(--text-color);
  outline: none;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.search-box input:focus {
  border-color: var(--primary-gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.category-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.cat-btn, .fav-filter-btn {
  background-color: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  padding: 8px 20px;
  border-radius: 25px;
  white-space: nowrap;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cat-btn.active, .fav-filter-btn.active {
  background-color: var(--primary-gold);
  color: #FFFFFF;
  border-color: var(--primary-gold);
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.cat-btn:hover:not(.active), .fav-filter-btn:hover:not(.active) {
  border-color: var(--primary-gold);
  color: var(--primary-gold);
}

/* ==========================================
   5. Products Grid & Card Animations
========================================== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
  padding: 15px 0 50px;
}

.product-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 15px var(--shadow-color);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease, border-color 0.35s ease;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.5s ease forward;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 25px var(--shadow-hover);
  border-color: var(--primary-gold);
}

.product-image {
  position: relative;
  aspect-ratio: 1;
  background-color: var(--input-bg);
  cursor: pointer;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

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

.product-fav-btn {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-color);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: transform 0.2s ease, color 0.2s ease;
}

.product-fav-btn:hover {
  transform: scale(1.1);
  color: var(--primary-gold);
}

.product-info {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}

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

.product-price {
  color: var(--primary-gold);
  font-weight: 800;
  font-size: 1.25rem;
  margin-bottom: 14px;
}

.btn-whatsapp {
  background-color: var(--primary-gold);
  color: #FFFFFF !important;
  border: none;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(212, 175, 55, 0.25);
}

.btn-whatsapp:hover {
  background-color: var(--primary-gold-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(212, 175, 55, 0.4);
}

/* ==========================================
   6. Modals & Animated Transitions
========================================== */
.modal {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 15px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background-color: var(--card-bg);
  border-radius: 20px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 28px;
  border: 1px solid var(--border-color);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: var(--text-color);
}

.modal.active .modal-content {
  transform: scale(1);
}

.close-btn {
  position: absolute;
  top: 15px;
  left: 18px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background-color: #EF4444;
  color: #FFF;
  border-color: #EF4444;
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

@media (max-width: 650px) {
  .modal-body {
    grid-template-columns: 1fr;
  }
}

#modal-main-img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  border-radius: 12px;
}

.modal-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
}

.modal-thumbs img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.modal-thumbs img.active {
  border-color: var(--primary-gold);
}

.modal-info label {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.color-chip {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin: 3px;
  cursor: pointer;
  font-size: 0.85rem;
  background-color: var(--input-bg);
  color: var(--text-color);
  transition: all 0.2s ease;
}

.color-chip.selected {
  border-color: var(--primary-gold);
  background-color: var(--primary-gold);
  color: #FFFFFF;
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}

.quantity-control button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  color: var(--text-color);
  cursor: pointer;
  border-radius: 6px;
  font-size: 1.1rem;
}

.quantity-control input {
  width: 55px;
  text-align: center;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  color: var(--text-color);
  padding: 5px;
  border-radius: 6px;
}

/* ==========================================
   7. Admin & Form Styles (وضع ليلي متوافق)
========================================== */
.admin-modal-content {
  max-width: 820px;
}

.admin-form label {
  color: var(--text-muted);
}

.admin-form input, .admin-form select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--input-bg);
  color: var(--text-color);
  font-size: 0.95rem;
}

.admin-form input:focus, .admin-form select:focus {
  border-color: var(--primary-gold);
  outline: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn-submit {
  background-color: var(--primary-gold);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  transition: background-color 0.2s;
}

.btn-submit:hover {
  background-color: var(--primary-gold-dark);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  color: var(--text-color);
}

.admin-table th, .admin-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
  text-align: right;
}

/* Toast Animations */
.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--primary-gold);
  color: #FFFFFF;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
/* ==========================================
   تحديث لون زر الواتساب إلى الأخضر
========================================== */
.btn-whatsapp {
  background-color: #25D366; /* لون الواتساب الأخضر الرسمي */
  color: #FFFFFF !important;
  border: none;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
}

.btn-whatsapp:hover {
  background-color: #1EBE5D; /* درجة أخضر أغمق قليلاً عند التمرير */
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
}
