/*
 * pakket-ui.css — shared design tokens + components for the "Family A"
 * pages (login.html, user.html, admin.html — navy/blue, the product's
 * first-impression pages). Plain CSS, no build step, matches this repo's
 * static/*.html convention (see CLAUDE.md's "Frontend" section).
 *
 * Scope (2026-08-24 design-system pass): trucks.html/performance.html and
 * index.html use a different palette today and are NOT migrated onto this
 * file yet — see TODO.md item 4/5 follow-up. Don't assume every page links
 * this; check for the <link> before relying on these classes existing.
 */

:root {
  /* Brand */
  --pk-navy:        #0F1B3D;
  --pk-blue:         #3B82F6;
  --pk-blue-hover:   #2563EB;
  --pk-blue-focus:   rgba(59, 130, 246, 0.1);

  /* Surfaces */
  --pk-bg:           #F3F4F7;
  --pk-surface:      #fff;
  --pk-border:       #E5E7EB;
  --pk-border-strong:#D1D5DB;
  --pk-row-border:   #F3F4F6;

  /* Text */
  --pk-text:         #0F1B3D;
  --pk-text-muted:   #6B7280;
  --pk-text-faint:   #9CA3AF;
  --pk-text-strong:  #374151;

  /* Status */
  --pk-danger:       #DC2626;
  --pk-danger-bg:    #FEF2F2;
  --pk-danger-border:#FECACA;
  --pk-success:      #059669;
  --pk-success-bg:   #ECFDF5;
  --pk-success-border:#A7F3D0;
  --pk-warning-bg:   #FEF3C7;
  --pk-warning-text: #92400E;

  /* Role badges */
  --pk-role-admin-bg:    #DBEAFE;
  --pk-role-admin-text:  #1D4ED8;
  --pk-role-staff-bg:    #D1FAE5;
  --pk-role-staff-text:  #065F46;
  --pk-role-customer-bg: #FEF3C7;
  --pk-role-customer-text: #92400E;

  /* Shape */
  --pk-radius-sm: 6px;
  --pk-radius-md: 8px;
  --pk-radius-lg: 12px;
  --pk-radius-xl: 14px;

  --pk-font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset + base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  font-family: var(--pk-font);
  background: var(--pk-bg); color: var(--pk-text);
}

/* ── Top bar ────────────────────────────────────────────────────────────── */
.topbar {
  height: 56px; background: var(--pk-surface);
  border-bottom: 1px solid var(--pk-border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
}
.topbar-logo {
  width: 32px; height: 32px; background: var(--pk-blue);
  border-radius: var(--pk-radius-md); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topbar-logo svg { width: 16px; height: 16px; }
.topbar-title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1; min-width: 8px; }
.topbar-back {
  font-size: 13px; color: var(--pk-blue); text-decoration: none;
  font-weight: 500; white-space: nowrap;
}
.topbar-back:hover { text-decoration: underline; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--pk-surface); border-radius: var(--pk-radius-lg);
  border: 1px solid var(--pk-border);
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--pk-border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: 15px; font-weight: 600; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn-primary {
  padding: 10px 20px; border-radius: var(--pk-radius-md);
  font-size: 14px; font-weight: 600; font-family: inherit;
  border: none; background: var(--pk-blue); color: #fff;
  cursor: pointer; transition: background 0.15s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--pk-blue-hover); }
.btn-primary:disabled { background: rgba(59, 130, 246, 0.5); cursor: not-allowed; }

.btn-sm {
  padding: 5px 12px; border-radius: var(--pk-radius-sm);
  font-size: 12px; font-weight: 500; font-family: inherit;
  border: 1px solid var(--pk-border); background: var(--pk-surface);
  color: var(--pk-text-strong); cursor: pointer;
  transition: background 0.15s;
}
.btn-sm:hover { background: #F3F4F6; }
.btn-sm.danger { color: var(--pk-danger); border-color: var(--pk-danger-border); }
.btn-sm.danger:hover { background: var(--pk-danger-bg); }
.btn-sm.success { color: var(--pk-success); border-color: var(--pk-success-border); }
.btn-sm.success:hover { background: var(--pk-success-bg); }

.btn-cancel {
  padding: 9px 16px; border-radius: var(--pk-radius-md);
  font-size: 14px; font-family: inherit;
  border: 1px solid var(--pk-border-strong); background: var(--pk-surface); color: var(--pk-text-strong);
  cursor: pointer;
}
.btn-cancel:hover { background: #F3F4F6; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--pk-text-muted); margin-bottom: 6px;
}
.form-group input, .form-field input, .form-field select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--pk-border-strong); border-radius: var(--pk-radius-md);
  font-size: 14px; font-family: inherit; color: var(--pk-text);
  outline: none; background: var(--pk-surface);
}
.form-group input:focus, .form-field input:focus, .form-field select:focus {
  border-color: var(--pk-blue); box-shadow: 0 0 0 3px var(--pk-blue-focus);
}

/* ── Status messages / toast ────────────────────────────────────────────── */
.msg {
  padding: 10px 14px; border-radius: var(--pk-radius-md);
  font-size: 13px; margin-bottom: 16px;
  display: none;
}
.msg.success { display: block; background: var(--pk-success-bg); border: 1px solid var(--pk-success-border); color: var(--pk-success); }
.msg.error   { display: block; background: var(--pk-danger-bg); border: 1px solid var(--pk-danger-border); color: var(--pk-danger); }

.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--pk-navy); color: #fff;
  padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(80px); opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 9999;
  max-width: calc(100vw - 48px);
}
.toast.visible { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--pk-danger); }

/* ── Role badges ────────────────────────────────────────────────────────── */
.role-badge {
  display: inline-block;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
}
.role-admin    { background: var(--pk-role-admin-bg);    color: var(--pk-role-admin-text); }
.role-staff    { background: var(--pk-role-staff-bg);    color: var(--pk-role-staff-text); }
.role-customer { background: var(--pk-role-customer-bg); color: var(--pk-role-customer-text); }

.status-active   { color: var(--pk-success); }
.status-inactive { color: var(--pk-danger); }

/* ── Table ──────────────────────────────────────────────────────────────── */
/* Wrap any <table> that might overflow a narrow viewport in
   <div class="table-scroll">...</div> — scrolls horizontally instead of
   squeezing columns unreadably thin. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 10px 20px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--pk-text-muted); background: #F9FAFB;
  border-bottom: 1px solid var(--pk-border);
  white-space: nowrap;
}
td {
  padding: 12px 20px; font-size: 14px;
  border-bottom: 1px solid var(--pk-row-border);
}
tr:last-child td { border-bottom: none; }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: none; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px; /* keeps the modal off the viewport edge on small screens */
}
.modal-overlay.visible { display: flex; }
.modal {
  background: var(--pk-surface); border-radius: var(--pk-radius-xl);
  padding: 28px; width: 100%; max-width: 380px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.modal input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--pk-border-strong); border-radius: var(--pk-radius-md);
  font-size: 14px; font-family: inherit;
  outline: none; margin-bottom: 16px;
}
.modal input:focus { border-color: var(--pk-blue); }
.modal-btns { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
/* None of Pakket's pages had a single @media query before this file
   (confirmed repo-wide, 2026-08-24 review) — viewport meta tags were
   present but doing nothing without breakpoints behind them. These cover
   the shared chrome above; page-specific content (e.g. admin.html's
   form-row) may need its own additional rule alongside these. */
@media (max-width: 640px) {
  .topbar { padding: 0 16px; gap: 12px; }
  .topbar-title { font-size: 14px; }
  .topbar-back span.topbar-back-full { display: none; } /* pages may swap in a shorter label */

  .card-header { padding: 14px 16px; flex-wrap: wrap; gap: 8px; }

  th, td { padding: 10px 12px; }

  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}
