/* ============================================================
   ADMIN PANEL — لوحة تحكم أحنُّ أرزاقي
   ============================================================ */
:root {
  --adm-bg: #f2f2f7;
  --adm-card: #ffffff;
  --adm-border: rgba(60,60,67,0.14);
  --adm-text: #111111;
  --adm-text-2: rgba(60,60,67,0.62);
  --adm-text-3: rgba(60,60,67,0.35);
  --adm-accent: #007aff;
  --adm-accent-soft: rgba(0,122,255,0.12);
  --adm-green: #34c759;
  --adm-green-soft: rgba(52,199,89,0.14);
  --adm-red: #ff3b30;
  --adm-red-soft: rgba(255,59,48,0.12);
  --adm-orange: #ff9500;
  --adm-orange-soft: rgba(255,149,0,0.15);
  --adm-purple: #af52de;
  --adm-shadow: 0 2px 10px rgba(0,0,0,0.05), 0 10px 30px rgba(0,0,0,0.06);
  --adm-radius: 16px;
  --adm-ease: cubic-bezier(.22,1,.36,1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --adm-bg: #000000;
    --adm-card: #1c1c1e;
    --adm-border: rgba(84,84,88,0.55);
    --adm-text: #ffffff;
    --adm-text-2: rgba(235,235,245,0.62);
    --adm-text-3: rgba(235,235,245,0.35);
    --adm-accent-soft: rgba(10,132,255,0.22);
    --adm-green-soft: rgba(48,209,88,0.2);
    --adm-red-soft: rgba(255,69,58,0.2);
    --adm-orange-soft: rgba(255,159,10,0.2);
    --adm-shadow: 0 2px 12px rgba(0,0,0,0.4);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  background: var(--adm-bg);
  color: var(--adm-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: 1rem; }
[hidden] { display: none !important; }

/* ===== Login ===== */
.admin-login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(800px 400px at 80% -10%, rgba(0,122,255,0.12), transparent 60%),
    radial-gradient(600px 400px at 10% 110%, rgba(175,82,222,0.12), transparent 60%),
    var(--adm-bg);
}
.admin-login__card {
  width: 100%;
  max-width: 380px;
  background: var(--adm-card);
  border: 1px solid var(--adm-border);
  border-radius: 24px;
  box-shadow: var(--adm-shadow);
  padding: 34px 28px 26px;
  text-align: center;
  animation: admUp 0.5s var(--adm-ease) both;
}
.admin-login__logo {
  font-size: 3rem;
  margin-bottom: 8px;
  animation: admPop 0.6s var(--adm-ease) both;
}
.admin-login__card h1 {
  font-size: 1.35rem;
  font-weight: 900;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.admin-login__card p {
  font-size: 0.82rem;
  color: var(--adm-text-2);
  margin-bottom: 22px;
}
.admin-login__back {
  display: inline-block;
  margin-top: 16px;
  font-size: 0.78rem;
  color: var(--adm-accent);
  text-decoration: none;
  font-weight: 700;
}
.admin-login__back:hover { text-decoration: underline; }

/* ===== Layout ===== */
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: color-mix(in srgb, var(--adm-card) 82%, transparent);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--adm-border);
}
.admin-topbar__brand { font-weight: 900; font-size: 1rem; letter-spacing: -0.01em; }
.admin-topbar__actions { display: flex; align-items: center; gap: 10px; }
.adm-link { color: var(--adm-accent); font-size: 0.82rem; font-weight: 700; text-decoration: none; }

.admin-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 20px 0;
  max-width: 980px;
  margin: 0 auto;
  flex-wrap: wrap;
}
.admin-tab {
  border: none;
  background: transparent;
  color: var(--adm-text-2);
  font-weight: 800;
  font-size: 0.9rem;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s var(--adm-ease);
  touch-action: manipulation;
}
.admin-tab:hover { background: var(--adm-accent-soft); }
.admin-tab.active {
  background: var(--adm-accent);
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(0,122,255,0.5);
}

.admin-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px;
}
.admin-view { animation: admFade 0.35s var(--adm-ease) both; }
.admin-view__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.admin-view__head h2 { font-size: 1.25rem; font-weight: 900; letter-spacing: -0.02em; }
.admin-view__sub { font-size: 0.8rem; color: var(--adm-text-2); }

/* ===== Stats ===== */
.adm-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.adm-stat {
  background: var(--adm-card);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius);
  padding: 14px 16px;
  box-shadow: var(--adm-shadow);
}
.adm-stat__num { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.02em; }
.adm-stat__label { font-size: 0.72rem; color: var(--adm-text-2); font-weight: 700; margin-top: 2px; }
.adm-stat--blue .adm-stat__num { color: var(--adm-accent); }
.adm-stat--green .adm-stat__num { color: var(--adm-green); }
.adm-stat--orange .adm-stat__num { color: var(--adm-orange); }
.adm-stat--purple .adm-stat__num { color: var(--adm-purple); }
.adm-stat--red .adm-stat__num { color: var(--adm-red); }

/* ===== List rows ===== */
.adm-list { display: flex; flex-direction: column; gap: 10px; }
.adm-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--adm-card);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius);
  padding: 12px 14px;
  box-shadow: var(--adm-shadow);
  animation: admUp 0.4s var(--adm-ease) both;
}
.adm-row__media {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  overflow: hidden;
}
.adm-row__body { flex: 1; min-width: 0; }
.adm-row__title { font-weight: 800; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-row__sub { font-size: 0.74rem; color: var(--adm-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-row__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.adm-pill {
  font-size: 0.66rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.adm-pill--green { background: var(--adm-green-soft); color: var(--adm-green); }
.adm-pill--red { background: var(--adm-red-soft); color: var(--adm-red); }
.adm-pill--orange { background: var(--adm-orange-soft); color: var(--adm-orange); }
.adm-pill--blue { background: var(--adm-accent-soft); color: var(--adm-accent); }
.adm-pill--purple { background: rgba(175,82,222,0.16); color: var(--adm-purple); }
.adm-row__actions { display: flex; gap: 6px; flex-shrink: 0; }
.adm-icon-btn {
  width: 34px; height: 34px;
  border: none;
  border-radius: 10px;
  background: var(--adm-accent-soft);
  color: var(--adm-accent);
  cursor: pointer;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s var(--adm-ease);
  touch-action: manipulation;
}
.adm-icon-btn:hover { transform: translateY(-1px); }
.adm-icon-btn--red { background: var(--adm-red-soft); color: var(--adm-red); }
.adm-icon-btn--red:hover { background: var(--adm-red); color: #fff; }
.adm-icon-btn:active { transform: scale(0.9); }
.adm-empty { text-align: center; padding: 40px 20px; color: var(--adm-text-3); }
.adm-empty__icon { font-size: 2.4rem; margin-bottom: 8px; }

/* ===== Buttons ===== */
.adm-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 800;
  font-size: 0.86rem;
  cursor: pointer;
  transition: all 0.2s var(--adm-ease);
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
}
.adm-btn--primary { background: var(--adm-accent); color: #fff; box-shadow: 0 8px 20px -8px rgba(0,122,255,0.55); }
.adm-btn--primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.adm-btn--ghost { background: var(--adm-accent-soft); color: var(--adm-accent); }
.adm-btn--ghost:hover { filter: brightness(1.05); }
.adm-btn:active { transform: scale(0.96); }
.adm-btn:disabled { opacity: 0.5; pointer-events: none; }

/* ===== Forms ===== */
.adm-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.adm-field label { font-size: 0.74rem; font-weight: 800; color: var(--adm-text-2); }
.adm-field input,
.adm-field select,
.adm-field textarea {
  width: 100%;
  border: 1px solid var(--adm-border);
  border-radius: 12px;
  background: var(--adm-bg);
  color: var(--adm-text);
  padding: 11px 13px;
  transition: border-color 0.2s var(--adm-ease), box-shadow 0.2s var(--adm-ease);
  min-height: 46px;
}
.adm-field input:focus,
.adm-field select:focus,
.adm-field textarea:focus {
  outline: none;
  border-color: var(--adm-accent);
  box-shadow: 0 0 0 3px var(--adm-accent-soft);
}
.adm-field textarea { resize: vertical; }
.adm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .adm-grid2 { grid-template-columns: 1fr; } }
.adm-checks { display: flex; gap: 16px; flex-wrap: wrap; margin: 4px 0 14px; }
.adm-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.adm-check input { width: 18px; height: 18px; accent-color: var(--adm-accent); }
.adm-error { color: var(--adm-red); font-size: 0.8rem; margin-top: 10px; font-weight: 700; }

/* ===== Modal ===== */
.adm-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: admFade 0.25s ease both;
}
.adm-modal__box {
  width: 100%;
  max-width: 540px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--adm-card);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
  padding: 20px;
  animation: admUp 0.35s var(--adm-ease) both;
  -webkit-overflow-scrolling: touch;
}
.adm-modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.adm-modal__head h3 { font-size: 1.1rem; font-weight: 900; }
.adm-modal__close {
  width: 34px; height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--adm-bg);
  color: var(--adm-text-2);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.18s var(--adm-ease);
}
.adm-modal__close:hover { background: var(--adm-red-soft); color: var(--adm-red); }
.adm-modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ===== Orders ===== */
.order-item { display: flex; flex-direction: column; gap: 6px; }
.order-item__id { font-size: 0.66rem; color: var(--adm-text-3); font-weight: 800; direction: ltr; text-align: right; }
.order-item__total { font-weight: 900; color: var(--adm-green); }
.order-items-list { font-size: 0.74rem; color: var(--adm-text-2); line-height: 1.55; }
.order-cust { font-size: 0.72rem; color: var(--adm-text-2); }
.order-status-select {
  border: 1px solid var(--adm-border);
  border-radius: 10px;
  background: var(--adm-bg);
  color: var(--adm-text);
  font-size: 0.76rem;
  font-weight: 800;
  padding: 7px 10px;
  cursor: pointer;
}
.order-date { font-size: 0.68rem; color: var(--adm-text-3); }

/* ===== Toast ===== */
.adm-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--adm-text);
  color: var(--adm-bg);
  font-size: 0.84rem;
  font-weight: 800;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.3);
  z-index: 300;
  opacity: 0;
  transition: all 0.3s var(--adm-ease);
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.adm-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Overview ===== */
.adm-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.adm-section-title {
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--adm-text-2);
  letter-spacing: 0.01em;
  margin: 20px 2px 10px;
}

/* ===== Generic cards ===== */
.adm-card {
  background: var(--adm-card);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius);
  box-shadow: var(--adm-shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.adm-card--form { max-width: 460px; }
.adm-card__title { font-size: 1rem; font-weight: 900; margin-bottom: 14px; letter-spacing: -0.01em; }

/* ===== Category cards grid (quotes/telegram) ===== */
.adm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.adm-cat-card {
  background: var(--adm-card);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius);
  padding: 14px 16px;
  box-shadow: var(--adm-shadow);
  animation: admUp 0.4s var(--adm-ease) both;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.adm-cat-card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.adm-cat-card__name { font-weight: 900; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-cat-card__sample {
  font-size: 0.74rem;
  color: var(--adm-text-2);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== Info list (settings) ===== */
.adm-info-list { display: flex; flex-direction: column; }
.adm-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 0.5px solid var(--adm-border);
  font-size: 0.84rem;
}
.adm-info-row:last-child { border-bottom: none; }
.adm-info-row span { color: var(--adm-text-2); font-weight: 700; }
.adm-info-row b { font-weight: 800; text-align: left; }

/* ===== Topbar clock ===== */
.admin-clock {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--adm-text-2);
  direction: ltr;
  background: var(--adm-bg);
  border: 1px solid var(--adm-border);
  border-radius: 999px;
  padding: 5px 12px;
}

/* ===== Tabs scroll on small screens ===== */
@media (max-width: 700px) {
  .admin-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 10px;
  }
  .admin-tabs::-webkit-scrollbar { display: none; }
  .admin-tab { white-space: nowrap; flex-shrink: 0; }
  .adm-actions .adm-btn { flex: 1; min-width: 120px; }
}

/* ===== Animations ===== */
@keyframes admUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes admFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes admPop { 0% { transform: scale(0.5); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
