/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ─── Tokens ─────────────────────────────────────────────── */
:root {
  --sidebar-bg:     #0D0F1A;
  --sidebar-width:  248px;
  --primary:        #7C3AED;
  --primary-hover:  #6D28D9;
  --primary-light:  #EDE9FE;
  --bg:             #F4F6FA;
  --surface:        #FFFFFF;
  --border:         #E4E8F0;
  --text-primary:   #111827;
  --text-secondary: #6B7280;
  --text-muted:     #9CA3AF;
  --success-bg:     #D1FAE5;
  --success-text:   #065F46;
  --warning-bg:     #FEF3C7;
  --warning-text:   #92400E;
  --danger:         #EF4444;
  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg:      0 16px 40px rgba(0,0,0,0.14);
}

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

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.brand-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.22);
  padding: 10px 10px 4px;
  margin-top: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: rgba(255,255,255,0.48);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.13s, color 0.13s;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.82);
}

.nav-item.active {
  background: rgba(124,58,237,0.22);
  color: #C4B5FD;
}

.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.13s;
}

.sidebar-user:hover { background: rgba(255,255,255,0.04); }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-name  { font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.75); }
.user-role  { font-size: 11px; color: rgba(255,255,255,0.28); }

/* ─── Main ───────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ─────────────────────────────────────────────── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; flex-direction: column; }

.page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.13s;
  text-decoration: none;
  font-family: inherit;
  line-height: 1;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); }

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.13s;
  font-family: inherit;
}
.icon-btn:hover { background: var(--bg); color: var(--text-primary); }

.icon-btn.danger:hover { background: #FEE2E2; color: #B91C1C; border-color: #FCA5A5; }

/* ─── Page body ──────────────────────────────────────────── */
.page-body { flex: 1; padding: 28px 32px; }

/* ─── Stat cards ─────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

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

.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.purple { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: #D1FAE5; color: #059669; }
.stat-icon.blue   { background: #DBEAFE; color: #2563EB; }

.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.8px;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-sub { font-size: 12px; color: var(--text-muted); }

/* ─── Section card ───────────────────────────────────────── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.section-title-group { display: flex; align-items: center; gap: 10px; }

.section-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.section-count {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
}

/* ─── Tickets table ──────────────────────────────────────── */
.tickets-table {
  width: 100%;
  border-collapse: collapse;
}

.tickets-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 11px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.tickets-table td {
  padding: 14px 24px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.tickets-table tbody tr:last-child td { border-bottom: none; }

.tickets-table tbody tr:hover td { background: #FAFBFF; }

.ticket-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ticket-thumb {
  width: 52px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border);
}

.ticket-thumb-empty {
  width: 52px;
  height: 36px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}

.ticket-name { font-weight: 500; font-size: 13.5px; }
.ticket-id   { font-size: 11.5px; color: var(--text-muted); }

.price-cell  { font-weight: 600; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 13px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 500;
}

.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.badge-active   { background: var(--success-bg); color: var(--success-text); }
.badge-active::before { background: #10B981; }

.badge-inactive { background: var(--warning-bg); color: var(--warning-text); }
.badge-inactive::before { background: #F59E0B; }

.table-actions { display: flex; align-items: center; gap: 6px; }

/* ─── Empty state ────────────────────────────────────────── */
.empty-state {
  padding: 80px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.empty-icon-wrap {
  width: 60px;
  height: 60px;
  background: var(--primary-light);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--primary);
}

.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  max-width: 280px;
  line-height: 1.5;
}

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,5,15,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(0.99);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.modal-sub   { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.modal-close {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.13s;
  font-size: 18px;
  font-family: inherit;
}
.modal-close:hover { background: var(--bg); color: var(--text-primary); }

.modal-body {
  padding: 22px;
  flex: 1;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ─── Form ───────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-label .req { color: var(--danger); margin-left: 2px; }

.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color 0.13s, box-shadow 0.13s;
  outline: none;
  font-family: inherit;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

.form-input::placeholder { color: var(--text-muted); }
.form-input.has-error    { border-color: var(--danger); }

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 5px;
  display: none;
}
.form-error.visible { display: block; }

/* Price row */
.price-row {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.13s, box-shadow 0.13s;
}
.price-row:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}
.price-prefix {
  padding: 9px 12px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-secondary);
  font-weight: 600;
  user-select: none;
}
.price-row .form-input {
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.price-row .form-input:focus { box-shadow: none; }
.price-row.has-error { border-color: var(--danger); }

/* Banner upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.13s, background 0.13s;
  position: relative;
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-zone-icon {
  width: 38px;
  height: 38px;
  background: var(--bg);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  color: var(--text-secondary);
}
.upload-zone-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.upload-zone-text strong { color: var(--primary); }
.upload-zone-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Banner preview */
.banner-preview {
  display: none;
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.banner-preview img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}
.banner-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.banner-preview-name { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.banner-clear-btn {
  font-size: 12px;
  color: var(--danger);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
  font-family: inherit;
  padding: 0;
}
.banner-clear-btn:hover { text-decoration: underline; }

/* Status toggle */
.status-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.status-toggle-btn {
  flex: 1;
  padding: 9px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.13s;
  border: none;
  background: transparent;
  font-family: inherit;
}
.status-toggle-btn + .status-toggle-btn { border-left: 1px solid var(--border); }

.status-toggle-btn.on  { background: var(--success-bg); color: var(--success-text); }
.status-toggle-btn.off { background: var(--warning-bg); color: var(--warning-text); }

/* ─── Hamburger ──────────────────────────────────────────── */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 12px;
  transition: background 0.13s;
}
.hamburger:hover { background: var(--bg); }

/* ─── Sidebar overlay (mobile) ───────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 15, 0.5);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
}
.sidebar-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: block;
  }
  .main-content {
    margin-left: 0;
  }
  .topbar {
    padding: 0 16px;
  }
  .hamburger {
    display: inline-flex;
  }
  .page-body {
    padding: 20px 16px;
  }
  .section-header {
    padding: 14px 16px;
  }
  .tickets-table th,
  .tickets-table td {
    padding: 11px 14px;
  }
}
