/* ============================================================
   Star Hill Patent – Admin Panel CSS
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:      #4a3d8a;
  --primary-dark: #362d6b;
  --primary-light:#eae8f5;
  --accent:       #e91e63;
  --success:      #2e7d4f;
  --warning:      #f59e0b;
  --danger:       #dc2626;
  --info:         #0ea5e9;
  --bg:           #f4f5f9;
  --sidebar-bg:   #1e1b3a;
  --sidebar-text: #c8c4e8;
  --sidebar-active:#4a3d8a;
  --card-bg:      #ffffff;
  --border:       #e2e4ea;
  --text:         #1a1a2e;
  --text-light:   #6b7280;
  --radius:       10px;
  --shadow:       0 2px 12px rgba(0,0,0,.08);
  --transition:   .2s ease;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo h1 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
}
.sidebar-logo span {
  font-size: 11px;
  color: var(--sidebar-text);
  display: block;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(200,196,232,.4);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all var(--transition);
}
.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}
.nav-item.active {
  background: rgba(74,61,138,.35);
  border-left-color: var(--primary);
  color: #fff;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  transition: color var(--transition);
}
.sidebar-footer a:hover { color: #fff; }

/* ── Main content ────────────────────────────────────────── */
.main {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 18px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-admin {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-light);
}
.admin-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}

.content { padding: 28px; flex: 1; }

/* ── Stat cards ──────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 18px;
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-info { flex: 1; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.stat-change { font-size: 11px; margin-top: 6px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 24px; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-light);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-pending  { background: #fef3c7; color: #92400e; }
.badge-active   { background: #d1fae5; color: #065f46; }
.badge-sold     { background: #dbeafe; color: #1e40af; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-admin    { background: var(--primary-light); color: var(--primary); }
.badge-user     { background: #f3f4f6; color: #374151; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { opacity: .88; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover  { opacity: .88; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover { opacity: .88; }
.btn-info      { background: var(--info); color: #fff; }
.btn-outline   { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  transition: border-color var(--transition);
  background: #fff;
}
.form-control:focus { outline: none; border-color: var(--primary); }
select.form-control { cursor: pointer; }

/* ── Search bar ──────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.search-input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
}
.search-input:focus { outline: none; border-color: var(--primary); }

/* ── Filters ─────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.filter-bar select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.page-btn {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.page-btn:hover, .page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.page-info { font-size: 12px; color: var(--text-light); margin-left: auto; }

/* ── Login page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b3a 0%, #4a3d8a 100%);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 22px; color: var(--primary); }
.login-logo p  { font-size: 13px; color: var(--text-light); margin-top: 4px; }

/* ── Charts placeholder ──────────────────────────────────── */
.chart-container {
  position: relative;
  height: 260px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0 8px;
}
.chart-bar {
  flex: 1;
  background: var(--primary-light);
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: background var(--transition);
  cursor: pointer;
}
.chart-bar:hover { background: var(--primary); }
.chart-bar .bar-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-light);
  white-space: nowrap;
}
.chart-bar .bar-value {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
}

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: #1e1b3a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s ease;
  z-index: 9999;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Utilities ───────────────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-4 { margin-top: 16px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-light); }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }