/* ============================================
   ROTRACK WEB - Plataforma de Rastreamento
   ============================================ */
:root {
  --orange: #FF6B1A;
  --orange-dark: #E85A0F;
  --orange-light: #FF8A47;
  --dark: #0F1724;
  --dark-2: #1A2332;
  --dark-3: #232F42;
  --gray: #8A95A8;
  --gray-light: #C5CCD9;
  --bg: #F4F6FA;
  --white: #FFFFFF;
  --green: #22C55E;
  --yellow: #EAB308;
  --red: #EF4444;
  --shadow: 0 4px 16px rgba(15,23,36,.08);
  --shadow-lg: 0 12px 40px rgba(15,23,36,.18);
  --radius: 12px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: 'Inter', sans-serif; color: var(--dark); }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }

/* ============================================
   LOGIN
   ============================================ */
.login-body {
  background: var(--dark);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-bg { position: absolute; inset: 0; z-index: 0; }
.login-bg__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,107,26,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,107,26,.06) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridMove 20s linear infinite;
}
.login-bg__glow {
  position: absolute;
  top: -200px; right: -200px;
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(255,107,26,.25), transparent 70%);
  border-radius: 50%;
  filter: blur(40px);
}
@keyframes gridMove { to { background-position: 50px 50px; } }

.login-wrap { position: relative; z-index: 1; width: 100%; max-width: 460px; padding: 24px; }

.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #EEF1F6;
}
.login-brand__mark {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  border-radius: 14px;
  display: grid; place-items: center;
  color: white; font-size: 24px;
  box-shadow: 0 8px 20px rgba(255,107,26,.35);
}
.login-brand h1 { font-size: 22px; font-weight: 800; letter-spacing: 0.5px; }
.login-brand h1 span { color: var(--orange); }
.login-brand p { font-size: 13px; color: var(--gray); margin-top: 2px; }

.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--dark-2);
  margin-bottom: 6px;
}
.login-input {
  display: flex;
  align-items: center;
  background: #F7F9FC;
  border: 1.5px solid #E6EAF2;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  transition: all .2s;
}
.login-input:focus-within {
  border-color: var(--orange);
  background: white;
  box-shadow: 0 0 0 4px rgba(255,107,26,.1);
}
.login-input > i { color: var(--gray); font-size: 14px; }
.login-input input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 14px 12px;
  font-size: 14.5px;
  color: var(--dark);
}
.login-toggle { color: var(--gray); padding: 4px 8px; }
.login-toggle:hover { color: var(--orange); }

.login-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.login-check { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--dark-2); }
.login-check input { accent-color: var(--orange); }
.login-link { color: var(--orange); font-weight: 600; }
.login-link:hover { text-decoration: underline; }

.login-error {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FEF2F2;
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border: 1px solid #FECACA;
}

.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: white;
  font-weight: 700;
  font-size: 15px;
  padding: 15px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.3px;
  box-shadow: 0 6px 16px rgba(255,107,26,.35);
  transition: all .2s;
}
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(255,107,26,.45); }
.login-btn:disabled { opacity: .6; cursor: wait; }

.login-demo {
  margin-top: 18px;
  padding: 12px 14px;
  background: #FFF7F0;
  border: 1px dashed #FFD0AC;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--dark-2);
}
.login-demo code {
  background: white;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  color: var(--orange-dark);
  font-weight: 600;
}

.login-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #EEF1F6;
  font-size: 13px;
}
.login-copy {
  text-align: center;
  color: rgba(255,255,255,.45);
  font-size: 12.5px;
  margin-top: 20px;
}

/* ============================================
   APP / DASHBOARD
   ============================================ */
.app-body { background: var(--bg); overflow: hidden; }

.topbar {
  height: 64px;
  background: var(--dark);
  color: white;
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  position: relative;
  z-index: 100;
}
.topbar__left, .topbar__right { display: flex; align-items: center; gap: 14px; }
.topbar__center { flex: 1; display: flex; justify-content: center; gap: 12px; }

.topbar__menu {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: rgba(255,255,255,.75);
  font-size: 16px;
}
.topbar__menu:hover { background: rgba(255,255,255,.08); color: white; }

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 18px;
  border-right: 1px solid rgba(255,255,255,.1);
  margin-right: 4px;
}
.topbar__brand i { color: var(--orange); font-size: 20px; }
.topbar__brand span { font-weight: 600; letter-spacing: 0.5px; font-size: 14.5px; }
.topbar__brand strong { color: white; }

.kpi {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.05);
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.06);
}
.kpi i { font-size: 18px; color: var(--gray-light); }
.kpi b { display: block; font-size: 17px; font-weight: 700; line-height: 1; }
.kpi span { font-size: 11px; color: var(--gray); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi--ok i { color: var(--green); }
.kpi--warn i { color: var(--yellow); }
.kpi--off i { color: var(--red); }

.topbar__btn {
  position: relative;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: rgba(255,255,255,.75);
  font-size: 15px;
}
.topbar__btn:hover { background: rgba(255,255,255,.08); color: white; }
.badge {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
  border-left: 1px solid rgba(255,255,255,.1);
}
.topbar__avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  font-size: 14px;
}
.topbar__udata b { display: block; font-size: 13.5px; line-height: 1.2; }
.topbar__udata span { font-size: 11px; color: var(--gray); }
.topbar__logout {
  width: 36px; height: 36px;
  border-radius: 8px;
  color: rgba(255,255,255,.6);
  margin-left: 6px;
}
.topbar__logout:hover { background: rgba(239,68,68,.15); color: var(--red); }

.app-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: calc(100vh - 64px);
}

/* SIDEBAR */
.sidebar {
  background: white;
  border-right: 1px solid #E6EAF2;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar__search {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #EEF1F6;
  gap: 10px;
}
.sidebar__search i { color: var(--gray); }
.sidebar__search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--dark);
  background: transparent;
}
.sidebar__filters {
  display: flex;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid #EEF1F6;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  background: #F4F6FA;
  color: var(--dark-2);
  font-weight: 600;
  border: 1px solid transparent;
  transition: all .15s;
}
.chip i { font-size: 8px; }
.chip[data-filter="movimento"] i { color: var(--green); }
.chip[data-filter="parado"] i { color: var(--yellow); }
.chip[data-filter="offline"] i { color: var(--red); }
.chip--active, .chip:hover { background: var(--orange); color: white; }
.chip--active i, .chip:hover i { color: white !important; }

.vlist {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
}
.vlist__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #F2F4F8;
  cursor: pointer;
  transition: background .15s;
}
.vlist__item:hover { background: #FAFBFD; }
.vlist__item.active { background: #FFF7F0; border-left: 3px solid var(--orange); padding-left: 13px; }
.vlist__icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: #F4F6FA;
  display: grid; place-items: center;
  color: var(--dark-2);
  font-size: 16px;
  flex-shrink: 0;
  position: relative;
}
.vlist__icon::after {
  content: '';
  position: absolute;
  bottom: -2px; right: -2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid white;
  background: var(--gray);
}
.vlist__item[data-status="movimento"] .vlist__icon::after { background: var(--green); }
.vlist__item[data-status="parado"] .vlist__icon::after { background: var(--yellow); }
.vlist__item[data-status="offline"] .vlist__icon::after { background: var(--red); }
.vlist__info { flex: 1; min-width: 0; }
.vlist__name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vlist__plate { font-size: 11.5px; color: var(--gray); font-family: 'Courier New', monospace; letter-spacing: 0.5px; }
.vlist__meta { text-align: right; font-size: 11px; color: var(--gray); }
.vlist__meta b { display: block; font-size: 13px; color: var(--dark-2); font-weight: 700; }

/* MAP */
.mapwrap { position: relative; }
#map { width: 100%; height: 100%; background: #DDE3ED; }

.map-tools {
  position: absolute;
  top: 14px; right: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 500;
}
.tool {
  width: 40px; height: 40px;
  background: white;
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--dark-2);
  font-size: 15px;
  box-shadow: var(--shadow);
  transition: all .15s;
}
.tool:hover { background: var(--orange); color: white; }
.tool.active { background: var(--orange); color: white; }

/* Painel de info do veículo */
.panel-info {
  position: absolute;
  bottom: 20px; left: 20px;
  width: 360px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  z-index: 500;
  animation: piIn .25s ease-out;
}
@keyframes piIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.panel-info__head { display: flex; justify-content: space-between; margin-bottom: 16px; }
.panel-info__head h3 { font-size: 17px; font-weight: 700; }
.panel-info__head p { font-size: 12px; color: var(--gray); font-family: 'Courier New', monospace; margin-top: 2px; letter-spacing: 0.5px; }
.panel-info__close {
  width: 30px; height: 30px;
  border-radius: 8px;
  color: var(--gray);
}
.panel-info__close:hover { background: #F4F6FA; color: var(--red); }
.panel-info__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px;
  background: #F7F9FC;
  border-radius: 10px;
  margin-bottom: 12px;
}
.panel-info__grid > div span { font-size: 11px; color: var(--gray); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 2px; }
.panel-info__grid > div b { font-size: 13.5px; color: var(--dark); }
.panel-info__addr {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--dark-2);
  padding: 10px 12px;
  background: #FFF7F0;
  border-radius: 8px;
  margin-bottom: 14px;
}
.panel-info__addr i { color: var(--orange); margin-top: 2px; }
.panel-info__acts { display: flex; gap: 6px; }
.btn-mini {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 8px;
  background: #F4F6FA;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--dark-2);
  transition: all .15s;
}
.btn-mini:hover { background: #E6EAF2; }
.btn-mini--primary { background: var(--orange); color: white; }
.btn-mini--primary:hover { background: var(--orange-dark); }

/* Marker customizado Leaflet */
.veic-marker {
  width: 36px; height: 36px;
  background: var(--dark);
  border: 3px solid white;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  position: relative;
}
.veic-marker--movimento { background: var(--green); }
.veic-marker--parado { background: var(--yellow); color: var(--dark); }
.veic-marker--offline { background: var(--gray); }
.veic-marker__pulse {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid currentColor;
  animation: vpulse 1.8s ease-out infinite;
}
@keyframes vpulse {
  0% { transform: scale(1); opacity: .9; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Responsivo */
@media (max-width: 991px) {
  .topbar__center { display: none; }
  .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: absolute;
    top: 64px; left: 0; bottom: 0;
    width: 320px;
    z-index: 600;
    box-shadow: 4px 0 20px rgba(0,0,0,.15);
    transform: translateX(-100%);
    transition: transform .25s;
  }
  .sidebar.open { transform: translateX(0); }
  .panel-info { width: calc(100% - 40px); }
  .topbar__udata { display: none; }
}
@media (max-width: 600px) {
  .login-card { padding: 28px 22px; }
  .topbar__brand span { display: none; }
}
