/* ============================================================
   SISTEMA HI — Estilos principales
   ============================================================ */

:root {
  --hi-primary:    #1a1a2e;
  --hi-accent:     #e94560;
  --hi-accent-hover:#c73652;
  --hi-sidebar-w:  240px;
  --hi-topbar-h:   60px;
  --hi-radius:     .75rem;
  --hi-shadow:     0 2px 20px rgba(0,0,0,.07);
  --hi-transition: .2s ease;
}

/* ─── Reset / Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; font-size: .9375rem; }
.min-w-0 { min-width: 0; }

/* ─── Brand colors (override Bootstrap) ───────────────────── */
.btn-primary,
.bg-primary { background-color: var(--hi-accent) !important; border-color: var(--hi-accent) !important; }
.btn-primary:hover { background-color: var(--hi-accent-hover) !important; border-color: var(--hi-accent-hover) !important; }
.text-primary { color: var(--hi-accent) !important; }
.border-primary { border-color: var(--hi-accent) !important; }
.btn-outline-primary { color: var(--hi-accent); border-color: var(--hi-accent); }
.btn-outline-primary:hover { background-color: var(--hi-accent); border-color: var(--hi-accent); color: #fff; }
a { color: var(--hi-accent); }

/* ─── Topbar ───────────────────────────────────────────────── */
.hi-topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--hi-topbar-h);
  background: var(--bs-body-bg);
  border-bottom: 1px solid var(--bs-border-color);
  z-index: 1030;
  display: flex;
  align-items: center;
}

.hi-brand {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--hi-primary);
  letter-spacing: -.5px;
}
[data-bs-theme="dark"] .hi-brand { color: #fff; }

.sidebar-toggle { color: var(--bs-body-color); text-decoration: none; }

/* ─── Layout ───────────────────────────────────────────────── */
.hi-layout {
  display: flex;
  padding-top: var(--hi-topbar-h);
  min-height: 100vh;
}

.hi-sidebar {
  width: var(--hi-sidebar-w);
  min-height: calc(100vh - var(--hi-topbar-h));
  position: fixed;
  top: var(--hi-topbar-h);
  left: 0;
  background: var(--hi-primary);
  color: #fff;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--hi-transition);
  z-index: 1020;
  display: flex;
  flex-direction: column;
}

.hi-sidebar.collapsed { transform: translateX(-100%); }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 1rem .75rem;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem .85rem;
  color: rgba(255,255,255,.65);
  border-radius: .5rem;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--hi-transition);
  margin-bottom: .125rem;
}
.sidebar-link i { font-size: 1.05rem; flex-shrink: 0; }
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,.1); }
.sidebar-link.active { color: #fff; background: var(--hi-accent); }
.sidebar-link.text-danger { color: rgba(255,100,100,.75) !important; }
.sidebar-link.text-danger:hover { background: rgba(233,69,96,.2); color: #ff6464 !important; }

.hi-main {
  flex: 1;
  margin-left: var(--hi-sidebar-w);
  transition: margin var(--hi-transition);
  min-width: 0;
}
.hi-main.sidebar-collapsed { margin-left: 0; }

/* ─── Cards ────────────────────────────────────────────────── */
.card {
  border: none;
  border-radius: var(--hi-radius);
  box-shadow: var(--hi-shadow);
}
.card-header { padding: .875rem 1.25rem; }

/* ─── Stat cards ───────────────────────────────────────────── */
.hi-stat-card {
  transition: transform var(--hi-transition), box-shadow var(--hi-transition);
}
.hi-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
}

.hi-stat-icon {
  width: 42px; height: 42px;
  border-radius: .6rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  background: currentColor;
  position: relative;
}
.hi-stat-icon i { position: relative; z-index: 1; mix-blend-mode: normal; }
.hi-stat-icon.text-primary { background: rgba(233,69,96,.12); }
.hi-stat-icon.text-success { background: rgba(25,135,84,.12); }
.hi-stat-icon.text-warning { background: rgba(255,193,7,.12); }
.hi-stat-icon.text-info    { background: rgba(13,202,240,.12); }
.hi-stat-icon.text-danger  { background: rgba(220,53,69,.12); }

/* ─── Avatars ──────────────────────────────────────────────── */
.hi-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--hi-accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
  flex-shrink: 0;
}
.hi-avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--hi-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: .8rem;
  flex-shrink: 0;
}
[data-bs-theme="dark"] .hi-avatar-sm { background: var(--hi-accent); }

/* ─── Trip icon ─────────────────────────────────────────────── */
.hi-trip-icon {
  width: 38px; height: 38px;
  border-radius: .5rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ─── Auth layout ─────────────────────────────────────────── */
.auth-body { background: #f0f2f5; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
[data-bs-theme="dark"] .auth-body { background: #0d0d1a; }
.auth-wrapper { width: 100%; max-width: 420px; }
.auth-card { border-radius: 1rem; }
.auth-logo {
  font-size: 2rem; font-weight: 900;
  color: var(--hi-primary); letter-spacing: -1px;
}
[data-bs-theme="dark"] .auth-logo { color: #fff; }

/* ─── Suggestions (geocoder) ───────────────────────────────── */
.suggestions-list {
  position: absolute; z-index: 1050;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  box-shadow: var(--hi-shadow);
  max-height: 220px;
  overflow-y: auto;
  width: 100%;
}
.suggestion-item {
  padding: .6rem 1rem;
  cursor: pointer;
  font-size: .85rem;
  transition: background var(--hi-transition);
}
.suggestion-item:hover { background: var(--bs-tertiary-bg); }

/* ─── Map ──────────────────────────────────────────────────── */
#tripMap .leaflet-container { border-radius: var(--hi-radius); }
.leaflet-control-attribution { display: none; }

/* ─── Tables ───────────────────────────────────────────────── */
.table th { font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--bs-secondary-color); }
.table td { vertical-align: middle; }

/* ─── Badges ───────────────────────────────────────────────── */
.badge { font-weight: 500; }

/* ─── Responsive sidebar ───────────────────────────────────── */
@media (max-width: 991.98px) {
  .hi-sidebar {
    transform: translateX(-100%);
  }
  .hi-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
  }
  .hi-main { margin-left: 0 !important; }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1019;
  }
  .sidebar-overlay.active { display: block; }
}

/* ─── Driver status indicator ──────────────────────────────── */
.driver-status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.driver-status-dot.available { background: #28a745; animation: pulse 2s infinite; }
.driver-status-dot.busy      { background: #ffc107; }
.driver-status-dot.offline   { background: #6c757d; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(40,167,69,.4); }
  50%       { box-shadow: 0 0 0 6px rgba(40,167,69,0); }
}

/* ─── Dark mode tweaks ─────────────────────────────────────── */
[data-bs-theme="dark"] .hi-topbar  { border-color: rgba(255,255,255,.08); }
[data-bs-theme="dark"] .card       { background-color: #1e1e30; }
[data-bs-theme="dark"] .table-light{ --bs-table-bg: #252538; }
[data-bs-theme="dark"] .list-group-item { background-color: #1e1e30; border-color: rgba(255,255,255,.08); }
[data-bs-theme="dark"] .hi-brand   { color: #fff; }

/* ─── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 3px; }
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); }

/* ─── PWA Install Banner ───────────────────────────────────── */
#pwa-install-banner {
  position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%);
  width: calc(100% - 2rem); max-width: 480px;
  background: #1a1a2e; color: #fff;
  border-radius: 16px; padding: .85rem 1rem;
  display: flex; align-items: center; gap: .75rem;
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
  z-index: 9999; transition: bottom .35s cubic-bezier(.34,1.56,.64,1);
  border: 1px solid rgba(255,255,255,.08);
}
#pwa-install-banner.pwa-banner-visible { bottom: 1rem; }
.pwa-banner-icon {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg,#e94560,#f72585);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.pwa-banner-text { flex: 1; min-width: 0; }
.pwa-banner-text strong { display: block; font-size: .9rem; }
.pwa-banner-text span { font-size: .75rem; opacity: .6; }
.pwa-btn-install {
  background: #e94560; color: #fff; border: none; border-radius: 8px;
  padding: .4rem .9rem; font-size: .82rem; font-weight: 600; white-space: nowrap;
  cursor: pointer;
}
.pwa-btn-install:hover { background: #c73652; }
.pwa-btn-close {
  background: none; border: none; color: rgba(255,255,255,.4); cursor: pointer;
  padding: .2rem .4rem; font-size: 1.1rem; line-height: 1; flex-shrink: 0;
}
.pwa-btn-close:hover { color: #fff; }

/* ─── Utilities ────────────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.fs-7 { font-size: .8125rem; }
.fw-medium { font-weight: 500; }
.gap-icon { gap: .5rem; }

/* ─── Animated Login ───────────────────────────────────────── */
.auth-body { padding: 0; background: #f0f2f5; min-height: 100vh; display: flex; align-items: stretch; }
.auth-wrapper { width: 100%; display: flex; align-items: stretch; min-height: 100vh; }

.login-container { display: flex; width: 100%; min-height: 100vh; }

/* Left decorative panel */
.login-panel-left {
  width: 45%; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
  position: relative; overflow: hidden; flex-direction: column; justify-content: center;
  padding: 3rem;
}
.login-left-content { position: relative; z-index: 2; }
.lp-brand { font-size: 1.8rem; font-weight: 900; color: #e94560; letter-spacing: -1px; margin-bottom: 2rem; }
.lp-title { font-size: 2.5rem; font-weight: 900; color: #fff; line-height: 1.15; }
.lp-accent { color: #e94560; }
.lp-subtitle { color: rgba(255,255,255,.6); font-size: 1rem; margin-top: 1rem; max-width: 320px; }
.lp-stats { display: flex; gap: 2rem; margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid rgba(255,255,255,.1); }
.lp-stat { display: flex; flex-direction: column; }
.lp-stat-num { font-size: 1.6rem; font-weight: 800; color: #fff; }
.lp-stat-label { font-size: .75rem; color: rgba(255,255,255,.5); }
.lp-back { display: inline-flex; align-items: center; color: rgba(255,255,255,.5); text-decoration: none; font-size: .85rem; margin-top: 2rem; transition: color .2s; }
.lp-back:hover { color: #e94560; }
.lp-bubbles { position: absolute; inset: 0; pointer-events: none; }
.bubble { position: absolute; border-radius: 50%; opacity: .08; }
.b1 { width: 400px; height: 400px; background: #e94560; top: -150px; right: -100px; animation: float 8s ease-in-out infinite; }
.b2 { width: 200px; height: 200px; background: #4cc9f0; bottom: -80px; left: -40px; animation: float 10s ease-in-out infinite reverse; }
.b3 { width: 150px; height: 150px; background: #f72585; top: 50%; left: 30%; animation: float 6s ease-in-out infinite 2s; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-20px)} }

/* Right form panel */
.login-panel-right {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 2rem; background: #fff;
}
.login-form-wrap { width: 100%; max-width: 400px; animation: slide-up .5s ease both; }
@keyframes slide-up { from{opacity:0;transform:translateY(24px)} to{opacity:1;transform:none} }

.login-form-header { text-align: center; }
.login-icon-wrap {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, #e94560, #f72585);
  color: #fff; font-size: 2rem;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(233,69,96,.35);
  animation: icon-pop .5s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes icon-pop { from{opacity:0;transform:scale(.5)} to{opacity:1;transform:scale(1)} }

/* Input styles */
.input-icon-wrap { position: relative; }
.input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: #aaa; font-size: 1rem; z-index: 4; pointer-events: none;
}
.hi-input {
  padding-left: 2.6rem !important;
  border: 2px solid #e8ecf0;
  border-radius: 12px !important;
  height: 52px;
  font-size: .95rem;
  transition: border-color .2s, box-shadow .2s;
}
.hi-input:focus { border-color: #e94560 !important; box-shadow: 0 0 0 3px rgba(233,69,96,.15) !important; }
.hi-input:focus + label, .hi-input:not(:placeholder-shown) + label { color: #e94560; }
.btn-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #aaa; cursor: pointer; padding: 4px 8px;
  z-index: 4;
}
.btn-eye:hover { color: #e94560; }
.input-animate { animation: input-in .4s ease both; }
@keyframes input-in { from{opacity:0;transform:translateX(-10px)} to{opacity:1;transform:none} }

/* Login button */
.btn-login {
  background: linear-gradient(135deg, #e94560, #f72585);
  color: #fff; border: none; border-radius: 12px; height: 52px;
  font-size: 1rem; font-weight: 600;
  box-shadow: 0 6px 20px rgba(233,69,96,.35);
  transition: transform .15s, box-shadow .15s;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(233,69,96,.45); color: #fff; }
.btn-login:active { transform: translateY(0); }

.link-accent { color: #e94560 !important; text-decoration: none; }
.link-accent:hover { text-decoration: underline; }

.login-divider { text-align: center; margin: 1.2rem 0; position: relative; color: #bbb; font-size: .8rem; }
.login-divider::before, .login-divider::after { content:''; position: absolute; top: 50%; width: 40%; height: 1px; background: #e8ecf0; }
.login-divider::before { left: 0; } .login-divider::after { right: 0; }
.login-divider span { background: #fff; padding: 0 .75rem; position: relative; z-index: 1; }

.btn-register { border-radius: 12px !important; height: 46px; font-size: .9rem; }
.btn-outline-accent { color: #e94560 !important; border-color: #e94560 !important; }
.btn-outline-accent:hover { background: #e94560 !important; color: #fff !important; }

/* Mobile: stack panels */
@media (max-width: 991px) {
  .login-panel-left { display: none !important; }
  .login-panel-right { background: #f0f2f5; }
  .login-form-wrap { background: #fff; border-radius: 20px; padding: 2rem; box-shadow: 0 8px 40px rgba(0,0,0,.08); }
}

/* ─── Driver Registration Page ─────────────────────────────── */
.driver-register-wrap { min-height: 100vh; background: #f0f2f5; }

.dreg-header {
  background: rgba(26,26,46,.95); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 100; border-bottom: 1px solid rgba(255,255,255,.08);
}
.dreg-header-inner {
  max-width: 900px; margin: 0 auto; padding: .85rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
.dreg-brand { font-size: 1.3rem; font-weight: 900; color: #e94560; letter-spacing: -1px; }
.dreg-back { color: rgba(255,255,255,.6); text-decoration: none; font-size: .85rem; transition: color .2s; }
.dreg-back:hover { color: #e94560; }
.dreg-login-link { color: rgba(255,255,255,.6); text-decoration: none; font-size: .85rem; transition: color .2s; }
.dreg-login-link:hover { color: #fff; }

.dreg-hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
  padding: 3rem 1.5rem; text-align: center; position: relative; overflow: hidden;
}
.dreg-hero-shapes { position: absolute; inset: 0; pointer-events: none; }
.dh-shape { position: absolute; border-radius: 50%; opacity: .1; }
.dh-s1 { width: 400px; height: 400px; background: #e94560; top: -200px; right: -100px; }
.dh-s2 { width: 250px; height: 250px; background: #4cc9f0; bottom: -120px; left: -60px; }
.dreg-hero-content { position: relative; z-index: 2; max-width: 600px; margin: 0 auto; }
.dreg-badge {
  display: inline-block; background: rgba(233,69,96,.2); color: #e94560;
  border: 1px solid rgba(233,69,96,.4); padding: .35rem .9rem;
  border-radius: 50px; font-size: .8rem; font-weight: 600; margin-bottom: 1rem;
}
.dreg-hero-title { font-size: clamp(1.8rem,4vw,2.8rem); font-weight: 900; color: #fff; line-height: 1.2; }
.dreg-hero-sub { color: rgba(255,255,255,.6); font-size: 1rem; }
.dreg-perk {
  background: rgba(255,255,255,.08); color: #fff; padding: .4rem .9rem;
  border-radius: 50px; font-size: .8rem; border: 1px solid rgba(255,255,255,.12);
}

.dreg-body { max-width: 700px; margin: -2rem auto 3rem; padding: 0 1rem; }
.dreg-card { background: #fff; border-radius: 20px; padding: 2rem; box-shadow: 0 8px 40px rgba(0,0,0,.1); }

/* Steps indicator */
.dreg-steps { display: flex; align-items: center; gap: .5rem; }
.dreg-step { display: flex; align-items: center; gap: .5rem; flex: 1; }
.dreg-step span {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid #dee2e6;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; color: #aaa; transition: all .3s;
  flex-shrink: 0;
}
.dreg-step small { font-size: .7rem; color: #aaa; white-space: nowrap; }
.dreg-step.active span { background: #e94560; border-color: #e94560; color: #fff; }
.dreg-step.active small { color: #e94560; font-weight: 600; }
.dreg-step-line { flex: 1; height: 2px; background: #dee2e6; border-radius: 2px; }

.dreg-section-title { color: #1a1a2e; font-weight: 700; font-size: 1rem; padding-bottom: .75rem; border-bottom: 2px solid #f0f2f5; margin-bottom: 1rem; }
.dreg-input { border: 2px solid #e8ecf0; border-radius: 10px !important; height: 48px; font-size: .9rem; transition: border-color .2s; }
.dreg-input:focus { border-color: #e94560 !important; box-shadow: 0 0 0 3px rgba(233,69,96,.12) !important; }

/* Vehicle type grid */
.vehicle-type-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.vehicle-type-card input { display: none; }
.vtc-inner {
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  padding: .6rem 1rem; border: 2px solid #e8ecf0; border-radius: 10px;
  cursor: pointer; transition: all .2s; font-size: .8rem; color: #666; min-width: 72px;
}
.vtc-icon { font-size: 1.3rem; }
.vehicle-type-card input:checked ~ .vtc-inner { border-color: #e94560; background: rgba(233,69,96,.06); color: #e94560; }
.vtc-inner:hover { border-color: #e94560; }

.btn-driver-next {
  background: linear-gradient(135deg, #e94560, #f72585); color: #fff; border: none;
  border-radius: 10px; padding: .6rem 1.5rem; font-weight: 600;
}
.btn-driver-next:hover { opacity: .9; color: #fff; }
.btn-driver-submit {
  background: linear-gradient(135deg, #e94560, #f72585); color: #fff; border: none;
  border-radius: 10px; padding: .6rem 1.5rem; font-weight: 600;
  box-shadow: 0 4px 16px rgba(233,69,96,.3);
}
.btn-driver-submit:hover { opacity: .9; color: #fff; }
