/* ── ReviewQR Pro — Admin Panel CSS ── */
:root {
  --primary: #6366f1;
  --secondary: #8b5cf6;
  --accent: #06b6d4;
  --grad: linear-gradient(135deg, #6366f1, #8b5cf6);
  --bg: #070711;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f1f5f9;
  --text-muted: #64748b;
  --sidebar-w: 240px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: 'Inter', sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
}

/* ── Sidebar ── */
#wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 20px 20px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--grad);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 8px;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.sidebar-divider {
  border-color: var(--border);
  margin: 0 16px 8px;
}

.sidebar-nav {
  list-style: none;
  padding: 0 10px;
  flex: 1;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #94a3b8;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  margin-bottom: 2px;
  font-size: 0.875rem;
}

.nav-item a i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.nav-item a:hover {
  background: var(--surface-hover);
  color: #f1f5f9;
}

.nav-item.active a {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-stats {
  margin-bottom: 12px;
}

.stat-item {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  color: #ef4444;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* ── Page Content ── */
#page-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-body {
  padding: 24px;
  flex: 1;
}

/* ── Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: 60px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.sidebar-toggle {
  background: none;
  border: 1px solid var(--border);
  color: #94a3b8;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.sidebar-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.topbar-title {
  font-weight: 700;
  font-size: 1rem;
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
}

/* ── Collapsed Sidebar ── */
#wrapper.sidebar-collapsed .sidebar {
  transform: translateX(calc(-1 * var(--sidebar-w)));
}

#wrapper.sidebar-collapsed #page-content {
  margin-left: 0;
}

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
}

.stat-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  flex-shrink: 0;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Card Panel ── */
.card-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.panel-header h5 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
}

/* ── Tables ── */
.admin-table th {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border) !important;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  white-space: nowrap;
}

.admin-table td {
  border-color: var(--border);
  vertical-align: middle;
}

.admin-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ── Buttons ── */
.btn-xs {
  padding: 3px 8px;
  font-size: 0.75rem;
  border-radius: 6px;
}

/* ── Form Controls ── */
.form-control,
.form-select {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #f1f5f9 !important;
  border-radius: 10px;
}

.form-control:focus,
.form-select:focus {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
  color: #f1f5f9 !important;
}

.form-control::placeholder {
  color: #475569;
}

.form-select option {
  background: #1e293b;
}

.form-label {
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.input-group-text {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #64748b;
}

.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.form-text {
  color: var(--text-muted) !important;
}

/* ── Section Title ── */
.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

/* ── Dashboard extras ── */
.top-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.top-item:last-child {
  border-bottom: none;
}

.rank {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
}

.rank-1 {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
}

.rank-2 {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: #fff;
}

.rank-3 {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
}

.rank-4,
.rank-5 {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

.top-info {
  flex: 1;
  min-width: 0;
}

.top-name {
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-cat {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.top-scans {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.empty-state-sm {
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
  font-size: 0.875rem;
}

/* ── QR Page ── */
.qr-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  min-height: 220px;
}

.qr-url-copy input {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  cursor: pointer;
}

.qr-url-copy input:focus {
  box-shadow: none;
  border-color: var(--primary);
}

/* ── Misc ── */
.qr-code-badge {
  background: rgba(99, 102, 241, 0.1);
  color: #a78bfa;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
}

.biz-name {
  font-size: 0.9rem;
}

.biz-tagline {
  font-size: 0.75rem;
  margin-top: 1px;
}

code {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
}

.alert {
  border-radius: 12px;
  border: 1px solid transparent;
}

.badge {
  font-size: 0.7rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }

  .sidebar.open {
    transform: translateX(0);
  }

  #page-content {
    margin-left: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-body {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}