/* ============================================================
   KHUMO — Marshall App CSS
   Design principle: Tap-and-Go for 50+ year old users
   Large fonts · High contrast · Minimal steps
   ============================================================ */

/* ── CSS additions for Marshall ─────────────────────────────── */
:root {
  --m-black:   #0D0D0D;
  --m-dark:    #1A1A1A;
  --m-dark2:   #242424;
  --m-dark3:   #2E2E2E;
  --m-yellow:  #F5C518;
  --m-white:   #FFFFFF;
  --m-gray:    #9A9A9A;
  --m-success: #27AE60;
  --m-danger:  #E74C3C;
  --m-warning: #F39C12;
  --m-info:    #2980B9;
  --m-orange:  #E67E22;
}

/* ── Body & Shell ───────────────────────────────────────────── */
body.marshall-body {
  background: var(--m-black);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  font-family: 'Poppins', sans-serif;
  color: var(--m-white);
  -webkit-font-smoothing: antialiased;
}

.marshall-shell {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: var(--m-black);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── Ndebele accent strip ───────────────────────────────────── */
.ndebele-strip {
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    #F5C518 0px, #F5C518 20px,
    #C0392B 20px, #C0392B 40px,
    #1B7F8A 40px, #1B7F8A 60px,
    #0D0D0D 60px, #0D0D0D 80px
  );
  flex-shrink: 0;
}

/* ── Header ─────────────────────────────────────────────────── */
.m-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  background: var(--m-dark);
  border-bottom: 2px solid var(--m-yellow);
}

.m-header-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--m-white);
  letter-spacing: -0.3px;
}

.m-header-rank {
  font-size: 0.9rem;
  color: var(--m-yellow);
  font-weight: 600;
  margin-top: 2px;
}

.m-logout-btn {
  width: 52px;
  height: 52px;
  background: rgba(231,76,60,0.15);
  border: 2px solid rgba(231,76,60,0.4);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.3rem;
  color: var(--m-danger);
  transition: all 0.2s ease;
}
.m-logout-btn:hover,
.m-logout-btn:active {
  background: var(--m-danger);
  color: var(--m-white);
  border-color: var(--m-danger);
}

/* ── Tab Bar ────────────────────────────────────────────────── */
.m-tab-bar {
  display: flex;
  background: var(--m-dark);
  border-bottom: 1px solid var(--m-dark3);
}

.m-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--m-gray);
  font-family: 'Poppins', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.m-tab i { font-size: 1.3rem; }

.m-tab:hover  { color: var(--m-white); }
.m-tab.active {
  color: var(--m-yellow);
  border-bottom-color: var(--m-yellow);
  background: rgba(245,197,24,0.06);
}

/* ── Tab Content ────────────────────────────────────────────── */
.m-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 32px;
  -webkit-overflow-scrolling: touch;
}

.m-tab-content.hidden { display: none; }

/* ── Section Title ──────────────────────────────────────────── */
.m-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--m-white);
}

/* ── Card ───────────────────────────────────────────────────── */
.m-card {
  background: var(--m-dark);
  border: 1px solid var(--m-dark3);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 16px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.m-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 18px 20px;
  border-radius: 16px;
  border: none;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 12px;
  letter-spacing: 0.2px;
}

/* Extra-large tap target for older users */
.m-btn-xl {
  padding: 22px 20px;
  font-size: 1.1rem;
  border-radius: 18px;
  min-height: 70px;
}

.m-btn-primary {
  background: var(--m-yellow);
  color: var(--m-black);
}
.m-btn-primary:hover,
.m-btn-primary:active { background: #D4A800; }

.m-btn-outline {
  background: transparent;
  color: var(--m-yellow);
  border: 2px solid var(--m-yellow);
}
.m-btn-outline:hover,
.m-btn-outline:active {
  background: rgba(245,197,24,0.12);
}

.m-btn-danger {
  background: var(--m-danger);
  color: var(--m-white);
}
.m-btn-danger:hover,
.m-btn-danger:active { background: #C0392B; }

.m-btn-warning {
  background: var(--m-warning);
  color: var(--m-black);
  font-weight: 800;
}
.m-btn-warning:hover,
.m-btn-warning:active { background: var(--m-orange); color: var(--m-white); }

.m-btn-dark {
  background: var(--m-dark2);
  color: var(--m-white);
  border: 1px solid var(--m-dark3);
}

.m-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Spinner ─────────────────────────────────────────────────── */
.m-spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: var(--m-white);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── QR Scanner ─────────────────────────────────────────────── */
.m-scanner-wrap {
  background: #111;
  border-radius: 20px;
  overflow: hidden;
  min-height: 260px;
  position: relative;
  margin-bottom: 16px;
  border: 2px solid var(--m-dark3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.m-scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--m-gray);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  padding: 20px;
  pointer-events: none;
}

/* ── Scan Result ────────────────────────────────────────────── */
.m-scan-result {
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  margin: 16px 0;
  animation: popIn 0.3s ease;
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.m-scan-result.success {
  background: rgba(39,174,96,0.15);
  border: 2px solid var(--m-success);
}
.m-scan-result.danger {
  background: rgba(231,76,60,0.15);
  border: 2px solid var(--m-danger);
}

.m-scan-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  line-height: 1;
}

.m-scan-message {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.m-scan-result.success .m-scan-message { color: var(--m-success); }
.m-scan-result.danger  .m-scan-message { color: var(--m-danger); }

.m-scan-detail {
  font-size: 0.85rem;
  color: var(--m-gray);
  line-height: 1.5;
}

/* ── Recent scans list ──────────────────────────────────────── */
.m-scan-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--m-dark);
  border: 1px solid var(--m-dark3);
  border-radius: 14px;
  margin-bottom: 10px;
}

.m-scan-item-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.m-scan-item-icon.ok  { background: rgba(39,174,96,0.2);  color: var(--m-success); }
.m-scan-item-icon.err { background: rgba(231,76,60,0.2);  color: var(--m-danger);  }

.m-scan-item-text { flex: 1; }
.m-scan-item-id   { font-size: 0.9rem; font-weight: 700; }
.m-scan-item-time { font-size: 0.78rem; color: var(--m-gray); }

/* ── Vehicle type selector ──────────────────────────────────── */
.m-vehicle-selector {
  display: flex;
  gap: 12px;
}

.m-vehicle-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--m-dark2);
  border: 2px solid var(--m-dark3);
  border-radius: 16px;
  color: var(--m-gray);
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.m-vehicle-btn i { font-size: 1.8rem; }
.m-vehicle-btn:hover { border-color: var(--m-yellow); color: var(--m-white); }
.m-vehicle-btn.active {
  border-color: var(--m-yellow);
  background: rgba(245,197,24,0.1);
  color: var(--m-yellow);
}

/* ── Capacity display ───────────────────────────────────────── */
.m-capacity-card {
  text-align: center;
}

.m-capacity-numbers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.m-count-block { text-align: center; }

.m-count-val {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--m-yellow);
  line-height: 1;
}

.m-count-lbl {
  font-size: 0.8rem;
  color: var(--m-gray);
  font-weight: 500;
  margin-top: 4px;
}

.m-count-divider {
  font-size: 2.5rem;
  color: var(--m-dark3);
  font-weight: 300;
}

/* Progress bar */
.m-progress-wrap {
  height: 24px;
  background: var(--m-dark2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--m-dark3);
}

.m-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--m-success);
  transition: width 0.5s ease, background-color 0.4s ease;
}

.m-capacity-status {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.m-capacity-remaining {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--m-gray);
}
.m-capacity-remaining span {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--m-white);
}

.m-manual-note {
  font-size: 0.85rem;
  color: var(--m-gray);
  text-align: center;
  padding: 8px 0;
}

/* ── Summary Card ───────────────────────────────────────────── */
.m-summary-card {
  padding: 24px;
}

.m-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--m-dark3);
}
.m-summary-row:last-of-type { border-bottom: none; }

.m-summary-label {
  font-size: 1rem;
  color: var(--m-gray);
  font-weight: 500;
}

.m-summary-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--m-white);
}

.m-summary-value.m-highlight {
  font-size: 1.4rem;
  color: var(--m-yellow);
}

.m-summary-total .m-summary-label { color: var(--m-white); font-weight: 700; }
.m-summary-total .m-summary-value { font-size: 1.6rem; color: var(--m-yellow); }

.m-vehicle-status-badge {
  margin-top: 16px;
  padding: 14px;
  border-radius: 14px;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
}

.m-vehicle-status-badge.status-ok       { background: rgba(39,174,96,0.2); color: var(--m-success); }
.m-vehicle-status-badge.status-almost   { background: rgba(243,156,18,0.2); color: var(--m-warning); }
.m-vehicle-status-badge.status-full     { background: rgba(231,76,60,0.2);  color: var(--m-danger);  }
.m-vehicle-status-badge.status-over     { background: rgba(231,76,60,0.35); color: #FF3B3B;          }

/* ── Trip history items ─────────────────────────────────────── */
.m-trip-record {
  background: var(--m-dark);
  border: 1px solid var(--m-dark3);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 12px;
}

.m-trip-record-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.m-trip-record-route {
  font-size: 1rem;
  font-weight: 700;
}

.m-trip-record-time {
  font-size: 0.8rem;
  color: var(--m-gray);
}

.m-trip-stat {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--m-gray);
  padding: 4px 0;
}

.m-trip-stat span:last-child { color: var(--m-white); font-weight: 600; }

/* ── Empty note ─────────────────────────────────────────────── */
.m-empty-note {
  text-align: center;
  padding: 32px 20px;
  color: var(--m-gray);
  font-size: 0.95rem;
}

/* ── Modal ──────────────────────────────────────────────────── */
.m-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 500;
  padding: 0;
}

.m-modal-overlay.hidden { display: none; }

.m-modal {
  background: var(--m-dark);
  border: 1px solid var(--m-dark3);
  border-radius: 28px 28px 0 0;
  padding: 28px 24px 40px;
  width: 100%;
  max-width: 480px;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(60px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.m-modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.m-modal-body {
  font-size: 0.95rem;
  color: var(--m-gray);
  line-height: 1.7;
}

/* ── Login page specific ────────────────────────────────────── */
.marshall-login-hero {
  padding: 36px 24px 24px;
  text-align: center;
  background: var(--m-dark);
  border-bottom: 1px solid var(--m-dark3);
}

.marshall-logo {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 20px;
  margin: 0 auto 16px;
  border: 2px solid var(--m-yellow);
}

.marshall-hero-title {
  font-size: 1.8rem;
  font-weight: 800;
}

.marshall-hero-sub {
  font-size: 0.9rem;
  color: var(--m-yellow);
  font-weight: 600;
  margin-top: 4px;
}

/* Auth tabs (login page) */
.m-auth-tabs {
  display: flex;
  background: var(--m-dark2);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 24px;
}

.m-auth-tab {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: var(--m-gray);
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.m-auth-tab.active {
  background: var(--m-yellow);
  color: var(--m-black);
}

.m-auth-panel { display: none; }
.m-auth-panel.active { display: block; }

/* Form fields */
.m-form-group { margin-bottom: 18px; }

.m-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--m-white);
  margin-bottom: 8px;
}

.m-label i { margin-right: 6px; color: var(--m-yellow); }

.m-input {
  width: 100%;
  background: var(--m-dark2);
  border: 2px solid var(--m-dark3);
  border-radius: 14px;
  padding: 16px 18px;
  color: var(--m-white);
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  transition: border-color 0.2s ease;
  outline: none;
}

.m-input:focus {
  border-color: var(--m-yellow);
  box-shadow: 0 0 0 3px rgba(245,197,24,0.15);
}

.m-input::placeholder { color: #555; }

.m-field-note {
  font-size: 0.78rem;
  color: var(--m-gray);
  margin-top: 6px;
}

/* Rank suggestion dropdown */
.m-rank-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--m-dark2);
  border: 2px solid var(--m-yellow);
  border-radius: 14px;
  z-index: 300;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.m-rank-suggestions.hidden { display: none; }

.m-suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  font-size: 0.95rem;
  cursor: pointer;
  border-bottom: 1px solid var(--m-dark3);
  transition: background 0.15s ease;
}

.m-suggestion-item:last-child { border-bottom: none; }
.m-suggestion-item:hover,
.m-suggestion-item:active { background: rgba(245,197,24,0.12); }

/* Error box */
.m-error-box {
  display: none;
  background: rgba(231,76,60,0.12);
  border: 1.5px solid rgba(231,76,60,0.4);
  color: #FF6B6B;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.9rem;
  margin-bottom: 18px;
  font-weight: 500;
}

/* Divider */
.m-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--m-gray);
  font-size: 0.82rem;
  margin: 20px 0;
}

.m-divider::before,
.m-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--m-dark3);
}

/* html5-qrcode overrides to fit our dark theme */
#qr-reader {
  border: none !important;
  background: transparent !important;
}
#qr-reader__dashboard { background: var(--m-dark) !important; }
#qr-reader__dashboard_section_swaplink { color: var(--m-yellow) !important; }
#qr-reader video { border-radius: 12px; }
#qr-reader__scan_region { background: transparent !important; border: none !important; }
#qr-reader__scan_region img { display: none; }
