/* =============================
   ADMIN – BASE
   ============================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Heebo', sans-serif;
  direction: rtl;
  background: #f0f4f8;
  color: #1a1a2e;
  min-height: 100vh;
}

/* =============================
   LOGIN
   ============================= */
.login-overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #003f8a 0%, #0057c2 100%);
  padding: 20px;
}

.login-box {
  background: white;
  border-radius: 24px;
  padding: 44px 36px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
  text-align: center;
}

.login-logo { font-size: 3rem; margin-bottom: 12px; }
.login-box h2 { font-size: 1.8rem; font-weight: 800; color: #003f8a; margin-bottom: 6px; }
.login-sub { font-size: 0.9rem; color: #777; margin-bottom: 28px; line-height: 1.5; }

.form-group {
  margin-bottom: 18px;
  text-align: right;
}
.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid #d0d9f0;
  border-radius: 12px;
  font-family: 'Heebo', sans-serif;
  font-size: 1rem;
  color: #222;
  background: #fafbff;
  direction: rtl;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.form-group input:focus,
.form-group select:focus {
  border-color: #0057c2;
  box-shadow: 0 0 0 4px rgba(0,87,194,0.12);
  outline: none;
  background: white;
}

.pass-wrap { position: relative; }
.pass-wrap input { padding-left: 48px; }
.show-pass {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
}
.show-pass:hover { color: #0057c2; }

.login-error {
  color: #e63946;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
  min-height: 22px;
}

.btn-login {
  width: 100%;
  background: linear-gradient(135deg, #0057c2, #003f8a);
  color: white;
  font-family: 'Heebo', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 15px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}
.btn-login:hover {
  background: linear-gradient(135deg, #0068e1, #004db3);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,63,138,0.3);
}

.back-link {
  color: #888;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s;
}
.back-link:hover { color: #0057c2; }

/* =============================
   ADMIN HEADER
   ============================= */
.admin-header {
  background: linear-gradient(135deg, #003f8a, #0057c2);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.admin-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.flag-icon { font-size: 2rem; }
.admin-title { font-size: 1.2rem; font-weight: 800; }
.admin-subtitle { font-size: 0.75rem; opacity: 0.75; }

.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.btn-refresh, .btn-export, .btn-logout {
  border: none;
  border-radius: 10px;
  font-family: 'Heebo', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 9px 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-refresh {
  background: rgba(255,255,255,0.15);
  color: white;
}
.btn-refresh:hover { background: rgba(255,255,255,0.25); }

.btn-export {
  background: #1d8348;
  color: white;
}
.btn-export:hover { background: #196f3d; }

.btn-logout {
  background: rgba(255,255,255,0.12);
  color: white;
}
.btn-logout:hover { background: rgba(255,100,100,0.25); }

/* =============================
   STATS BAR
   ============================= */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  max-width: 1400px;
  margin: 24px auto 0;
  padding: 0 24px;
}

.stat-card {
  background: white;
  border-radius: 16px;
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: white;
  flex-shrink: 0;
}
.stat-icon.blue   { background: linear-gradient(135deg, #0057c2, #003f8a); }
.stat-icon.green  { background: linear-gradient(135deg, #1d8348, #145a32); }
.stat-icon.orange { background: linear-gradient(135deg, #e67e22, #d35400); }
.stat-icon.teal   { background: linear-gradient(135deg, #17a589, #0e6655); }

.stat-num { font-size: 1.7rem; font-weight: 900; color: #1a1a2e; }
.stat-label { font-size: 0.8rem; color: #888; }

/* =============================
   CONTROLS
   ============================= */
.controls-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  max-width: 1400px;
  margin: 20px auto 0;
  padding: 0 24px;
  flex-wrap: wrap;
}

.search-wrap {
  flex: 1;
  min-width: 240px;
  position: relative;
}
.search-wrap i {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
}
.search-wrap input {
  width: 100%;
  padding: 11px 42px 11px 16px;
  border: 2px solid #d0d9f0;
  border-radius: 12px;
  font-family: 'Heebo', sans-serif;
  font-size: 0.95rem;
  background: white;
  direction: rtl;
}
.search-wrap input:focus {
  border-color: #0057c2;
  outline: none;
  box-shadow: 0 0 0 4px rgba(0,87,194,0.1);
}

.filter-wrap select {
  padding: 11px 16px;
  border: 2px solid #d0d9f0;
  border-radius: 12px;
  font-family: 'Heebo', sans-serif;
  font-size: 0.95rem;
  background: white;
  color: #333;
  cursor: pointer;
}
.filter-wrap select:focus { border-color: #0057c2; outline: none; }

/* =============================
   TABLE
   ============================= */
.table-wrap {
  max-width: 1400px;
  margin: 20px auto 40px;
  padding: 0 24px;
}

.table-loading, .table-empty {
  background: white;
  border-radius: 16px;
  padding: 60px;
  text-align: center;
  color: #888;
  font-size: 1.1rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.table-loading i, .table-empty i {
  display: block;
  font-size: 2rem;
  margin-bottom: 12px;
  color: #bbb;
}
.table-empty i { font-size: 3rem; }

.table-scroll {
  background: white;
  border-radius: 16px;
  overflow-x: auto;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 900px;
}

.orders-table thead tr {
  background: linear-gradient(135deg, #003f8a, #0057c2);
  color: white;
}

.orders-table th {
  padding: 14px 16px;
  text-align: right;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

.orders-table tbody tr {
  border-bottom: 1px solid #eef0f5;
  transition: background 0.2s;
}
.orders-table tbody tr:hover { background: #f5f8ff; }

.orders-table td {
  padding: 13px 16px;
  vertical-align: middle;
  white-space: nowrap;
}

.orders-table td.notes-cell {
  white-space: normal;
  max-width: 200px;
  min-width: 100px;
  font-size: 0.82rem;
  color: #555;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: table-cell;
  vertical-align: middle;
}

/* ---- Inline Status Dropdown ---- */
.status-select {
  font-family: 'Heebo', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 20px;
  border: 2px solid transparent;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
  min-width: 140px;
  appearance: auto;
}
.status-select:hover   { filter: brightness(0.95); }
.status-select:focus   { box-shadow: 0 0 0 3px rgba(0,87,194,0.2); }
.status-select:disabled { opacity: 0.5; cursor: wait; }

.status-select.status-pending  { background: #fff3cd; color: #856404; border-color: #f0c040; }
.status-select.status-paid     { background: #d1e7dd; color: #0a3622; border-color: #71c894; }
.status-select.status-shipped  { background: #ddf2fb; color: #0c5d7a; border-color: #6ecff0; }

/* Row actions */
.row-actions { display: flex; gap: 8px; align-items: center; }
.btn-del {
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Heebo', sans-serif;
  font-weight: 600;
  white-space: nowrap;
  background: #fde8e8;
  color: #c0392b;
  display: flex;
  align-items: center;
  gap: 5px;
}
.btn-del:hover { background: #c0392b; color: white; }

/* Table Footer */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 0;
  font-size: 0.85rem;
  color: #666;
  flex-wrap: wrap;
  gap: 10px;
}
.pagination { display: flex; gap: 6px; }
.page-btn {
  background: white;
  border: 2px solid #d0d9f0;
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  font-family: 'Heebo', sans-serif;
  transition: all 0.2s;
}
.page-btn:hover, .page-btn.active {
  background: #0057c2;
  border-color: #0057c2;
  color: white;
}

/* Helpers */
.link-blue  { color: #0057c2; text-decoration: none; }
.link-blue:hover { text-decoration: underline; }
.nowrap     { white-space: nowrap; }
.text-center { text-align: center; }

/* =============================
   TOAST
   ============================= */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a2e;
  color: white;
  padding: 13px 28px;
  border-radius: 50px;
  font-family: 'Heebo', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.toast.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.toast-success { background: #1a4d2e; }
.toast.toast-error   { background: #5c1010; }

/* =============================
   MODALS
   ============================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal-box {
  background: white;
  border-radius: 20px;
  padding: 36px 28px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: popIn 0.25s ease;
}
@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.modal-box h3 { font-size: 1.3rem; font-weight: 800; color: #003f8a; margin-bottom: 12px; }
.modal-box p  { color: #555; margin-bottom: 16px; font-size: 0.95rem; }

.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

.btn-save, .btn-delete-confirm, .btn-cancel {
  border: none;
  border-radius: 10px;
  font-family: 'Heebo', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 10px 22px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-save { background: #0057c2; color: white; }
.btn-save:hover { background: #003f8a; }
.btn-delete-confirm { background: #c0392b; color: white; }
.btn-delete-confirm:hover { background: #a93226; }
.btn-cancel { background: #eee; color: #555; }
.btn-cancel:hover { background: #ddd; }

.delete-icon { font-size: 3rem; text-align: center; margin-bottom: 12px; }
.delete-warn { color: #e63946; font-weight: 700; font-size: 0.9rem; }

/* =============================
   RESPONSIVE
   ============================= */
@media (max-width: 768px) {
  .admin-header-inner { padding: 12px 16px; }
  .stats-bar, .controls-bar, .table-wrap { padding: 0 12px; }
  .stats-bar { margin-top: 16px; }
  .btn-export span, .btn-logout span { display: none; }
  .admin-title { font-size: 1rem; }
}

@media (max-width: 480px) {
  .login-box { padding: 32px 20px; }
  .stat-card { padding: 14px 12px; gap: 10px; }
  .stat-num { font-size: 1.4rem; }
  .header-actions { gap: 6px; }
}
