/* =========================================
   Modern E-commerce UI (Mobile First)
   ========================================= */

:root {
  /* الألوان الأساسية */
  --primary: #00a651;       /* أخضر زاهي (مثل الصور) */
  --primary-dark: #008a43;
  --secondary: #ff4fa1;     /* وردي */
  --accent: #6c5ce7;        /* بنفسجي */
  --danger: #ff3b30;
  --warning: #ff9500;
  
  /* ألوان الخلفية والنصوص */
  --bg-body: #f8f9fa;
  --bg-card: #ffffff;
  --text-main: #1a1a1a;
  --text-muted: #8e8e93;
  --border-color: #f1f1f1;
  
  /* الظلال والحواف */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 999px;
  
  /* الخطوط */
  --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  padding-bottom: 80px; /* مساحة للشريط السفلي */
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

/* =========================================
   Top Bar & Navigation
   ========================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  color: var(--primary);
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.brand-dot {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.topnav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.topnav a {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.topnav a:hover, .topnav a.active {
  background: var(--bg-body);
  color: var(--primary);
}

.topnav .chip {
  background: var(--primary);
  color: #fff;
}

/* =========================================
   Announcement
   ========================================= */
.announcement {
  margin: 12px 16px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 12px;
}

.announcement-img {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.announcement-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

/* =========================================
   Container & Cards
   ========================================= */
.container {
  width: 100%;
  max-width: 600px; /* عرض مناسب للموبايل */
  margin: 0 auto;
  padding: 0 16px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

.narrow {
  max-width: 400px;
  margin: 20px auto;
}

/* =========================================
   Hero & Search
   ========================================= */
.hero {
  margin-bottom: 20px;
}

.hero h1 {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 8px;
}

.hero p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.search {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.search input, .search select {
  flex: 1;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search input:focus, .search select:focus {
  border-color: var(--primary);
}

.search select {
  max-width: 120px;
  flex: none;
}

/* =========================================
   Product Grid (2 Columns)
   ========================================= */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding-bottom: 20px;
}

.product-card {
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.product-card:active {
  transform: scale(0.98);
}

.product-img {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1; /* مربع */
  background: #f9f9f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

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

.product-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-cat {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.product-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
}

/* =========================================
   Product View (Single)
   ========================================= */
.product-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.product-view-img img {
  width: 100%;
  border-radius: var(--radius-lg);
  object-fit: cover;
  max-height: 350px;
}

.price-big {
  font-size: 28px;
  font-weight: 900;
  color: var(--primary);
  margin: 12px 0;
}

.note-box {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 12px 0;
}

.note-title {
  font-weight: 800;
  color: #f57f17;
  margin-bottom: 4px;
  font-size: 14px;
}

/* =========================================
   Buttons
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  width: 100%;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover {
  background: #d32f2f;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  width: auto;
}

/* =========================================
   Forms & Inputs
   ========================================= */
.field {
  margin-bottom: 16px;
}

.field span {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #fff;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.1);
}

/* =========================================
   Cart & Tables
   ========================================= */
.cart-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.cart-thumb {
  width: 70px;
  height: 70px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f0f0f0;
  flex-shrink: 0;
}

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

.cart-main {
  flex: 1;
}

.cart-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}

.cart-qty input {
  width: 60px;
  padding: 8px;
  text-align: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.cart-total {
  margin-top: 20px;
  padding: 16px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* =========================================
   Payment & Checkout
   ========================================= */
.pay-methods {
  margin: 16px 0;
}

.pay-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #fff;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.pay-card:hover {
  border-color: var(--primary);
}

.pay-card input[type="radio"] {
  margin-top: 4px;
  accent-color: var(--primary);
  width: 20px;
  height: 20px;
}

.pay-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
}

.pay-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

/* =========================================
   Badges & Status
   ========================================= */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-ok, .badge-completed {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-warn, .badge-pending_review {
  background: #fff3e0;
  color: #ef6c00;
}

.badge-danger, .badge-rejected {
  background: #ffebee;
  color: #c62828;
}

.badge-role {
  background: #e3f2fd;
  color: #1565c0;
}

/* =========================================
   Admin Panel
   ========================================= */
.admin-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-menu {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.admin-title {
  padding: 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
}

.admin-menu a {
  display: block;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  color: var(--text-muted);
  transition: background 0.2s;
}

.admin-menu a:last-child {
  border-bottom: none;
}

.admin-menu a.active, .admin-menu a:hover {
  background: #f0fdf4;
  color: var(--primary);
  border-right: 4px solid var(--primary);
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat {
  background: #fff;
  padding: 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.stat-num {
  font-size: 24px;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 4px;
}

/* =========================================
   Bottom Navigation (Mobile App Style)
   ========================================= */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  z-index: 200;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.footer-links {
  display: flex;
  width: 100%;
  justify-content: space-around;
}

.footer-links a {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  gap: 4px;
}

.footer-links a::before {
  content: '•'; /* يمكن استبداله بأيقونات SVG */
  font-size: 20px;
  line-height: 1;
}

.footer-links a:hover {
  color: var(--primary);
}

/* إخفاء حقوق النشر في الموبايل لصالح الشريط السفلي */
.footer > .muted {
  display: none;
}

/* =========================================
   WhatsApp Float
   ========================================= */
.whatsapp-float {
  position: fixed;
  bottom: 90px; /* فوق الشريط السفلي */
  left: 16px;
  z-index: 150;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0; /* إخفاء النص */
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  transition: transform 0.2s;
}

.whatsapp-float::before {
  content: '💬'; /* أيقونة واتساب بديلة */
  font-size: 24px;
}

.whatsapp-float:active {
  transform: scale(0.9);
}

/* =========================================
   Responsive (Tablet & Desktop)
   ========================================= */
@media (min-width: 768px) {
  .container {
    max-width: 960px;
    padding: 0 24px;
  }
  
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .product-view {
    flex-direction: row;
    align-items: flex-start;
  }
  
  .product-view-img {
    flex: 1;
  }
  
  .product-view-info {
    flex: 1;
    padding-right: 24px;
  }
  
  .admin-wrap {
    flex-direction: row;
  }
  
  .admin-menu {
    width: 250px;
    flex-shrink: 0;
  }
  
  .admin-main {
    flex: 1;
  }
  
  .stats {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .footer {
    position: static;
    box-shadow: none;
    border-top: none;
    padding: 20px 0;
  }
  
  .footer-links {
    justify-content: center;
    gap: 24px;
  }
  
  .footer > .muted {
    display: block;
    text-align: center;
    margin-top: 12px;
  }
  
  .whatsapp-float {
    bottom: 24px;
    left: 24px;
  }
}