/* ============================================
   FuelSense — Smart Fuel Monitoring & Control
   Core stylesheet
   ============================================ */

:root {
  --bg-black: #05060a;
  --bg-panel: #0d1120;
  --bg-panel-2: #131829;
  --border-subtle: rgba(255, 255, 255, 0.08);

  --blue: #2fa5ff;
  --blue-bright: #4fc3ff;
  --purple: #9b3dff;
  --purple-bright: #c14dff;

  --gradient-brand: linear-gradient(90deg, var(--blue) 0%, var(--purple) 100%);
  --gradient-brand-soft: linear-gradient(135deg, rgba(47,165,255,0.15), rgba(155,61,255,0.15));

  --text-primary: #f4f6fb;
  --text-secondary: #9aa3b8;
  --text-muted: #6b7280;

  --success: #2ecc71;
  --warning: #ffb84d;
  --danger: #ff5c5c;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow-glow: 0 0 40px rgba(155, 61, 255, 0.15);
}

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

html, body {
  height: 100%;
  background: var(--bg-black);
  color: var(--text-primary);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(47,165,255,0.12), transparent 60%),
    radial-gradient(ellipse 900px 600px at 90% 10%, rgba(155,61,255,0.12), transparent 60%),
    var(--bg-black);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

.gradient-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.chrome-text {
  background: linear-gradient(180deg, #ffffff 0%, #b9c2d0 45%, #8891a0 55%, #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Layout shells ---------- */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Hero page ---------- */
.hero-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-brand img { width: 44px; height: 44px; object-fit: contain; }

.hero-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.hero-brand-text .name { font-size: 20px; font-weight: 800; letter-spacing: 0.5px; }
.hero-brand-text .tagline { font-size: 9px; letter-spacing: 1.5px; color: var(--text-secondary); font-weight: 600; }

.hero-main {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 60px 24px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.hero-headline {
  font-size: 46px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.5px;
  margin-bottom: 18px;
}

.hero-headline .line2 { display: block; margin-top: 4px; }

.hero-sub {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 480px;
  margin-bottom: 32px;
}

.hero-sub b { color: var(--text-primary); font-weight: 600; }

.feature-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 36px;
  max-width: 480px;
}

.feature-item { display: flex; flex-direction: column; gap: 6px; }
.feature-item .icon { font-size: 20px; }
.feature-item .label { font-size: 12px; font-weight: 700; color: var(--blue-bright); letter-spacing: 0.3px; }
.feature-item .desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }

.hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 28px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  letter-spacing: 0.3px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 6px 24px rgba(155, 61, 255, 0.35);
}

.btn-primary:hover { box-shadow: 0 8px 30px rgba(155, 61, 255, 0.5); }

.btn-secondary {
  background: var(--bg-panel);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover { border-color: var(--blue); }

.btn-block { width: 100%; }

.btn-lg { padding: 18px 28px; font-size: 15px; }

/* ---------- Phone / dashboard mockup panel ---------- */
.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
}

.hero-visual img {
  border-radius: 20px;
  box-shadow: var(--shadow-glow);
}

/* ---------- Stat strip ---------- */
.stat-strip {
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  padding: 22px 24px;
}

.stat-strip-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-item { text-align: center; }
.stat-item .num { font-size: 20px; font-weight: 800; }
.stat-item .lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.hero-footer {
  text-align: center;
  padding: 22px;
  color: var(--text-muted);
  font-size: 12px;
}

.hero-footer b { color: var(--text-secondary); }

/* ---------- Login / entry screens ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 36px 30px;
  box-shadow: var(--shadow-glow);
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.auth-logo img { width: 64px; height: 64px; object-fit: contain; }
.auth-logo .name { font-size: 22px; font-weight: 800; }
.auth-logo .tagline { font-size: 10px; letter-spacing: 1.2px; color: var(--text-secondary); font-weight: 600; }

.role-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 22px;
  background: var(--bg-panel-2);
  border-radius: 10px;
  padding: 4px;
}

.role-tab {
  padding: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  color: var(--text-secondary);
  border: none;
  background: transparent;
}

.role-tab.active {
  background: var(--gradient-brand);
  color: #fff;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 13px 14px;
  background: var(--bg-panel-2);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 15px;
  letter-spacing: 1px;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--blue);
}

.field-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 6px;
  display: none;
}

.field-error.show { display: block; }

.auth-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 20px;
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-headline { font-size: 34px; }
  .hero-visual { order: -1; }
  .stat-strip-inner { grid-template-columns: repeat(2, 1fr); }
  .feature-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .hero-main { padding: 36px 18px; }
  .hero-headline { font-size: 28px; }
  .auth-card { padding: 28px 22px; }
}

/* ============================================
   Dashboard shell (controller + driver)
   ============================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

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

.sidebar-brand img { width: 32px; height: 32px; }
.sidebar-brand .name { font-size: 15px; font-weight: 800; }

.sidebar-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item .icon { font-size: 16px; width: 18px; text-align: center; }
.nav-item.active { background: var(--gradient-brand-soft); color: var(--text-primary); }
.nav-item:hover { color: var(--text-primary); }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-footer .user-name { color: var(--text-primary); font-weight: 700; font-size: 13px; }
.sidebar-footer .logout-link { color: var(--danger); font-weight: 700; margin-top: 6px; display: inline-block; }

.main-content { flex: 1; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: rgba(5, 6, 10, 0.85);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.topbar h1 { font-size: 19px; font-weight: 800; }
.topbar .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.page-body { padding: 24px 28px 60px; }

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 20px;
}

.card + .card { margin-top: 16px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h2 { font-size: 15px; font-weight: 800; }

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }

.stat-card {
  background: var(--bg-panel-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.stat-card .num { font-size: 22px; font-weight: 800; }
.stat-card .lbl { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
}
td { padding: 12px; border-bottom: 1px solid var(--border-subtle); }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-available { background: rgba(46, 204, 113, 0.15); color: var(--success); }
.badge-onload { background: rgba(47, 165, 255, 0.15); color: var(--blue-bright); }
.badge-maintenance { background: rgba(255, 184, 77, 0.15); color: var(--warning); }
.badge-pending { background: rgba(255, 184, 77, 0.15); color: var(--warning); }
.badge-transit { background: rgba(47, 165, 255, 0.15); color: var(--blue-bright); }
.badge-completed { background: rgba(46, 204, 113, 0.15); color: var(--success); }
.badge-uploaded { background: rgba(155, 61, 255, 0.15); color: var(--purple-bright); }

.icon-btn {
  background: var(--bg-panel-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
}
.icon-btn:hover { color: var(--text-primary); border-color: var(--blue); }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h2 { font-size: 17px; font-weight: 800; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 20px; }

#loadMap, #stopMap {
  width: 100%;
  height: 260px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin-bottom: 10px;
}

.stop-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }

.stop-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel-2);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}

.stop-chip .remove-stop { color: var(--danger); font-weight: 700; font-size: 12px; border: none; background: none; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.load-code-display {
  background: var(--bg-panel-2);
  border: 1px dashed var(--blue);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  margin-top: 10px;
}
.load-code-display .code { font-size: 22px; font-weight: 800; letter-spacing: 2px; }
.load-code-display .lbl { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .page-body { padding: 18px; }
  .topbar { padding: 14px 18px; }
}
