/* ===== ADMIN PANEL ===== */

:root {
  --admin-sidebar: 240px;
}

/* Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.admin-sidebar {
  width: var(--admin-sidebar);
  background: #0A0C14;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo-icon {
  width: 32px; height: 32px;
  border-radius: 9px;
  overflow: hidden;
  flex-shrink: 0;
}
.sidebar-logo-icon img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-logo-name {
  font-size: 16px; font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.02em;
}
.sidebar-logo-badge {
  font-size: 9px; font-weight: 700;
  background: rgba(58,92,197,0.30);
  color: #7A96F0;
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-left: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.10em;
  color: rgba(255,255,255,0.25);
  padding: 12px 10px 6px;
}

.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px; font-weight: 500;
  color: rgba(255,255,255,0.50);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 2px;
  position: relative;
}
.sidebar-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
}
.sidebar-item.active {
  background: rgba(58,92,197,0.18);
  color: #FFFFFF;
}
.sidebar-item.active svg { color: #7A96F0; }
.sidebar-item svg { flex-shrink: 0; color: inherit; }

.sidebar-badge {
  margin-left: auto;
  background: #DC2626;
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}
.sidebar-badge.yellow { background: #D97706; }

.sidebar-footer {
  padding: 16px 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-user:hover { background: rgba(255,255,255,0.06); }
.sidebar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(58,92,197,0.30);
  color: #7A96F0;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-name { font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.70); }
.sidebar-user-role { font-size: 10px; color: rgba(255,255,255,0.30); }

/* ── Main ── */
.admin-main {
  flex: 1;
  margin-left: var(--admin-sidebar);
  background: #F1F2F7;
  min-height: 100vh;
}

.admin-topbar {
  background: #FFFFFF;
  border-bottom: 1px solid rgba(9,12,28,0.08);
  padding: 0 28px;
  height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title {
  font-size: 16px; font-weight: 700;
  color: #090C1C;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-btn {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: #F1F2F7;
  border: 1px solid rgba(9,12,28,0.08);
  display: flex; align-items: center; justify-content: center;
  color: #4A5280;
  cursor: pointer;
  transition: all 0.15s;
}
.topbar-btn:hover { background: #E6E8EF; color: #090C1C; }
.topbar-tag {
  font-size: 12px; font-weight: 600;
  color: #4A5280;
  background: #F1F2F7;
  border: 1px solid rgba(9,12,28,0.08);
  padding: 6px 14px;
  border-radius: 99px;
}

.admin-content {
  padding: 28px;
  max-width: 1160px;
}

/* ── Section ── */
.admin-section { display: none; }
.admin-section.active { display: block; }

/* ── KPI Cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
  background: #FFFFFF;
  border: 1px solid rgba(9,12,28,0.07);
  border-radius: 16px;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(9,12,28,0.04), 0 4px 16px rgba(9,12,28,0.05);
}
.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  border-radius: 16px 16px 0 0;
}
.kpi-card.blue::after   { background: linear-gradient(90deg, #3A5CC5, #5A7AE5); }
.kpi-card.green::after  { background: linear-gradient(90deg, #16A34A, #4ADE80); }
.kpi-card.orange::after { background: linear-gradient(90deg, #D97706, #F59E0B); }
.kpi-card.red::after    { background: linear-gradient(90deg, #DC2626, #F87171); }

.kpi-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: #9099B8;
  margin-bottom: 10px;
}
.kpi-value {
  font-size: 28px; font-weight: 900;
  letter-spacing: -0.03em;
  color: #090C1C;
  line-height: 1;
  margin-bottom: 8px;
}
.kpi-sub {
  font-size: 12px;
  color: #9099B8;
}
.kpi-sub b { color: #16A34A; }
.kpi-sub b.red { color: #DC2626; }
.kpi-icon {
  position: absolute;
  top: 20px; right: 20px;
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.15;
}
.kpi-card.blue  .kpi-icon { background: #3A5CC5; }
.kpi-card.green .kpi-icon { background: #16A34A; }
.kpi-card.orange .kpi-icon { background: #D97706; }
.kpi-card.red   .kpi-icon { background: #DC2626; }

/* ── Cards / Panels ── */
.admin-card {
  background: #FFFFFF;
  border: 1px solid rgba(9,12,28,0.07);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(9,12,28,0.04), 0 4px 16px rgba(9,12,28,0.05);
  margin-bottom: 20px;
}

.admin-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(9,12,28,0.07);
}
.admin-card-title {
  font-size: 15px; font-weight: 700;
  color: #090C1C;
}
.admin-card-sub {
  font-size: 12px; color: #9099B8;
  margin-top: 1px;
}

/* ── Table ── */
.admin-table-wrap {
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: #9099B8;
  background: #F8F9FC;
  border-bottom: 1px solid rgba(9,12,28,0.07);
  white-space: nowrap;
}
.admin-table td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(9,12,28,0.05);
  color: #090C1C;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #F8F9FC; }

/* ── User row ── */
.user-cell {
  display: flex; align-items: center; gap: 10px;
}
.user-av {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--gold-dim);
  color: var(--gold);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-name  { font-size: 13px; font-weight: 600; }
.user-email { font-size: 11px; color: #9099B8; }

/* ── Badges ── */
.badge-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px; font-weight: 600;
}
.badge-status::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge-status.active   { background: rgba(22,163,74,0.10); color: #16A34A; }
.badge-status.blocked  { background: rgba(220,38,38,0.08);  color: #DC2626; }
.badge-status.pending  { background: rgba(217,119,6,0.10);  color: #D97706; }
.badge-status.done     { background: rgba(22,163,74,0.10);  color: #16A34A; }
.badge-status.confirmed{ background: rgba(22,163,74,0.10);  color: #16A34A; }
.badge-status.rejected { background: rgba(220,38,38,0.08);  color: #DC2626; }

/* ── Action buttons ── */
.act-btns { display: flex; align-items: center; gap: 6px; }

.act-btn {
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.act-btn.confirm {
  background: rgba(22,163,74,0.10);
  color: #16A34A;
  border-color: rgba(22,163,74,0.20);
}
.act-btn.confirm:hover {
  background: #16A34A;
  color: #fff;
}
.act-btn.reject {
  background: rgba(220,38,38,0.08);
  color: #DC2626;
  border-color: rgba(220,38,38,0.15);
}
.act-btn.reject:hover {
  background: #DC2626;
  color: #fff;
}
.act-btn.view {
  background: rgba(58,92,197,0.08);
  color: #3A5CC5;
  border-color: rgba(58,92,197,0.15);
}
.act-btn.view:hover {
  background: #3A5CC5;
  color: #fff;
}
.act-btn.block {
  background: rgba(220,38,38,0.06);
  color: #9099B8;
  border-color: rgba(9,12,28,0.10);
}
.act-btn.block:hover {
  background: rgba(220,38,38,0.12);
  color: #DC2626;
  border-color: rgba(220,38,38,0.20);
}
.act-btn.edit {
  background: rgba(9,12,28,0.05);
  color: #4A5280;
  border-color: rgba(9,12,28,0.10);
}
.act-btn.edit:hover {
  background: rgba(9,12,28,0.10);
  color: #090C1C;
}
.act-btn.icon-btn {
  padding: 5px 8px;
  background: rgba(9,12,28,0.05);
  color: #4A5280;
  border-color: rgba(9,12,28,0.10);
}
.act-btn.icon-btn:hover {
  background: rgba(9,12,28,0.10);
  color: #090C1C;
}

/* ── Filters bar ── */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(9,12,28,0.07);
  flex-wrap: wrap;
}

.filter-search {
  position: relative;
  flex: 1; min-width: 180px;
}
.filter-search svg {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: #9099B8; pointer-events: none;
}
.filter-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1.5px solid rgba(9,12,28,0.10);
  border-radius: 10px;
  font-size: 13px;
  background: #F8F9FC;
  color: #090C1C;
  outline: none;
  transition: border-color 0.15s;
}
.filter-input:focus { border-color: #3A5CC5; background: #fff; }
.filter-input::placeholder { color: #9099B8; }

.filter-select {
  padding: 8px 14px;
  border: 1.5px solid rgba(9,12,28,0.10);
  border-radius: 10px;
  font-size: 13px; font-weight: 500;
  background: #F8F9FC;
  color: #4A5280;
  outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: #3A5CC5; }

.filter-count {
  font-size: 12px; color: #9099B8;
  margin-left: auto;
  white-space: nowrap;
}

/* ── Link Generator ── */
.link-gen-form {
  padding: 22px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 900px) { .form-row { grid-template-columns: 1fr 1fr; } }

.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: #9099B8;
}
.form-control {
  padding: 10px 14px;
  border: 1.5px solid rgba(9,12,28,0.10);
  border-radius: 10px;
  font-size: 13px;
  background: #F8F9FC;
  color: #090C1C;
  outline: none;
  transition: border-color 0.15s;
}
.form-control:focus { border-color: #3A5CC5; background: #fff; }

.link-result {
  background: #F1F2F7;
  border: 1.5px dashed rgba(9,12,28,0.14);
  border-radius: 12px;
  padding: 16px 18px;
  margin-top: 16px;
  display: none;
}
.link-result.visible { display: block; }
.link-result-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.10em;
  color: #9099B8; margin-bottom: 8px;
}
.link-result-url {
  font-size: 13px; font-weight: 500;
  color: #3A5CC5;
  word-break: break-all;
  line-height: 1.6;
  margin-bottom: 12px;
}
.link-copy-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  background: #3A5CC5;
  color: #fff;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.link-copy-btn:hover { background: #2a4ab5; }

.gen-btn {
  padding: 10px 22px;
  background: #090C1C;
  color: #fff;
  border-radius: 10px;
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 8px;
}
.gen-btn:hover { background: #1a1d2e; }

/* ── Analytics store row ── */
.store-cell {
  display: flex; align-items: center; gap: 10px;
}
.store-mini-logo {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(9,12,28,0.08);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.store-mini-logo img {
  width: 22px; height: 22px;
  object-fit: contain;
}
.conv-bar-wrap {
  display: flex; align-items: center; gap: 8px;
}
.conv-bar {
  height: 6px;
  background: rgba(9,12,28,0.08);
  border-radius: 3px;
  width: 80px;
  overflow: hidden;
}
.conv-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3A5CC5, #5A7AE5);
  border-radius: 3px;
  transition: width 0.6s ease;
}
.conv-pct { font-size: 12px; font-weight: 600; color: #3A5CC5; }

/* ── Modals ── */
.admin-modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.50);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.admin-modal-overlay.open {
  opacity: 1; pointer-events: auto;
}
.admin-modal {
  background: #FFFFFF;
  border-radius: 20px;
  padding: 28px;
  max-width: 460px; width: 100%;
  box-shadow: 0 24px 64px rgba(9,12,28,0.20);
  animation: modalIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes modalIn {
  from { transform: scale(0.92) translateY(10px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.admin-modal h3 {
  font-size: 18px; font-weight: 800;
  margin-bottom: 6px;
}
.admin-modal p {
  font-size: 14px; color: #4A5280;
  margin-bottom: 22px; line-height: 1.6;
}
.modal-input-group {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 20px;
}
.modal-input-label {
  font-size: 12px; font-weight: 600; color: #4A5280;
}
.modal-input {
  padding: 12px 14px;
  border: 1.5px solid rgba(9,12,28,0.12);
  border-radius: 10px;
  font-size: 15px; font-weight: 600;
  outline: none;
  transition: border-color 0.15s;
}
.modal-input:focus { border-color: #3A5CC5; }
.modal-btns {
  display: flex; gap: 10px;
}
.modal-btn-cancel {
  flex: 1;
  padding: 12px;
  border: 1.5px solid rgba(9,12,28,0.12);
  border-radius: 10px;
  font-size: 14px; font-weight: 600;
  color: #4A5280;
  cursor: pointer;
  transition: all 0.15s;
}
.modal-btn-cancel:hover { background: #F1F2F7; }
.modal-btn-submit {
  flex: 2;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px; font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
}
.modal-btn-submit.blue { background: #3A5CC5; }
.modal-btn-submit.blue:hover { background: #2a4ab5; }
.modal-btn-submit.green { background: #16A34A; }
.modal-btn-submit.green:hover { background: #15803d; }
.modal-btn-submit.red { background: #DC2626; }
.modal-btn-submit.red:hover { background: #b91c1c; }

/* ── Toast ── */
.admin-toast-wrap {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
}
.admin-toast {
  background: #090C1C;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.3s ease;
  max-width: 320px;
}
.admin-toast.success svg { color: #4ADE80; }
.admin-toast.error   svg { color: #F87171; }
.admin-toast.info    svg { color: #7A96F0; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Overview recent table ── */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .overview-grid { grid-template-columns: 1fr; } }

/* ── Tabs ── */
.admin-tabs {
  display: flex; gap: 4px;
}
.admin-tab {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  color: #9099B8;
  transition: all 0.15s;
}
.admin-tab:hover { background: #F1F2F7; color: #4A5280; }
.admin-tab.active { background: rgba(58,92,197,0.10); color: #3A5CC5; }

/* ── Amount ── */
.amount-green { color: #16A34A; font-weight: 700; }
.amount-red   { color: #DC2626; font-weight: 700; }
.amount-muted { color: #9099B8; }
.fw-700 { font-weight: 700; }
.text-muted { color: #9099B8; font-size: 12px; }
.text-sm { font-size: 12px; }

/* ── Responsive sidebar toggle ── */
.sidebar-toggle {
  display: none;
  position: fixed; top: 12px; left: 12px; z-index: 200;
  width: 38px; height: 38px;
  background: #0A0C14;
  border-radius: 10px;
  align-items: center; justify-content: center;
  cursor: pointer;
  color: #fff;
}

@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-content { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .sidebar-toggle { display: flex; }
  .admin-topbar { padding: 0 16px 0 58px; }
}

/* ── Quick stats row ── */
.quick-stats {
  display: flex; gap: 20px;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(9,12,28,0.07);
}
.qs-item { display: flex; flex-direction: column; gap: 2px; }
.qs-val { font-size: 18px; font-weight: 800; color: #090C1C; }
.qs-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: #9099B8; font-weight: 600; }

/* ── Empty state ── */
.admin-empty {
  text-align: center;
  padding: 48px 20px;
  color: #9099B8;
}
.admin-empty svg { margin: 0 auto 12px; opacity: 0.3; }
.admin-empty p { font-size: 14px; }

/* ── Highlight row ── */
tr.row-pending { background: rgba(217,119,6,0.03); }
