/* Easyline Fleet - Modern Admin UI */
:root {
  --bg: #f0f2f5;
  --card: #fff;
  --text: #1a1a2e;
  --text-2: #5a5f7a;
  --text-3: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  --green: #10b981;
  --green-light: #d1fae5;
  --red: #ef4444;
  --red-light: #fee2e2;
  --yellow: #f59e0b;
  --yellow-light: #fef3c7;
  --sidebar-w: 240px;
  --sidebar-collapsed: 60px;
  --header-h: 0px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.04), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: #1a1a2e;
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width var(--transition);
  overflow: hidden;
}

.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #fff;
}
.sidebar-brand img { height: 28px; flex-shrink: 0; }
.sidebar-brand span { font-weight: 700; font-size: 1rem; color: #a3c83a; white-space: nowrap; }

.sidebar-nav { flex: 1; padding: 0.75rem 0; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}
.nav-item:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.05); }
.nav-item.active { color: #fff; background: rgba(255,255,255,0.08); border-left-color: #a3c83a; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }

.nav-section {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.25);
  padding: 1.25rem 1.25rem 0.4rem;
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-footer a { color: rgba(255,255,255,0.5); text-decoration: none; font-size: 0.75rem; }
.sidebar-footer a:hover { color: #fff; }

/* ─── Main area ─── */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left var(--transition);
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-title { font-size: 1.15rem; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.container { padding: 1.5rem 2rem; max-width: 1400px; }

/* ─── Cards ─── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.card-header h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.card h3 { font-size: 0.85rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.75rem; }

/* ─── Stats ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.stat-icon-green { background: var(--green-light); color: var(--green); }
.stat-icon-yellow { background: var(--yellow-light); color: var(--yellow); }
.stat-icon-red { background: var(--red-light); color: var(--red); }
.stat-icon-primary { background: var(--primary-light); color: var(--primary); }
.stat-info { flex: 1; }
.stat-num { font-size: 1.75rem; font-weight: 800; line-height: 1.2; }
.stat-label { font-size: 0.75rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500; }

/* ─── Tables ─── */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
th {
  background: #fafbfc;
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fafb; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--primary-light); }

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.badge-orphan { background: var(--yellow-light); color: #92400e; }
.badge-active { background: var(--green-light); color: #065f46; }
.badge-staff { background: #dbeafe; color: #1d4ed8; }
.badge-client { background: #f3e8ff; color: #7c3aed; }

/* ─── Status dot ─── */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-green { background: var(--green); box-shadow: 0 0 0 3px rgba(16,185,129,0.2); }
.dot-red { background: var(--red); box-shadow: 0 0 0 3px rgba(239,68,68,0.2); }
.dot-yellow { background: var(--yellow); box-shadow: 0 0 0 3px rgba(245,158,11,0.2); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 0.825rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:hover { background: #f1f5f9; box-shadow: var(--shadow); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 2px 8px rgba(99,102,241,0.3); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-success:hover { background: #059669; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--border-light); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.btn-lg { padding: 0.65rem 1.5rem; font-size: 0.9rem; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ─── Forms ─── */
label { display: block; font-weight: 600; margin-bottom: 0.3rem; font-size: 0.8rem; color: var(--text-2); }
label small { font-weight: 400; color: var(--text-3); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  background: #fff;
  transition: border var(--transition), box-shadow var(--transition);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.form-group { margin-bottom: 1rem; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 200px; }
.inline-form { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; flex: 1; min-width: 150px; }
.table-input { padding: 0.3rem 0.5rem; width: 100%; }
.form-hint { font-size: 0.75rem; color: var(--text-3); margin-top: 0.2rem; }
.form-divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ─── Modal / Dialog ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 500;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 560px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease-out;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border: none; background: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text-3);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--border-light); color: var(--text); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ─── Drawer (right panel) ─── */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(2px);
  z-index: 400;
}
.drawer-overlay.open { display: block; }
.drawer {
  position: fixed;
  right: -480px;
  top: 0;
  width: 480px;
  max-width: 95vw;
  height: 100vh;
  background: var(--card);
  box-shadow: -4px 0 25px rgba(0,0,0,0.1);
  z-index: 450;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}
.drawer.open { right: 0; }
.drawer-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 10;
}
.drawer-header h2 { font-size: 1.05rem; font-weight: 700; }
.drawer-body { padding: 1.5rem; }
.drawer-section { margin-bottom: 1.5rem; }
.drawer-section h4 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

/* ─── Progress bar ─── */
.progress-bar {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.progress-green .progress-fill { background: var(--green); }
.progress-yellow .progress-fill { background: var(--yellow); }
.progress-red .progress-fill { background: var(--red); }

/* ─── Checklist ─── */
.checklist { list-style: none; }
.checklist li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-light);
}
.checklist li:last-child { border-bottom: none; }
.check-icon { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; flex-shrink: 0; }
.check-done { background: var(--green-light); color: var(--green); }
.check-pending { background: var(--border-light); color: var(--text-3); border: 1.5px solid var(--border); }

/* ─── Card grid (templates, content) ─── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.card-grid-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
}
.card-grid-item:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }
.card-grid-item h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.4rem; }
.card-grid-item .meta { font-size: 0.75rem; color: var(--text-3); }
.card-grid-item .preview { font-size: 0.8rem; color: var(--text-2); margin-top: 0.5rem; line-height: 1.4; }
.card-grid-item .preview code {
  background: #f1f5f9;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.75rem;
}

/* ─── Content grid (media) ─── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.media-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.media-thumb {
  height: 120px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--text-3);
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-info { padding: 0.6rem 0.75rem; }
.media-info .name { font-size: 0.8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-info .size { font-size: 0.7rem; color: var(--text-3); }

/* ─── Info grid ─── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.4rem 1rem;
}
.info-grid div { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0; }
.info-grid strong { min-width: 110px; color: var(--text-3); font-size: 0.8rem; font-weight: 500; }
.info-grid span { font-size: 0.875rem; }

/* ─── Actions row ─── */
.actions-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ─── Filter bar ─── */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.55rem 0.75rem 0.55rem 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 0.75rem center;
  transition: border var(--transition);
}
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.filter-select {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  background: #fff;
  min-width: 140px;
}

/* ─── Alert/Banner ─── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.alert-warning { background: var(--yellow-light); color: #92400e; border: 1px solid #fde68a; }
.alert-error { background: var(--red-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: var(--green-light); color: #065f46; border: 1px solid #a7f3d0; }
.alert-info { background: var(--primary-light); color: #3730a3; border: 1px solid #c7d2fe; }

/* ─── Mono & misc ─── */
.mono { font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Consolas', monospace; font-size: 0.825rem; }
pre.mono { background: #1a1a2e; color: #e2e8f0; padding: 1rem; border-radius: var(--radius-sm); overflow-x: auto; font-size: 0.8rem; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.35rem; font-weight: 700; }
.empty { color: var(--text-3); font-style: italic; padding: 2rem; text-align: center; }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 0.8rem; }
.mt-1 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.gap-05 { gap: 0.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.hidden { display: none !important; }

/* ─── Empty state ─── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-3);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-state h3 { font-size: 1rem; color: var(--text-2); margin-bottom: 0.4rem; }
.empty-state p { font-size: 0.85rem; margin-bottom: 1rem; }

/* ─── Login page ─── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #1a1a2e;
}
.login-box {
  background: var(--card);
  padding: 2.5rem;
  border-radius: 16px;
  width: 380px;
  max-width: 92vw;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 0.75rem; }
.login-logo img { max-height: 48px; }
.login-brand { text-align: center; color: var(--text); font-size: 1.5rem; font-weight: 700; }
.login-sub { text-align: center; color: var(--text-3); margin-bottom: 2rem; font-size: 0.875rem; }
.login-box label { margin-top: 0.75rem; }
.login-box input { margin-bottom: 0.5rem; }
.login-box button { margin-top: 1.25rem; }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar-brand span,
  .nav-item span,
  .nav-section,
  .sidebar-footer .user-email { display: none; }
  .nav-item { justify-content: center; padding: 0.75rem; }
  .main { margin-left: var(--sidebar-collapsed); }
  .container { padding: 1rem; }
  .drawer { width: 100vw; }
}
@media (max-width: 600px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .filter-bar { flex-direction: column; }
  .form-row { flex-direction: column; }
}
