:root {
  --green-dark: #084d1a;
  --green:      #0b6623;
  --green-light:#e8f5e1;
  --gold:       #f4c542;
  --cream:      #faf9f4;
  --border:     #e0e8dc;
  --text:       #1f2a1f;
  --text-muted: #556055;
  --radius:     14px;
  --radius-sm:  8px;
  --shadow:     0 4px 16px rgba(11,102,35,0.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Cairo', system-ui, sans-serif; background: #f0f4f0; color: var(--text); direction: rtl; line-height: 1.6; }
img { max-width: 100%; }
.hidden { display: none !important; }

/* ═══ LOGIN ═══ */
.admin-login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  padding: 20px;
}
.admin-login-box {
  background: white; border-radius: 24px; padding: 48px 40px;
  width: 100%; max-width: 400px; text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
}
.admin-login-logo { width: 80px; height: 80px; border-radius: 50%; border: 3px solid var(--gold); margin: 0 auto 20px; object-fit: cover; }
.admin-login-box h1 { font-family: 'Almarai', sans-serif; color: var(--green-dark); font-size: 1.8rem; margin-bottom: 6px; }
.admin-login-box p { color: var(--text-muted); margin-bottom: 28px; }
.adm-form-group { text-align: right; margin-bottom: 18px; }
.adm-form-group label { display: block; font-weight: 600; margin-bottom: 7px; font-size: 0.92rem; }
.adm-form-group input {
  width: 100%; padding: 12px 18px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: 'Cairo', sans-serif; font-size: 1rem;
  background: var(--cream); transition: all 0.2s;
}
.adm-form-group input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(11,102,35,0.1); }
.adm-error { background: #fee2e2; border: 1px solid #fca5a5; color: #c62828; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 14px; }
.back-link { display: inline-block; margin-top: 20px; color: var(--text-muted); font-size: 0.9rem; }
.back-link:hover { color: var(--green); }

/* ═══ BUTTONS ═══ */
.adm-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 22px; border-radius: 999px;
  font-family: 'Cairo', sans-serif; font-weight: 700;
  font-size: 0.92rem; cursor: pointer; border: none;
  transition: all 0.2s; text-decoration: none; white-space: nowrap;
}
.adm-btn-primary { background: var(--gold); color: var(--green-dark); }
.adm-btn-primary:hover { background: #ffd24d; transform: translateY(-2px); }
.adm-btn-outline { background: transparent; border: 1.5px solid var(--green); color: var(--green); }
.adm-btn-outline:hover { background: var(--green-light); }
.adm-btn-danger { background: #c62828; color: white; }
.adm-btn-danger:hover { background: #b71c1c; }
.adm-btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.full { width: 100%; justify-content: center; }

/* ═══ HEADER ═══ */
.adm-header { background: var(--green-dark); color: white; padding: 0 24px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 12px rgba(0,0,0,0.2); }
.adm-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1200px; margin: 0 auto; height: 64px; }
.adm-logo { display: flex; align-items: center; gap: 12px; }
.adm-logo img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--gold); object-fit: cover; }
.adm-logo strong { display: block; font-family: 'Almarai', sans-serif; color: var(--gold); font-size: 1.05rem; }
.adm-logo small { font-size: 0.78rem; opacity: 0.7; }
.adm-header-actions { display: flex; gap: 10px; }

/* ═══ STATS ═══ */
.adm-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; padding: 24px; max-width: 1200px; margin: 0 auto;
}
.adm-stat-card {
  background: white; border-radius: var(--radius); padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.adm-stat-icon { font-size: 2rem; }
.adm-stat-card strong { display: block; font-size: 1.6rem; font-weight: 800; color: var(--green-dark); font-family: 'Almarai', sans-serif; }
.adm-stat-card small { font-size: 0.82rem; color: var(--text-muted); }

/* ═══ TOOLBAR ═══ */
.adm-toolbar { max-width: 1200px; margin: 0 auto; padding: 0 24px 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.adm-search { flex: 1; min-width: 220px; }
.adm-search input {
  width: 100%; padding: 10px 18px; border: 1.5px solid var(--border);
  border-radius: 999px; font-family: 'Cairo', sans-serif; font-size: 0.95rem;
  background: white; transition: all 0.2s;
}
.adm-search input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(11,102,35,0.1); }
.adm-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.adm-filter-btn {
  padding: 7px 16px; border-radius: 999px; font-family: 'Cairo', sans-serif;
  font-weight: 600; font-size: 0.85rem; cursor: pointer;
  border: 1.5px solid var(--border); background: white;
  transition: all 0.2s; color: var(--text-muted);
}
.adm-filter-btn.active { background: var(--green); color: white; border-color: var(--green); }
.adm-filter-btn:hover:not(.active) { border-color: var(--green); color: var(--green); }

/* ═══ ORDERS LIST ═══ */
.adm-orders-wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px 40px; }
.orders-list { display: flex; flex-direction: column; gap: 12px; }
.adm-order-card {
  background: white; border-radius: var(--radius); padding: 20px 24px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center;
  cursor: pointer; transition: all 0.2s;
}
.adm-order-card:hover { transform: translateX(-4px); box-shadow: 0 8px 28px rgba(11,102,35,0.15); border-color: var(--green); }
.adm-order-left h3 { font-family: 'Almarai', sans-serif; color: var(--green-dark); font-size: 1.05rem; margin-bottom: 4px; }
.adm-order-meta { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.adm-order-meta span { font-size: 0.85rem; color: var(--text-muted); }
.adm-order-meta .highlight { font-weight: 700; color: var(--green-dark); }
.adm-order-right { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

/* Status Badges */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 999px; font-size: 0.82rem; font-weight: 700;
}
.status-pending   { background: #fef3c7; color: #92400e; }
.status-confirmed { background: #dbeafe; color: #1e40af; }
.status-preparing { background: #ede9fe; color: #5b21b6; }
.status-shipped   { background: #d1fae5; color: #065f46; }
.status-delivered { background: #dcfce7; color: #14532d; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

.adm-empty { text-align: center; padding: 60px; color: var(--text-muted); }
.adm-empty span { font-size: 3rem; display: block; margin-bottom: 12px; }

/* ═══ ORDER DETAIL MODAL ═══ */
.adm-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(4px);
}
.adm-modal {
  background: white; border-radius: 20px; padding: 36px;
  width: 100%; max-width: 580px; max-height: 90vh; overflow-y: auto;
  position: relative; box-shadow: 0 24px 80px rgba(0,0,0,0.3);
  animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
.adm-modal-close {
  position: absolute; top: 16px; left: 16px; width: 32px; height: 32px;
  border-radius: 50%; background: #fee2e2; border: none; font-size: 1rem;
  cursor: pointer; color: #c62828;
}
.adm-modal-title { font-family: 'Almarai', sans-serif; color: var(--green-dark); font-size: 1.4rem; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--border); }

/* Order detail content */
.order-detail-section { margin-bottom: 24px; }
.order-detail-section h4 { font-family: 'Almarai', sans-serif; color: var(--green); margin-bottom: 12px; font-size: 1rem; }
.order-detail-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.order-detail-row:last-child { border-bottom: none; }
.order-detail-row label { color: var(--text-muted); }
.order-detail-row span { font-weight: 600; }

.status-select-wrap { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.status-select {
  flex: 1; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: 'Cairo', sans-serif;
  font-size: 0.95rem; cursor: pointer; background: var(--cream);
}
.status-select:focus { outline: none; border-color: var(--green); }

.order-item-line { display: flex; justify-content: space-between; padding: 8px 12px; background: var(--cream); border-radius: var(--radius-sm); margin-bottom: 6px; font-size: 0.95rem; }
.total-section { background: var(--green-dark); color: white; border-radius: var(--radius-sm); padding: 16px; margin-top: 12px; }
.total-section .row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.95rem; opacity: 0.85; }
.total-section .row.grand { font-size: 1.1rem; font-weight: 800; opacity: 1; color: var(--gold); padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.2); margin-top: 8px; }

.whatsapp-action { background: #25D366; color: white; border: none; padding: 12px 20px; border-radius: 999px; font-family: 'Cairo', sans-serif; font-weight: 700; cursor: pointer; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; width: 100%; justify-content: center; margin-top: 16px; transition: all 0.2s; }
.whatsapp-action:hover { background: #128C7E; transform: translateY(-2px); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 900px) {
  .adm-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .adm-stats { grid-template-columns: 1fr 1fr; padding: 16px; }
  .adm-toolbar { flex-direction: column; }
  .adm-order-card { grid-template-columns: 1fr; }
  .adm-order-right { align-items: flex-start; flex-direction: row; }
  .admin-login-box { padding: 30px 20px; }
  .adm-modal { padding: 24px 16px; }
}
