/* ============================================================
   style.css — Kaizo Logistic · Navy Dark Theme
   Background: #0f1b2d  Cards: #16223a  Accent: #00c2ff
   ============================================================ */

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

:root {
  --bg:          #0f1b2d;
  --card:        #16223a;
  --card-hover:  #1c2d4a;
  --border:      #1e3050;
  --accent:      #00c2ff;
  --accent-dim:  rgba(0, 194, 255, 0.15);
  --accent-glow: rgba(0, 194, 255, 0.35);
  --text:        #e2eaf5;
  --text-muted:  #7a90b0;
  --text-dim:    #4a6080;
  --sidebar-w:   240px;
  --topbar-h:    60px;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 4px 20px rgba(0,0,0,0.4);
  --transition:  0.2s ease;

  /* Status colours */
  --status-inprogress: #00c2ff;
  --status-completed:  #22c55e;
  --status-pending:    #f59e0b;
  --status-overdue:    #ef4444;
}

html { font-size: 15px; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

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

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-width: 0;
  transition: margin-left var(--transition);
}

.page-body {
  padding: 28px 32px;
  max-width: 1400px;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
}

.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #0078d4);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; color: #fff;
  flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 0.95rem; color: var(--text); }
.brand-sub  { font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase; }

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  position: relative;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}

.nav-item:hover {
  background: var(--accent-dim);
  color: var(--text);
  text-decoration: none;
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-active-bar {
  position: absolute;
  right: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--accent);
  border-radius: 3px 0 0 3px;
}

.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
}

.nav-logout { color: var(--text-muted); }
.nav-logout:hover { color: var(--status-overdue); background: rgba(239,68,68,0.1); }

/* Sidebar collapsed */
.sidebar-collapsed .sidebar  { transform: translateX(calc(-1 * var(--sidebar-w))); }
.sidebar-collapsed .main-content { margin-left: 0; }

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 0 20px;
  z-index: 90;
  transition: left var(--transition);
  gap: 16px;
}

.sidebar-collapsed .topbar { left: 0; }

.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.page-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-toggle {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  border-radius: var(--radius-sm);
}
.sidebar-toggle:hover { background: var(--accent-dim); }
.sidebar-toggle span {
  display: block;
  width: 20px; height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: var(--transition);
}

.topbar-search { position: relative; }
.search-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  padding: 6px 14px 6px 36px;
  font-size: 0.83rem;
  width: 200px;
  outline: none;
  transition: border-color var(--transition), width var(--transition);
}
.search-input:focus { border-color: var(--accent); width: 260px; }
.search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  position: relative;
  user-select: none;
}
.topbar-user:hover { background: var(--accent-dim); }

.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #0078d4);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
}

.user-name { font-size: 0.85rem; font-weight: 500; }
.chevron { color: var(--text-muted); transition: transform var(--transition); }
.topbar-user.open .chevron { transform: rotate(180deg); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 210px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 200;
  overflow: hidden;
}
.user-dropdown.visible { display: block; }

.user-dropdown-info {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-dropdown-info strong { font-size: 0.875rem; color: var(--text); }
.user-dropdown-info small  { font-size: 0.75rem;  color: var(--text-muted); }

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.user-dropdown-item:hover { background: var(--accent-dim); color: var(--text); text-decoration: none; }
.user-dropdown-item.logout:hover { background: rgba(239,68,68,0.12); color: var(--status-overdue); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Checkbox list ─────────────────────────────────────────── */
.checkbox-grid {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 13px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), color var(--transition);
  user-select: none;
}
.checkbox-item:last-child { border-bottom: none; }
.checkbox-item:hover { background: var(--accent-dim); color: var(--text); }
.checkbox-item:has(input:checked) { background: var(--accent-dim); color: var(--accent); }

.checkbox-item input[type="checkbox"] {
  appearance: none;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition);
  position: relative;
}
.checkbox-item input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox-item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px; top: 0;
  width: 5px; height: 9px;
  border: 2px solid #0a1628;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color var(--transition), transform var(--transition);
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.stat-icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue   { background: rgba(0,194,255,0.15);  color: var(--accent); }
.stat-icon.green  { background: rgba(34,197,94,0.15);  color: var(--status-completed); }
.stat-icon.amber  { background: rgba(245,158,11,0.15); color: var(--status-pending); }
.stat-icon.red    { background: rgba(239,68,68,0.15);  color: var(--status-overdue); }

.stat-info { min-width: 0; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: rgba(15,27,45,0.7);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
  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(--card-hover); }

tbody td { padding: 13px 16px; vertical-align: middle; }

.table-actions { display: flex; gap: 8px; }

/* ── Status Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-inprogress { background: rgba(0,194,255,0.15);  color: var(--status-inprogress); }
.badge-completed  { background: rgba(34,197,94,0.15);  color: var(--status-completed); }
.badge-pending    { background: rgba(245,158,11,0.15); color: var(--status-pending); }
.badge-overdue    { background: rgba(239,68,68,0.15);  color: var(--status-overdue); }
.badge-active     { background: rgba(34,197,94,0.15);  color: var(--status-completed); }
.badge-inactive   { background: rgba(74,96,128,0.2);   color: var(--text-muted); }
.badge-paid       { background: rgba(34,197,94,0.15);  color: var(--status-completed); }
.badge-approved   { background: rgba(34,197,94,0.15);  color: var(--status-completed); }
.badge-received   { background: rgba(0,194,255,0.15);  color: var(--status-inprogress); }
.badge-cancelled  { background: rgba(239,68,68,0.15);  color: var(--status-overdue); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--accent);
  color: #0a1628;
}
.btn-primary:hover { background: #33ccff; box-shadow: 0 0 14px var(--accent-glow); text-decoration: none; }

.btn-secondary {
  background: rgba(0,194,255,0.12);
  color: var(--accent);
  border: 1px solid rgba(0,194,255,0.3);
}
.btn-secondary:hover { background: rgba(0,194,255,0.22); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--card-hover); color: var(--text); text-decoration: none; }

.btn-danger {
  background: rgba(239,68,68,0.12);
  color: var(--status-overdue);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.22); text-decoration: none; }

.btn-sm { padding: 5px 11px; font-size: 0.8rem; }

/* ── Tabs ──────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  flex-wrap: nowrap;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
  margin-bottom: -1px;
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Page header row ───────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h2 { font-size: 1.2rem; font-weight: 700; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-control {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 13px;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition);
  font-family: inherit;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text-dim); }
select.form-control { appearance: none; cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) 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: 1rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--card-hover); color: var(--text); }

.modal-body    { padding: 24px; }
.modal-footer  { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Filters bar ───────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-bar .form-control { width: auto; min-width: 160px; }

/* ── Login page ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse at 60% 40%, rgba(0,194,255,0.06) 0%, transparent 60%), var(--bg);
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--accent), #0078d4);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px; color: #fff;
  margin: 0 auto 20px;
}

.login-title    { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.login-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 32px; }

.login-divider {
  height: 1px;
  background: var(--border);
  margin: 28px 0;
  position: relative;
}

.btn-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  background: #fff;
  color: #1a1a1a;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  transition: box-shadow var(--transition), transform var(--transition);
  text-decoration: none;
}
.btn-microsoft:hover {
  box-shadow: 0 4px 16px rgba(255,255,255,0.15);
  transform: translateY(-1px);
  text-decoration: none;
  color: #1a1a1a;
}
.ms-logo { width: 20px; height: 20px; flex-shrink: 0; }

/* ── Detail view ───────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.detail-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.detail-field p {
  font-size: 0.9rem;
  color: var(--text);
}

/* ── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--text-dim); }
.breadcrumb span { color: var(--text); }

/* ── Footer ────────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 16px 32px;
  font-size: 0.78rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  margin-left: var(--sidebar-w);
}
.sidebar-collapsed .app-footer { margin-left: 0; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 20px;
  border-left: 3px solid;
}
.alert-success { background: rgba(34,197,94,0.1);  color: var(--status-completed); border-color: var(--status-completed); }
.alert-error   { background: rgba(239,68,68,0.1);  color: var(--status-overdue);   border-color: var(--status-overdue); }
.alert-info    { background: rgba(0,194,255,0.1);  color: var(--accent);           border-color: var(--accent); }

/* ── Payroll stats row ─────────────────────────────────────── */
.payroll-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.payroll-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  text-align: center;
}
.payroll-stat .value { font-size: 1.4rem; font-weight: 700; color: var(--accent); }
.payroll-stat .label { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; }
  .main-content { margin-left: 0; }
  .topbar { left: 0; }
  .app-footer { margin-left: 0; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,0.5); }
  .page-body { padding: 20px 16px; }
  .user-name { display: none; }
}

@media (max-width: 600px) {
  .page-header { flex-direction: column; align-items: flex-start; }
  .search-input { width: 140px; }
  .search-input:focus { width: 160px; }
}

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