/* ═══════════════════════════════════════════
   Admin Panel — Airtable-Inspired Design
   ═══════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  --navy:        #181d26;
  --blue:        #1b61c9;
  --blue-hover:  #1550a3;
  --blue-light:  rgba(27,97,201,0.08);
  --white:       #ffffff;
  --surface:     #f8fafc;
  --border:      #e0e2e6;
  --text-weak:   rgba(4,14,32,0.69);
  --success:     #006400;
  --danger:      #d93025;
  --danger-hover:#b71c1c;
  --shadow-blue: rgba(0,0,0,0.32) 0px 0px 1px, rgba(0,0,0,0.08) 0px 0px 2px, rgba(45,127,249,0.28) 0px 1px 3px;
  --shadow-soft: rgba(15,48,106,0.05) 0px 0px 20px;
  --radius-sm:   6px;
  --radius:      12px;
  --radius-lg:   16px;
  --sidebar-w:   220px;
  --header-h:    56px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--navy);
  background: var(--surface);
  line-height: 1.45;
  letter-spacing: 0.08px;
  -webkit-font-smoothing: antialiased;
}

/* ── Login Page ── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8eef7 100%);
}
.login-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 380px;
  box-shadow: var(--shadow-blue);
}
.login-card h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}
.login-card .subtitle {
  color: var(--text-weak);
  text-align: center;
  margin-bottom: 32px;
  font-size: 13px;
}

/* ── Form Controls ── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--navy);
}
.form-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--navy);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(27,97,201,0.12);
}
.form-input::placeholder { color: #bbb; }
select.form-input { cursor: pointer; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  letter-spacing: 0.04px;
}
.btn-primary {
  background: var(--blue);
  color: var(--white);
  box-shadow: 0 1px 2px rgba(27,97,201,0.3);
}
.btn-primary:hover { background: var(--blue-hover); }
.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface); }
.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-full { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}
.sidebar-brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand span { color: var(--blue); margin-right: 6px; }
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 400;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active {
  background: var(--blue);
  color: var(--white);
  font-weight: 500;
}
.nav-item .icon { font-size: 17px; width: 22px; text-align: center; }
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

/* ── Main Area ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}
.page-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title { font-size: 16px; font-weight: 600; }
.page-body { padding: 24px 28px; }

/* ── Toolbar ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.toolbar .search-input {
  width: 260px;
}
.toolbar .spacer { flex: 1; }

/* ── Table ── */
.table-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--surface);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  color: var(--text-weak);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f1f3;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: var(--blue-light); }
.cell-mono {
  font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace;
  font-size: 12px;
}

/* ── Badge / Tag ── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}
.tag-blue   { background: rgba(27,97,201,0.1); color: var(--blue); }
.tag-green  { background: rgba(0,100,0,0.1);   color: var(--success); }
.tag-red    { background: rgba(217,48,37,0.1); color: var(--danger); }
.tag-orange { background: rgba(230,81,0,0.1);  color: #e65100; }
.tag-gray   { background: rgba(0,0,0,0.06);    color: var(--text-weak); }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid #f0f1f3;
  font-size: 13px;
  color: var(--text-weak);
}
.pagination-btns { display: flex; gap: 6px; }
.pagination-btns .btn { min-width: 36px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 520px;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  transform: translateY(12px);
  transition: transform 0.2s;
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none;
  font-size: 18px; color: var(--text-weak);
  cursor: pointer; border-radius: 6px;
}
.modal-close:hover { background: var(--surface); }
.modal-body { padding: 24px; overflow-y: auto; max-height: 60vh; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--white);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: toast-in 0.25s ease;
  min-width: 200px;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--blue); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-weak);
}
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Stats Row ── */
.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  flex: 1;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.stat-card .label { font-size: 12px; color: var(--text-weak); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--navy); }
.stat-card .value.blue { color: var(--blue); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .nav-item span:not(.icon) { display: none; }
  .sidebar .sidebar-brand span:last-child { display: none; }
  .main-content { margin-left: 60px; }
  .toolbar .search-input { width: 180px; }
}
