@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FFFFFF;
  --bg2: #FAFAFA;
  --bg3: #F4F4F4;
  --card: #FFFFFF;
  --border: rgba(64,124,226,0.25);
  --primary: #407CE2;
  --primary-hover: #3570D0;
  --primary-dim: rgba(64,124,226,0.1);
  --success: #16a34a;
  --success-dim: rgba(22,163,74,0.1);
  --warning: #d97706;
  --warning-dim: rgba(217,119,6,0.1);
  --danger: #dc2626;
  --danger-dim: rgba(220,38,38,0.1);
  --text: #1B1B1B;
  --text-2: #454545;
  --text-3: #888888;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(64,124,226,0.1);
  --transition: 0.18s ease;
}

html, body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  border-width: 2px;
  box-shadow: 0 0 0 3px rgba(64,124,226,0.12);
  background: #ffffff;
}
input:disabled, textarea:disabled, select:disabled {
  background: #f0f0f0;
  color: var(--text-3);
  cursor: not-allowed;
  border-color: var(--border);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 99px; }

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

.sidebar {
  width: 220px;
  min-width: 220px;
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.sidebar-logo .logo-text { font-size: 15px; font-weight: 700; color: var(--text); }
.sidebar-logo .logo-sub { font-size: 11px; color: var(--text-3); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 0;
  color: var(--text-2);
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  user-select: none;
}
.nav-item:hover { background: var(--primary-dim); color: var(--text); }
.nav-item.active { background: var(--primary-dim); color: var(--primary); border-left-color: var(--primary); }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-3);
  text-transform: uppercase;
  padding: 16px 20px 6px;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary-dim);
  border: 2px solid var(--primary);
  object-fit: cover;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-3); }

.main-content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-title { font-size: 22px; font-weight: 700; }
.page-subtitle { color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

/* ─── Stats ─────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-card.primary .stat-value { color: var(--primary); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger  .stat-value { color: var(--danger); }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.1); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled)  { filter: brightness(1.1); }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover:not(:disabled) { background: #d97706; }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg3); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ─── Tabs ──────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}
.tab {
  flex: 1;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  color: var(--text-2);
  transition: all var(--transition);
  user-select: none;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--card); color: var(--primary); font-weight: 600; }
.tab .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
}

/* ─── Table ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  text-align: left;
  padding: 10px 14px;
  color: var(--text-3);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg2); }
tbody td { padding: 12px 14px; vertical-align: middle; }

/* ─── Status Badges ─────────────────────────────────────────────────────── */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.badge-pending  { background: var(--warning-dim); color: var(--warning); }
.badge-active   { background: var(--success-dim); color: var(--success); }
.badge-inactive { background: var(--border); color: var(--text-3); }
.badge-claimed  { background: var(--primary-dim); color: var(--primary); }
.badge-picking  { background: var(--primary-dim); color: var(--primary); }
.badge-packaging{ background: var(--warning-dim); color: var(--warning); }
.badge-awaiting { background: var(--warning-dim); color: var(--warning); }
.badge-ready    { background: var(--success-dim); color: var(--success); }
.badge-shipped  { background: var(--success-dim); color: var(--success); }
.badge-cancelled{ background: var(--danger-dim); color: var(--danger); }

/* ─── Avatar ────────────────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-dim);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-lg { width: 80px; height: 80px; font-size: 28px; }

/* ─── Forms ─────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Avatar upload */
.avatar-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition);
  background: var(--bg3);
}
.avatar-upload:hover { border-color: var(--primary); }
.avatar-upload.has-image { border-style: solid; border-color: var(--primary); }
.avatar-preview {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg2);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  color: var(--text-3);
  overflow: hidden;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-upload-text { font-size: 12px; color: var(--text-3); text-align: center; }

/* ─── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-3);
  background: transparent;
  border: none;
  font-size: 18px;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg3); color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ─── Toast ─────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  min-width: 280px;
  animation: slideIn 0.25s ease;
}
.toast.success { background: #f0fdf4; border: 1px solid var(--success); color: var(--success); }
.toast.error   { background: #fef2f2; border: 1px solid var(--danger);  color: var(--danger); }
.toast.info    { background: #eff6ff; border: 1px solid var(--primary); color: var(--primary); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

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

/* ─── Loading spinner ───────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Booking detail card ───────────────────────────────────────────────── */
.detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  pointer-events: none;
}
.detail-backdrop {
  flex: 1;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  transition: opacity var(--transition);
}
.detail-panel {
  width: 520px;
  max-width: 95vw;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  height: 100%;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  padding: 28px;
}
.detail-drawer.open .detail-backdrop { opacity: 1; pointer-events: all; }
.detail-drawer.open .detail-panel    { transform: translateX(0); pointer-events: all; }

.detail-section { margin-bottom: 20px; }
.detail-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 10px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.detail-row:last-child { border-bottom: none; }
.detail-key { color: var(--text-2); font-size: 13px; flex-shrink: 0; }
.detail-val { font-size: 13px; font-weight: 500; text-align: right; word-break: break-all; }

.action-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

/* ─── Login page ────────────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 60% 20%, rgba(64,124,226,0.08) 0%, transparent 60%), var(--bg2);
  padding: 24px;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .icon { font-size: 48px; }
.login-logo h1 { font-size: 22px; font-weight: 700; margin-top: 8px; }
.login-logo p { color: var(--text-2); font-size: 13px; margin-top: 4px; }

/* ─── Misc ──────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.text-muted { color: var(--text-2); }
.text-sm { font-size: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.ml-auto { margin-left: auto; }

/* ── Inline expand row ── */
.pending-row:hover { background: var(--bg2); }
.pending-row.row-expanded { background: var(--primary-dim); border-bottom: none; }
.expand-row td { background: var(--bg2); border-top: 1px solid var(--border); }
.expand-content {
  padding: 20px 24px;
  border-top: 2px solid var(--primary);
  animation: expandIn 0.18s ease;
}
@keyframes expandIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
