/* ==========================================
   BMF Car Handover — Dashboard UI
   ========================================== */

:root {
  --green-900: #0d3b13;
  --green-800: #14532d;
  --green-700: #166534;
  --green-600: #16a34a;
  --green-100: #dcfce7;
  --indigo: #3f51b5;
  --indigo-dark: #303f9f;
  --indigo-light: #e8eaf6;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-600: #d97706;
  --white: #fff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-w: 260px;
  --header-h: 64px;
  --transition: .2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--slate-100);
  color: var(--slate-800);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--indigo); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--indigo-dark); }

/* ==========================================
   Layout: Sidebar + Main
   ========================================== */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--green-900);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand img { height: 44px; border-radius: 10px; }
.sidebar-brand .brand-text h1 { font-size: 16px; font-weight: 800; line-height: 1.2; }
.sidebar-brand .brand-text .sub { color: #86efac; font-size: 10px; letter-spacing: 3px; font-weight: 600; margin-top: 2px; }

.sidebar-nav { padding: 16px 12px; flex: 1; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: 10px;
  color: rgba(255,255,255,.7);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
  margin-bottom: 4px;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,.08);
  color: var(--white);
}
.sidebar-nav a.active {
  background: rgba(255,255,255,.12);
  color: var(--white);
}
.sidebar-nav .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .7;
}
.sidebar-nav a.active .nav-icon,
.sidebar-nav a:hover .nav-icon { opacity: 1; }

/* Nav badge (notification dot) */
.nav-badge {
  background: var(--red-500);
  color: var(--white);
  font-size: 11px;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  margin-left: auto;
  line-height: 1;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 13px;
}
.sidebar-footer a {
  color: rgba(255,255,255,.5);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  transition: color var(--transition);
}
.sidebar-footer a:hover { color: rgba(255,255,255,.9); }

/* Main content */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

/* Page header */
.page-header {
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--slate-900);
}
.page-header .subtitle {
  font-size: 13px;
  color: var(--slate-500);
  margin-top: 2px;
}

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

/* ==========================================
   Cards
   ========================================== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }
.card h2 { font-size: 15px; font-weight: 700; margin-bottom: 16px; color: var(--slate-700); }
.card h3 {
  font-size: 12px;
  color: var(--slate-400);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
}

/* ==========================================
   Stat cards
   ========================================== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.green { background: var(--green-100); color: var(--green-600); }
.stat-icon.blue { background: var(--indigo-light); color: var(--indigo); }
.stat-icon.amber { background: var(--amber-100); color: var(--amber-600); }
.stat-icon.slate { background: var(--slate-100); color: var(--slate-500); }
.stat-info .number { font-size: 28px; font-weight: 800; color: var(--slate-900); line-height: 1; }
.stat-info .label { font-size: 13px; color: var(--slate-500); margin-top: 6px; font-weight: 500; }

/* ==========================================
   Tables
   ========================================== */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--slate-400);
  border-bottom: 2px solid var(--slate-200);
  background: transparent;
}
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}
tr { transition: background var(--transition); }
tr:hover { background: var(--slate-50); }
tbody tr:last-child td { border-bottom: none; }

/* ==========================================
   Badges
   ========================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2px;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-synced { background: var(--green-100); color: #15803d; }
.badge-synced::before { background: #16a34a; }
.badge-completed { background: var(--amber-100); color: #b45309; }
.badge-completed::before { background: #d97706; }
.badge-failed { background: var(--red-100); color: var(--red-600); }
.badge-failed::before { background: var(--red-500); }
.badge-draft { background: var(--slate-100); color: var(--slate-500); }
.badge-draft::before { background: var(--slate-400); }
.badge-da { background: var(--green-100); color: #15803d; }
.badge-da::before { display: none; }
.badge-nu { background: var(--red-100); color: var(--red-600); }
.badge-nu::before { display: none; }

/* ==========================================
   Filters
   ========================================== */
.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.filters input, .filters select {
  padding: 10px 16px;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  font-size: 14px;
  background: var(--slate-50);
  color: var(--slate-800);
  transition: all var(--transition);
}
.filters input:focus, .filters select:focus {
  outline: none;
  border-color: var(--indigo);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(63,81,181,.1);
}
.filters input::placeholder { color: var(--slate-400); }

/* ==========================================
   Buttons
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--indigo); color: var(--white); box-shadow: 0 1px 3px rgba(63,81,181,.3); }
.btn-primary:hover { background: var(--indigo-dark); box-shadow: 0 4px 8px rgba(63,81,181,.25); color: var(--white); }
.btn-green { background: var(--green-600); color: var(--white); box-shadow: 0 1px 3px rgba(22,163,74,.3); }
.btn-green:hover { background: #15803d; box-shadow: 0 4px 8px rgba(22,163,74,.25); color: var(--white); }
.btn-outline { background: var(--white); color: var(--slate-700); border: 1px solid var(--slate-200); }
.btn-outline:hover { background: var(--slate-50); border-color: var(--slate-300); }
.btn-danger-outline { background: var(--white); color: var(--red-600); border: 1px solid var(--red-100); }
.btn-danger-outline:hover { background: var(--red-50); border-color: var(--red-500); }
.btn-success-outline { background: var(--white); color: var(--green-600); border: 1px solid var(--green-100); }
.btn-success-outline:hover { background: #f0fdf4; border-color: var(--green-600); }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ==========================================
   Detail page
   ========================================== */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.detail-header .plate {
  font-size: 24px;
  font-weight: 800;
  color: var(--slate-900);
}
.detail-header .vehicle {
  font-size: 14px;
  color: var(--slate-500);
  margin-top: 2px;
}

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.detail-grid .field {
  padding: 12px 16px;
  border-radius: 8px;
  transition: background var(--transition);
}
.detail-grid .field:hover { background: var(--slate-50); }
.detail-grid .field .label {
  font-size: 11px;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 600;
}
.detail-grid .field .value {
  font-size: 15px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--slate-800);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-500);
  margin-bottom: 20px;
  transition: color var(--transition);
}
.back-link:hover { color: var(--indigo); }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.photo-item { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--slate-200); }
.photo-item img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  transition: transform var(--transition);
}
.photo-item:hover img { transform: scale(1.03); }
.photo-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
  color: var(--white);
  padding: 12px 12px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* Signatures */
.sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 16px; }
.sig-box {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  background: var(--slate-50);
}
.sig-box .role {
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  color: var(--slate-500);
}
.sig-box img { max-width: 100%; max-height: 80px; }
.sig-box .name { font-size: 13px; margin-top: 12px; color: var(--slate-500); line-height: 1.4; }

/* Meta info */
.meta-card {
  font-size: 12px;
  color: var(--slate-400);
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.meta-card .meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================
   Login page
   ========================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green-900) 0%, var(--green-800) 50%, var(--green-700) 100%);
  padding: 24px;
}
.login-box {
  width: 100%;
  max-width: 420px;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo img { height: 72px; border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.login-logo h1 { color: var(--white); font-size: 20px; font-weight: 800; margin-top: 16px; }
.login-logo .sub { color: #86efac; font-size: 11px; letter-spacing: 3px; font-weight: 600; margin-top: 4px; }

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.login-card h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--slate-900);
  text-align: center;
  margin-bottom: 4px;
}
.login-card .login-sub {
  color: var(--slate-500);
  font-size: 14px;
  text-align: center;
  margin-bottom: 28px;
}
.login-card .form-group { margin-bottom: 16px; }
.login-card .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 6px;
}
.login-card input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  font-size: 15px;
  color: var(--slate-800);
  background: var(--slate-50);
  transition: all var(--transition);
}
.login-card input:focus {
  outline: none;
  border-color: var(--indigo);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(63,81,181,.1);
}
.login-card input::placeholder { color: var(--slate-400); }
.login-card .btn { width: 100%; padding: 14px; font-size: 15px; margin-top: 8px; }

.login-error {
  background: var(--red-50);
  color: var(--red-600);
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--red-100);
}
.login-error::before { content: '!'; width: 22px; height: 22px; border-radius: 50%; background: var(--red-100); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }

/* ==========================================
   Technicians page
   ========================================== */
.add-form {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.add-form .form-group { flex: 1; min-width: 180px; }
.add-form .form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-500);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.add-form .form-group input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  font-size: 14px;
  background: var(--slate-50);
  color: var(--slate-800);
  transition: all var(--transition);
}
.add-form .form-group input:focus {
  outline: none;
  border-color: var(--indigo);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(63,81,181,.1);
}

.access-code {
  background: var(--slate-900);
  color: #86efac;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 3px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  display: inline-block;
}

/* Checklist */
.checklist-table td:nth-child(2) { text-align: center; width: 80px; }
.checklist-table td:nth-child(3) { color: var(--slate-500); font-size: 13px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--slate-400);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.empty-state .empty-title { font-size: 16px; font-weight: 700; color: var(--slate-500); margin-bottom: 4px; }
.empty-state .empty-sub { font-size: 14px; }

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 1024px) {
  .sidebar { width: 72px; }
  .sidebar-brand .brand-text,
  .sidebar-nav a span:not(.nav-badge),
  .sidebar-footer span { display: none; }
  .sidebar-nav a .nav-badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
  .sidebar-nav a { position: relative; }
  .sidebar-brand { padding: 16px; justify-content: center; }
  .sidebar-brand img { height: 36px; }
  .sidebar-nav a { justify-content: center; padding: 12px; }
  .sidebar-nav .nav-icon { width: 24px; height: 24px; }
  .sidebar-footer a { justify-content: center; }
  .main { margin-left: 72px; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .page-body { padding: 20px 16px; }
  .page-header { padding: 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .sig-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 16px; }
  .filters { flex-direction: column; }
  .filters input, .filters select { width: 100%; }

  /* Mobile header */
  .mobile-header {
    display: flex;
    background: var(--green-900);
    color: var(--white);
    padding: 12px 16px;
    align-items: center;
    gap: 12px;
  }
  .mobile-header img { height: 32px; border-radius: 6px; }
  .mobile-header h1 { font-size: 15px; font-weight: 800; flex: 1; }
  .mobile-header a { color: rgba(255,255,255,.7); font-size: 13px; }
}

@media (min-width: 769px) {
  .mobile-header { display: none; }
}
