/* ============ Muborak Admin — shadcn-ilhomlangan dark tema ============ */
:root {
  --bg: #0C0A07;
  --surface: #14110C;
  --surface-2: #1B1712;
  --surface-3: #241E16;
  --border: #2A241B;
  --border-hi: #3A3226;
  --text: #F2EDE4;
  --muted: #9C927F;
  --faint: #6B6252;
  --gold: #E0A83E;
  --gold-2: #BE8129;
  --gold-soft: rgba(224, 168, 62, 0.12);
  --green: #4CAF7D;
  --green-soft: rgba(76, 175, 125, 0.14);
  --red: #E5534B;
  --red-soft: rgba(229, 83, 75, 0.13);
  --blue: #58A6FF;
  --blue-soft: rgba(88, 166, 255, 0.13);
  --tg: #29A9EB;
  --radius: 14px;
  --shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ Tugmalar ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: 600 13.5px var(--font);
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.06s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-hi); }
.btn:active { transform: scale(0.97); }
.btn-icon { width: 15px; height: 15px; fill: currentColor; }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  border: none;
  color: #1A1206;
}
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--gold-2), var(--gold)); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-danger { background: var(--red-soft); border-color: rgba(229, 83, 75, 0.3); color: var(--red); }
.btn-danger:hover { background: rgba(229, 83, 75, 0.22); border-color: var(--red); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }

/* ============ Login ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(600px 400px at 70% 10%, rgba(190, 129, 41, 0.13), transparent),
    radial-gradient(500px 400px at 20% 90%, rgba(190, 129, 41, 0.07), transparent),
    var(--bg);
}
.login-card {
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 34px 34px;
  text-align: center;
  box-shadow: var(--shadow);
}
.login-logo {
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #fff;
  font: 400 34px Georgia, serif;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(190, 129, 41, 0.35);
}
.login-card h1 { font-size: 24px; font-weight: 700; letter-spacing: 0.3px; }
.login-sub { color: var(--muted); margin: 4px 0 26px; }
.login-card input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  font: 500 14px var(--font);
  padding: 12px 14px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.15s;
}
.login-card input:focus { border-color: var(--gold); }
.login-error { color: var(--red); margin-top: 14px; font-weight: 600; animation: shake 0.35s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

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

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #fff;
  font: 400 21px Georgia, serif;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: 0.2px; }
.brand-sub { font-size: 11.5px; color: var(--muted); }

.nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
  user-select: none;
}
.nav-item svg { width: 17px; height: 17px; fill: currentColor; opacity: 0.9; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--gold-soft);
  color: var(--gold);
}
.sidebar-footer { padding: 12px 10px; border-top: 1px solid var(--border); }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 10, 7, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h2 { font-size: 19px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.admin-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 7px 13px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--muted);
}
.admin-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); }

.content { padding: 26px 28px 48px; max-width: 1240px; margin: 0 auto; }

/* ============ Kartalar ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-card { display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.stat-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--accent-soft, var(--gold-soft));
  opacity: 0.5;
}
.stat-head { display: flex; align-items: center; gap: 9px; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.stat-ic {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft, var(--gold-soft));
}
.stat-ic svg { width: 16px; height: 16px; fill: var(--accent, var(--gold)); }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -0.4px; }
.stat-sub { font-size: 12px; color: var(--faint); }

.grid-2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 14px; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } }

.card-title {
  font-size: 14.5px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title .muted { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ============ Grafik ============ */
.chart-wrap { width: 100%; }
.chart-wrap svg { width: 100%; height: 210px; display: block; }
.chart-empty { color: var(--faint); text-align: center; padding: 60px 0; }

/* ============ Jadval ============ */
.table-card { padding: 0; overflow: hidden; }
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.search-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: 500 13.5px var(--font);
  padding: 9px 14px;
  width: 260px;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--gold); }
.search-input::placeholder { color: var(--faint); }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--faint);
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
.td-right { text-align: right; }

.cell-user { display: flex; align-items: center; gap: 11px; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--gold-soft);
  color: var(--gold);
  font: 400 16px Georgia, serif;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.cell-name { font-weight: 650; }
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ============ Pill / badge ============ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.pill-gold { background: var(--gold-soft); color: var(--gold); }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-gray { background: var(--surface-3); color: var(--muted); }
.pill-tg { background: rgba(41, 169, 235, 0.13); color: var(--tg); }

.coin-badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.coin-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #F6D588, var(--gold-2));
  border: 1px solid #8A5F1B;
  display: inline-block;
}

/* ============ Filter chiplar ============ */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font: 600 12.5px var(--font);
  cursor: pointer;
  transition: all 0.14s;
  user-select: none;
}
.chip:hover { color: var(--text); border-color: var(--border-hi); }
.chip.active { background: var(--gold-soft); color: var(--gold); border-color: rgba(224, 168, 62, 0.4); }

/* ============ Modal ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 4, 2, 0.7);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.18s;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: 400px;
  max-width: calc(100vw - 40px);
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
  animation: pop 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } }
.modal h3 { font-size: 16.5px; margin-bottom: 4px; }
.modal .modal-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 18px; }
.modal label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; }
.modal input[type="text"], .modal input[type="number"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: 500 14px var(--font);
  padding: 10px 13px;
  outline: none;
}
.modal input:focus { border-color: var(--gold); }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.modal-actions .btn { flex: 1; }
.opt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 8px;
  transition: border-color 0.14s, background 0.14s;
  font-weight: 600;
}
.opt-row:hover { border-color: var(--gold); background: var(--gold-soft); }
.opt-row .opt-desc { font-size: 12px; color: var(--muted); font-weight: 500; }
.switch-row { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.switch { position: relative; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute;
  inset: 0;
  background: var(--surface-3);
  border: 1px solid var(--border-hi);
  border-radius: 999px;
  transition: background 0.15s;
  cursor: pointer;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .track { background: var(--gold-soft); border-color: var(--gold); }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--gold); }

/* ============ Toast ============ */
.toasts {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  border-left: 3px solid var(--green);
  border-radius: 12px;
  padding: 13px 18px;
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: slideUp 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.1);
  max-width: 340px;
}
.toast.err { border-left-color: var(--red); }
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } }

/* ============ Bo'sh holat / skeleton ============ */
.empty { text-align: center; color: var(--faint); padding: 48px 0; }
.empty svg { width: 40px; height: 40px; fill: var(--faint); margin-bottom: 10px; opacity: 0.6; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }
.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--border-hi);
  border-top-color: var(--gold);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; color: var(--muted); }
.amount { font-weight: 750; letter-spacing: -0.2px; }
.text-green { color: var(--green); }
.text-muted { color: var(--muted); }

/* ============ Kontent tahriri (JSON / narx formasi) ============ */
.json-editor {
  width: 100%;
  min-height: 280px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font: 12.5px/1.55 ui-monospace, "SF Mono", Menlo, monospace;
  padding: 14px;
  outline: none;
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
}
.json-editor:focus { border-color: var(--gold); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.form-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-field input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: 600 14px var(--font);
  padding: 10px 13px;
  outline: none;
  box-sizing: border-box;
}
.form-field input:focus { border-color: var(--gold); }
.pack-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.pack-row input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: 600 13.5px var(--font);
  padding: 9px 12px;
  outline: none;
  width: 110px;
}
.pack-row input:focus { border-color: var(--gold); }
.mu-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: 600 14px var(--font);
  padding: 10px 13px;
  outline: none;
  appearance: none;
}
.mu-select:focus { border-color: var(--gold); }
.upload-zone {
  border: 1.5px dashed var(--border-hi);
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover { border-color: var(--gold); background: var(--gold-soft); }
.note { font-size: 12px; color: var(--faint); line-height: 1.5; }

/* ============ Mobil (telefon brauzeri / PWA) ============ */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 40;
    flex-direction: column;
    border-right: none;
    border-bottom: 1px solid var(--border);
    background: rgba(20, 17, 12, 0.97);
    backdrop-filter: blur(8px);
  }
  .brand { border-bottom: none; padding: 12px 16px 4px; }
  .brand-sub { display: none; }
  .brand-mark { width: 30px; height: 30px; font-size: 16px; border-radius: 9px; }
  .nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 6px 10px 10px;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { white-space: nowrap; padding: 8px 13px; flex-shrink: 0; }
  .sidebar-footer { display: none; }
  .topbar { position: static; padding: 12px 16px; }
  .topbar h2 { font-size: 17px; }
  .content { padding: 16px 14px 40px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 21px; }
  .grid-2 { grid-template-columns: 1fr; }
  .search-input { width: 100%; }
  .table-toolbar { padding: 12px 14px; }
  thead th, tbody td { padding: 11px 12px; }
  .modal { padding: 20px 18px; }
}
