/* ============================================
   EFCoin Admin Panel — shared design tokens
   ============================================ */

:root {
  --bg-0: #06070A;
  --bg-1: #0E1016;
  --bg-2: #151821;
  --bg-3: #1F2330;
  --border: rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.14);

  --text-0: #F5F7FA;
  --text-1: #C9D0DC;
  --text-2: #8A92A3;
  --text-3: #565C6B;

  --accent: #00E676;
  --accent-dim: #00B85F;
  --accent-glow: rgba(0,230,118,0.28);
  --accent-soft: rgba(0,230,118,0.10);

  --magenta: #FF2D8A;
  --gold: #FFC857;
  --success: #22C55E;
  --warn: #F59E0B;
  --error: #EF4444;
  --info: #3B82F6;

  --font: 'Manrope', -apple-system, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur: 180ms;

  --sidebar-w: 220px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg-0);
  color: var(--text-0);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

button, input, select, textarea {
  font-family: inherit; font-size: inherit; color: inherit;
}
button { background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Layout ===== */
.app {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  padding: 22px 14px;
  display: flex; flex-direction: column;
  flex-shrink: 0;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 6px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.sidebar .brand img { width: 32px; height: 32px; border-radius: 8px; }
.sidebar .brand-text .t1 { font-size: 10px; color: var(--text-3); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; }
.sidebar .brand-text .t2 { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-weight: 600; font-size: 13px;
  transition: all var(--dur) var(--ease);
  width: 100%; text-align: left;
}
.nav-item:hover { background: var(--bg-2); color: var(--text-0); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 12px;
}
.sidebar-user .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--magenta));
  color: #001A0B; font-weight: 800;
  display: grid; place-items: center; font-size: 11px;
  flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-user-info .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-info .role { color: var(--text-3); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }

.main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--bg-0);
}

.page-header {
  padding: 22px 32px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.page-title { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.page-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.page-body {
  padding: 22px 32px;
  flex: 1; min-height: 0;
  overflow-y: auto;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}
.card-title { font-size: 13px; font-weight: 700; }

/* ===== Stat grid ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
}
.stat-label {
  font-size: 11px; font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 24px; font-weight: 800; letter-spacing: -0.02em;
  font-family: var(--mono);
}
.stat-sub {
  font-size: 11px; color: var(--text-2); margin-top: 4px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  font-size: 12px; font-weight: 700;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent); color: #001A0B;
}
.btn-primary:hover:not(:disabled) { background: #12F383; }
.btn-ghost {
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text-0);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-3); }
.btn-danger {
  background: rgba(239,68,68,0.12); color: var(--error); border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.2); }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-lg { padding: 11px 18px; font-size: 13px; }

/* ===== Inputs ===== */
.input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text-0);
  font-size: 13px;
}
.input:focus { outline: none; border-color: var(--accent); }
.input::placeholder { color: var(--text-3); }
.label {
  font-size: 11px; font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.05em; text-transform: uppercase;
  margin-bottom: 5px; display: block;
}

.select {
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text-0);
  font-size: 12px;
  cursor: pointer;
}

/* ===== Table ===== */
.table-wrap {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
thead {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
th {
  text-align: left;
  padding: 11px 14px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-top: 1px solid var(--border);
  color: var(--text-1);
  vertical-align: middle;
}
tbody tr { transition: background var(--dur) var(--ease); }
tbody tr:hover { background: rgba(255,255,255,0.02); cursor: pointer; }

/* ===== Pill / Badge ===== */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  font-size: 10px; font-weight: 700;
  color: var(--text-1);
  letter-spacing: 0.03em;
  line-height: 1;
  white-space: nowrap;
}
.pill-accent { background: var(--accent-soft); border-color: rgba(0,230,118,0.3); color: var(--accent); }
.pill-warn { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.3); color: var(--warn); }
.pill-error { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); color: var(--error); }
.pill-info { background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.3); color: #7FB0FF; }
.pill-gold { background: rgba(255,200,87,0.12); border-color: rgba(255,200,87,0.3); color: var(--gold); }

/* ===== Toolbar ===== */
.toolbar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* ===== Drawer ===== */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
  animation: fadeIn 180ms var(--ease);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 100%);
  background: var(--bg-1);
  border-left: 1px solid var(--border-strong);
  box-shadow: -12px 0 40px rgba(0,0,0,0.4);
  z-index: 91;
  display: flex; flex-direction: column;
  animation: slideIn 240ms var(--ease);
  overflow: hidden;
}
.drawer-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer-title { font-size: 14px; font-weight: 800; }
.drawer-body { padding: 18px 22px; flex: 1; overflow-y: auto; }
.drawer-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== Login page ===== */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
}
.login-card .logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 22px;
}
.login-card .logo img { width: 40px; height: 40px; border-radius: 10px; }
.login-card .logo-text .t1 { font-size: 10px; color: var(--text-3); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; }
.login-card .logo-text .t2 { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }

/* ===== Toast ===== */
.toast-wrap {
  position: fixed; top: 18px; right: 18px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;
}
.toast {
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 12px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: toastIn 220ms var(--ease);
  max-width: 320px;
}
.toast.success { border-color: rgba(34,197,94,0.4); }
.toast.error { border-color: rgba(239,68,68,0.4); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ===== Spinner ===== */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Utility ===== */
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stack > * + * { margin-top: var(--s, 10px); }
.muted { color: var(--text-2); }
.tiny { font-size: 11px; }
.small { font-size: 13px; }
.grow { flex: 1; }

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

/* ===== Help tooltip ===== */
.help-tip {
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
  cursor: help;
  vertical-align: middle;
  flex-shrink: 0;
}
.help-tip-trigger {
  display: grid; place-items: center;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--text-2);
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font);
  transition: all var(--dur) var(--ease);
  user-select: none;
}
.help-tip:hover .help-tip-trigger,
.help-tip-open .help-tip-trigger {
  background: var(--accent);
  color: #001A0B;
}
.help-tip-bubble {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text-1);
  line-height: 1.55;
  width: max-content;
  max-width: 280px;
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms var(--ease);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  font-weight: 500;
  white-space: normal;
  text-align: start;
}
.help-tip-bubble::before {
  content: '';
  position: absolute;
  top: -5px;
  inset-inline-start: 6px;
  width: 8px; height: 8px;
  background: var(--bg-2);
  border-top: 1px solid var(--border-strong);
  border-inline-start: 1px solid var(--border-strong);
  transform: rotate(45deg);
}
.help-tip:hover .help-tip-bubble,
.help-tip-open .help-tip-bubble {
  opacity: 1;
  pointer-events: auto;
}

/* ===== Segmented small (EN/AR switcher) ===== */
.segmented-small {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.segmented-small button {
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.05em;
  transition: all var(--dur) var(--ease);
}
.segmented-small button.active {
  background: var(--bg-3);
  color: var(--text-0);
}

/* ===== Search box ===== */
.search-box {
  flex: 1; max-width: 340px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 4px 10px;
}
.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 0;
  color: var(--text-0);
  font-size: 13px;
  outline: none;
}
.search-box input::placeholder { color: var(--text-3); }

.filter-group {
  display: inline-flex; align-items: center; gap: 6px;
}

/* ===== Title row with help icon ===== */
.page-title-row {
  display: flex; align-items: center; gap: 8px;
}

.label-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 5px;
}
.label-row .label { margin-bottom: 0; }

/* ===== Lang row in sidebar ===== */
.lang-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: var(--r-md);
  margin-bottom: 8px;
}

/* ===== RTL adjustments ===== */
[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border); }
[dir="rtl"] .drawer {
  right: auto; left: 0;
  border-left: none; border-right: 1px solid var(--border-strong);
  box-shadow: 12px 0 40px rgba(0,0,0,0.4);
  animation: slideInRtl 240ms var(--ease);
}
@keyframes slideInRtl { from { transform: translateX(-30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
[dir="rtl"] .toast-wrap { right: auto; left: 18px; }
[dir="rtl"] @keyframes toastIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
[dir="rtl"] th { text-align: right; }
[dir="rtl"] .help-tip-bubble { text-align: right; }
[dir="rtl"] body { font-family: 'Cairo', var(--font); }
