/*
 * EroLux Mobility Hub — Design System
 * Bootstrap 5 (CDN) provides grid/utilities/components; this file layers
 * the brand look on top via CSS custom properties. No build step —
 * plain CSS, safe to serve as a static asset on cPanel/Apache.
 *
 * Two token scopes:
 *   :root                    — light "cream" scope, used for main content areas
 *   [data-erl-theme="dark"]  — dark "ink" scope, used for the sidebar and the
 *                              auth screens' brand panel (scope a wrapper div,
 *                              not the whole page)
 */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --erl-bg: #F7F3EC;
  --erl-surface: #FFFFFF;
  --erl-surface-2: #FBF8F2;
  --erl-border: #E4DCC9;
  --erl-text: #1C1A17;
  --erl-muted: #7A7266;
  --erl-gold: #B08D57;
  --erl-gold-dark: #8C6D3F;
  --erl-gold-tint: rgba(176, 141, 87, 0.12);
  --erl-success: #2F7D5B;
  --erl-warning: #B8862E;
  --erl-danger: #B23A34;
  --erl-info: #2F6F8F;

  /* One font system-wide, matching the sidebar nav -- headings/KPI
     values used to run on a separate serif (Bodoni Moda) that looked
     inconsistent against everything else, so --erl-font-display is now
     just an alias for the body font rather than a second family. */
  --erl-font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --erl-font-display: var(--erl-font-body);

  --erl-radius-sm: 6px;
  --erl-radius: 10px;
  --erl-radius-lg: 16px;
  --erl-shadow: 0 2px 10px rgba(28, 26, 23, 0.06);
  --erl-shadow-lg: 0 16px 48px rgba(28, 26, 23, 0.16);
}

[data-erl-theme="dark"] {
  --erl-bg: #14120F;
  --erl-surface: #1E1B16;
  --erl-surface-2: #26221B;
  --erl-border: #3A342A;
  --erl-text: #F2EDE3;
  --erl-muted: #A99C86;
  --erl-gold: #C9A24B;
  --erl-gold-dark: #B08D57;
  --erl-gold-tint: rgba(201, 162, 75, 0.14);
  --erl-success: #4CAF82;
  --erl-warning: #E0A93E;
  --erl-danger: #E7796E;
  --erl-info: #5BA8CC;
  --erl-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  --erl-shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.5);
}

/* ---------- base ---------- */

body {
  background: var(--erl-bg);
  color: var(--erl-text);
  font-family: var(--erl-font-body);
  /* 0.8125rem is already the most-used content size across every
     component (cards, tables, sidebar) -- this used to be 0.9375rem,
     which made plain table/paragraph text (nothing else overrides it)
     visibly larger than everything styled deliberately, like the
     Unpaid Bookings panel next to the Payments ledger table. */
  font-size: 0.8125rem;
}

h1, h2, h3, h4, .erl-display {
  font-family: var(--erl-font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* :not(.btn) so a link styled as a button (.btn-erl-*) keeps its own
   button text color instead of losing to this rule on specificity. */
a:not(.btn) {
  color: var(--erl-gold-dark);
}
[data-erl-theme="dark"] a:not(.btn) {
  color: var(--erl-gold);
}

.erl-eyebrow {
  font-family: var(--erl-font-body);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--erl-gold-dark);
}
[data-erl-theme="dark"] .erl-eyebrow { color: var(--erl-gold); }

.erl-muted { color: var(--erl-muted) !important; }

/* ---------- buttons ---------- */

.btn-erl-primary {
  background: var(--erl-gold);
  border: 1px solid var(--erl-gold);
  color: #1C1A17;
  font-weight: 700;
  border-radius: var(--erl-radius-sm);
  padding: 0.65rem 1.25rem;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.btn-erl-primary:hover, .btn-erl-primary:focus {
  background: var(--erl-gold-dark);
  border-color: var(--erl-gold-dark);
  color: #fff;
}
.btn-erl-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-erl-outline {
  background: transparent;
  border: 1px solid var(--erl-border);
  color: var(--erl-text);
  font-weight: 600;
  border-radius: var(--erl-radius-sm);
  padding: 0.65rem 1.25rem;
}
.btn-erl-outline:hover {
  border-color: var(--erl-gold);
  color: var(--erl-gold-dark);
}

.btn-erl-ghost {
  background: transparent;
  border: none;
  color: var(--erl-muted);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
}
.btn-erl-ghost:hover { color: var(--erl-text); }

/* ---------- forms ---------- */

.erl-field label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--erl-muted);
  margin-bottom: 0.35rem;
  display: block;
}

.erl-field .form-control,
.erl-field .form-select {
  background: var(--erl-surface);
  border: 1px solid var(--erl-border);
  color: var(--erl-text);
  border-radius: var(--erl-radius-sm);
  padding: 0.7rem 0.9rem;
  font-size: 0.9375rem;
}
.erl-field .form-control::placeholder { color: var(--erl-muted); opacity: 0.7; }
.erl-field .form-control:focus,
.erl-field .form-select:focus {
  background: var(--erl-surface);
  border-color: var(--erl-gold);
  box-shadow: 0 0 0 3px var(--erl-gold-tint);
  color: var(--erl-text);
}

.erl-field .invalid-feedback { font-size: 0.8125rem; }
.erl-field .form-control.is-invalid { border-color: var(--erl-danger); }

.erl-input-group {
  position: relative;
}
.erl-input-group .erl-input-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--erl-muted);
  pointer-events: none;
}
.erl-input-group .form-control { padding-left: 2.5rem; }
.erl-input-group .erl-input-toggle {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--erl-muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

/* OTP code entry: separated digit boxes */
.erl-otp-group { display: flex; gap: 0.6rem; }
.erl-otp-group input {
  width: 3rem;
  height: 3.4rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--erl-font-body);
}

/* ---------- cards ---------- */

.erl-card {
  background: var(--erl-surface);
  border: 1px solid var(--erl-border);
  border-radius: var(--erl-radius);
  box-shadow: var(--erl-shadow);
}
.erl-card-body { padding: 1.5rem; }

/* ---------- tables ---------- */

.erl-table {
  --bs-table-bg: var(--erl-surface);
  color: var(--erl-text);
  border-color: var(--erl-border);
}
.erl-table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--erl-muted);
  border-bottom-width: 1px;
  font-weight: 700;
}
.erl-table td, .erl-table th { border-color: var(--erl-border); vertical-align: middle; }

/* ---------- badges ---------- */

.erl-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.erl-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.erl-badge-success { background: rgba(47, 125, 91, 0.12); color: var(--erl-success); }
.erl-badge-warning { background: rgba(184, 134, 46, 0.12); color: var(--erl-warning); }
.erl-badge-danger  { background: rgba(178, 58, 52, 0.12); color: var(--erl-danger); }
.erl-badge-info    { background: rgba(47, 111, 143, 0.12); color: var(--erl-info); }
.erl-badge-neutral { background: var(--erl-gold-tint); color: var(--erl-gold-dark); }

/* ---------- navigation ---------- */

.erl-sidebar {
  background: var(--erl-surface);
  border-right: 1px solid var(--erl-border);
  min-height: 100vh;
}
.erl-sidebar .nav-link {
  color: var(--erl-muted);
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: var(--erl-radius-sm);
  padding: 0.6rem 0.85rem;
}
.erl-sidebar .nav-link.active {
  background: var(--erl-gold-tint);
  color: var(--erl-gold);
}
.erl-sidebar .nav-link:hover { color: var(--erl-text); }

.erl-topbar {
  background: var(--erl-surface);
  border-bottom: 1px solid var(--erl-border);
}

/* ---------- alerts ---------- */

.erl-alert {
  border: 1px solid var(--erl-border);
  border-left-width: 4px;
  border-radius: var(--erl-radius-sm);
  padding: 0.85rem 1.1rem;
  font-size: 0.875rem;
  background: var(--erl-surface-2);
}
.erl-alert-success { border-left-color: var(--erl-success); }
.erl-alert-warning  { border-left-color: var(--erl-warning); }
.erl-alert-danger   { border-left-color: var(--erl-danger); }
.erl-alert-info     { border-left-color: var(--erl-info); }

/* ---------- modal / drawer ---------- */

.erl-drawer .modal-content {
  background: var(--erl-surface);
  color: var(--erl-text);
  border: 1px solid var(--erl-border);
  border-radius: var(--erl-radius-lg);
}
.erl-drawer .modal-header,
.erl-drawer .modal-footer { border-color: var(--erl-border); }

/* ---------- loading / skeleton / empty states ---------- */

.erl-skeleton {
  background: linear-gradient(90deg, var(--erl-surface-2) 25%, var(--erl-border) 37%, var(--erl-surface-2) 63%);
  background-size: 400% 100%;
  animation: erl-skeleton-pulse 1.4s ease infinite;
  border-radius: var(--erl-radius-sm);
}
@keyframes erl-skeleton-pulse {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.erl-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--erl-muted);
}
.erl-empty .erl-empty-icon { font-size: 2.25rem; color: var(--erl-border); margin-bottom: 0.75rem; }

/* ---------- theme toggle (floating) ---------- */

.erl-theme-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1050;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--erl-surface);
  border: 1px solid var(--erl-border);
  box-shadow: var(--erl-shadow-lg);
  color: var(--erl-gold);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.erl-theme-toggle:hover { transform: scale(1.07); border-color: var(--erl-gold); }
.erl-theme-toggle svg { width: 1.3rem; height: 1.3rem; }
.erl-theme-toggle .erl-icon-sun { display: none; }
.erl-theme-toggle .erl-icon-moon { display: block; }
[data-erl-theme="dark"] .erl-theme-toggle .erl-icon-sun { display: block; }
[data-erl-theme="dark"] .erl-theme-toggle .erl-icon-moon { display: none; }

/* ---------- auth screens ---------- */

.erl-auth-shell {
  min-height: 100vh;
  display: flex;
  background: var(--erl-bg);
  /* Auth screens always render in the light "cream" palette, regardless
     of the visitor's site-wide dark/light preference (the toggle still
     works -- it just has no visible effect here). Re-declaring the full
     light token set here overrides whatever [data-erl-theme="dark"] set
     on <html>; .erl-auth-brand further overrides its own subtree below
     for the photo panel's fixed light-on-dark text.
     `color` also needs restating explicitly, not just the --erl-text
     custom property: body{color:var(--erl-text)} already resolved to
     the dark theme's cream value up at <body>, and plain inherited
     `color` carries that computed value down regardless of a
     redeclared variable further down the tree -- only elements that
     themselves write color:var(--erl-text) would've picked up the
     override. This re-establishes the inheritance chain from here. */
  color: var(--erl-text);
  --erl-bg: #F7F3EC;
  --erl-surface: #FFFFFF;
  --erl-surface-2: #FBF8F2;
  --erl-border: #E4DCC9;
  --erl-text: #1C1A17;
  --erl-muted: #7A7266;
  --erl-gold: #B08D57;
  --erl-gold-dark: #8C6D3F;
  --erl-gold-tint: rgba(176, 141, 87, 0.12);
  --erl-shadow: 0 2px 10px rgba(28, 26, 23, 0.06);
  --erl-shadow-lg: 0 16px 48px rgba(28, 26, 23, 0.16);
}
.erl-auth-brand {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 42%;
  padding: 3rem;
  background:
    linear-gradient(180deg, rgba(10, 9, 8, 0.88) 0%, rgba(10, 9, 8, 0.72) 45%, rgba(10, 9, 8, 0.94) 100%),
    radial-gradient(circle at 20% 20%, rgba(201, 162, 75, 0.16), transparent 45%),
    url('../images/default-pic.jpg') center / cover no-repeat,
    var(--erl-bg);
  border-right: 1px solid var(--erl-border);
  /* This panel sits on a dark photo, so its text always uses the dark
     theme's light-on-dark tokens -- independent of the visitor's own
     light/dark preference (_theme_init.php), which only ever governs
     the form panel beside it. Without this, choosing the light theme
     turns .erl-brand-tagline's color near-black, unreadable over the
     same dark overlay. Also restates `color` itself, not just the
     variable -- see the longer note on .erl-auth-shell above. */
  color: #F2EDE3;
  --erl-text: #F2EDE3;
  --erl-muted: #A99C86;
  --erl-gold: #C9A24B;
  --erl-gold-dark: #C9A24B;
}
@media (min-width: 992px) {
  .erl-auth-brand { display: flex; }
}
.erl-brand-logo { width: 180px; height: auto; }
.erl-auth-brand .erl-brand-tagline {
  font-family: var(--erl-font-display);
  font-size: 2.25rem;
  line-height: 1.25;
  color: var(--erl-text);
}
.erl-auth-headline {
  font-family: var(--erl-font-display);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--erl-text);
}
.erl-auth-form-col {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
}
.erl-auth-form-wrap { width: 100%; max-width: 26rem; }
.erl-auth-form-wrap .erl-card-body { padding: 2rem; }

.erl-countdown {
  font-family: var(--erl-font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--erl-gold);
  letter-spacing: 0.05em;
}

.erl-role-card {
  display: block;
  cursor: pointer;
  background: var(--erl-surface);
  border: 1px solid var(--erl-border);
  border-radius: var(--erl-radius);
  padding: 1rem 1.1rem;
}
.erl-role-card input { position: absolute; opacity: 0; pointer-events: none; }
.erl-role-card:has(input:checked) {
  border-color: var(--erl-gold);
  box-shadow: 0 0 0 3px var(--erl-gold-tint);
  background: var(--erl-gold-tint);
}
.erl-role-card .erl-role-title { font-weight: 700; }
.erl-role-card .erl-role-desc { font-size: 0.8125rem; color: var(--erl-muted); }
