/* public/css/admin.css
   Admin panel. Same color tokens, denser layout. */

[hidden] { display: none !important; }

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-700: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #f59e0b;
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
body.lang-ar { font-family: "Segoe UI", Tahoma, "Cairo", "Noto Sans Arabic", Arial, sans-serif; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }

/* ---- Topbar ---- */
.admin-topbar {
  background: #0f172a;
  color: #f8fafc;
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 30;
}
.admin-topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 16px;
  gap: 16px;
}
.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
}
.admin-brand:hover { text-decoration: none; }
.admin-brand-mark {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
}
.admin-tag {
  font-size: 0.7rem;
  background: rgba(255,255,255,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  margin-inline-start: 6px;
}
.admin-topbar-actions { display: inline-flex; align-items: center; gap: 14px; }
.topbar-link { color: #cbd5e1; font-size: 0.9rem; }
.topbar-link:hover { color: #fff; }
.topbar-user { color: #94a3b8; font-size: 0.9rem; }
.lang-switch.small { display: inline-flex; gap: 6px; }
.lang-switch.small .lang-link { font-size: 0.8rem; color: #94a3b8; }
.lang-switch.small .lang-link.active { color: #fff; font-weight: 600; }

/* ---- Shell ---- */
.admin-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: calc(100vh - var(--topbar-h)); }
@media (max-width: 800px) { .admin-shell { grid-template-columns: 1fr; } }
.admin-sidebar {
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  padding: 16px 0;
}
.admin-sidebar nav { display: flex; flex-direction: column; }
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text);
  border-inline-start: 3px solid transparent;
}
.side-link:hover { background: var(--bg); text-decoration: none; }
.side-link.active { background: #eff6ff; border-inline-start-color: var(--primary); color: var(--primary); font-weight: 600; }
.admin-main { padding: 24px; min-width: 0; }

/* ---- Page head ---- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-title { font-size: 1.5rem; margin: 0; }
.page-actions { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-700); border-color: var(--primary-700); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 4px 9px; font-size: 0.85rem; }
.btn-lg { padding: 11px 18px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: #fee2e2; }

/* ---- Forms ---- */
input, textarea, select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}
label { display: block; font-weight: 500; margin-bottom: 4px; font-size: 0.9rem; }
.form-row { margin-bottom: 12px; }
.form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .form-row.two { grid-template-columns: 1fr; } }
.radio, .check { display: flex; align-items: center; gap: 8px; font-weight: normal; }
.radio input, .check input { width: auto; }
.margin-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.margin-tools input { width: 100px; }

/* ---- Cards / grid ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-title { font-size: 1.05rem; margin: 0 0 12px; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---- Stat cards ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--text);
  transition: all 0.15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); text-decoration: none; }
.stat-num { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--muted); font-size: 0.9rem; }

/* ---- Tables ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: middle; }
.data-table th { background: #f9fafb; font-size: 0.85rem; color: var(--muted); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table.compact th, .data-table.compact td { padding: 6px 10px; }
.thumb-sm { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
.thumb-md { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; }
.actions { white-space: nowrap; }
.actions form { display: inline-block; }
.current-images { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }

/* ---- Status pills ---- */
.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-published, .status-confirmed, .status-delivered { background: #dcfce7; color: #166534; }
.status-draft, .status-pending { background: #fef3c7; color: #92400e; }
.status-shipped { background: #dbeafe; color: #1e40af; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

/* ---- Filter bar ---- */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select { width: auto; min-width: 180px; }

/* ---- Form layout (form-grid) ---- */
.form-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .form-grid { grid-template-columns: 1fr; } }
.form-side .card { position: sticky; top: calc(var(--topbar-h) + 16px); }

/* ---- Empty / flash ---- */
.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
}
.empty.small { padding: 16px; }
.flash { padding: 12px 16px; border-radius: 8px; margin: 12px 16px; font-size: 0.95rem; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

/* ---- Login page ---- */
.login-body {
  min-height: 100vh;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #1e3a8a, #7c3aed);
}
.login-card {
  background: var(--surface);
  padding: 40px;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-logo {
  display: grid; place-items: center;
  width: 60px; height: 60px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  font-size: 1.6rem;
}
.login-title { margin: 0 0 4px; text-align: center; font-size: 1.3rem; }
.login-form { margin-top: 24px; }
.login-form .btn { margin-top: 8px; }

/* ---- URL import page ---- */
.url-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.url-form input { flex: 1; min-width: 280px; }
.url-form .grow { flex: 1; }
.import-preview { display: grid; grid-template-columns: 220px 1fr; gap: 16px; margin-top: 12px; }
@media (max-width: 700px) { .import-preview { grid-template-columns: 1fr; } }
.import-img { background: var(--bg); border-radius: 8px; padding: 8px; display: grid; place-items: center; min-height: 200px; }
.import-img img { max-height: 280px; border-radius: 6px; }
.import-body { background: var(--bg); border-radius: 8px; padding: 16px; }

/* ---- Misc ---- */
code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: 0.85rem; }
.status-form { display: flex; gap: 8px; }
.status-form select { width: auto; }
.kv { list-style: none; padding: 0; margin: 0; }
.kv li { padding: 4px 0; border-bottom: 1px dashed var(--border); }
