/* SPOT MY CAR - RESPONSIVE DESIGN */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  width: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Tahoma, sans-serif;
  direction: rtl;
  color: #fff;
}

/* LOGIN SCREEN */

#login-screen {
  --login-form-offset: 0px;
  min-height: 100vh;
  min-height: 100svh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
  position: relative;
  overflow-x: hidden;
  background-color: #06152b;
  background-image: url("/spot-my-car.png");
  background-position: center center;
  background-repeat: no-repeat;
  background-size: contain;
}

#login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(3, 13, 29, 0.10);
  pointer-events: none;
}

#login-screen #login-form,
#login-screen .login-card,
#login-screen .login-box,
#login-screen .login-container,
#login-screen .login-panel {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 350px;
  margin: auto;
  padding: 23px 21px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 18px;
  background: rgba(5, 21, 44, 0.72);
  box-shadow: 0 10px 35px rgba(0,0,0,0.30);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transform: translateY(var(--login-drag-y, 0px));
  transition: transform 0.25s ease;
}

#login-screen .brand-title {
  font-size: 25px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 1px;
  margin: 0 0 7px;
  color: #fff;
}

#login-screen .brand-subtitle {
  font-size: 14px;
  text-align: center;
  color: #c5ddff;
  margin-bottom: 20px;
}

#login-screen .brand-line {
  width: 60px;
  height: 3px;
  margin: 10px auto 20px;
  border-radius: 5px;
  background: #20a4ff;
}

#login-screen .form-group { margin-bottom: 14px; }

#login-screen label {
  display: block;
  margin-bottom: 7px;
  color: #e5efff;
  font-size: 14px;
}

#login-screen input:not([type="checkbox"]) {
  width: 100%;
  height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 9px;
  outline: none;
  background: rgba(255,255,255,0.10);
  color: #fff;
  font-size: 15px;
}

#login-screen input::placeholder { color: #b9c9dc; }

#login-screen input:focus {
  border-color: #20a4ff;
  box-shadow: 0 0 0 3px rgba(32,164,255,0.15);
}

#login-screen .login-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}

#login-screen .remember-option {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
}

#login-screen input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #159cff;
}

#forgot-password {
  color: #79c4ff;
  font-size: 13px;
  text-decoration: none;
}

#forgot-password:hover { text-decoration: underline; }

#login-button {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, #087de0, #16a5ff);
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}

#login-button:hover { filter: brightness(1.1); }

#login-message {
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
}

#login-screen .support-area {
  margin-top: 17px;
  padding-top: 13px;
  border-top: 1px solid rgba(255,255,255,0.18);
  text-align: center;
  font-size: 13px;
  color: #d5e5f8;
}

#login-screen .support-phone {
  display: inline-block;
  margin-top: 6px;
  color: #79c4ff;
  text-decoration: none;
  font-size: 15px;
  font-weight: bold;
  direction: ltr;
}

@media (max-width: 700px) {
  #login-screen {
    min-height: 100vh;
    min-height: 100svh;
    padding: 15px 12px;
    background-color: #06152b;
    background-image: url("/spot-my-car.png");
    background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
  }

  #login-screen #login-form,
  #login-screen .login-card,
  #login-screen .login-box,
  #login-screen .login-container,
  #login-screen .login-panel {
    max-width: 320px;
    padding: 19px 17px;
  }

  #login-screen .brand-title { font-size: 22px; }
  #login-screen .brand-subtitle { margin-bottom: 15px; }
}

@media (max-width: 380px) {
  #login-screen { padding: 10px; }

  #login-screen #login-form,
  #login-screen .login-card,
  #login-screen .login-box,
  #login-screen .login-container,
  #login-screen .login-panel {
    max-width: 300px;
    padding: 16px 14px;
  }

  #login-screen .brand-title { font-size: 20px; }
}

/* GENERAL */
.hidden { display: none !important; }

.dashboard {
  min-height: 100vh;
  background: #f1f5fa;
  color: #172b45;
}

.dashboard.active { display: block; }
.page { display: none; }
.page.active, .page.active-page { display: block; }

/* SIDEBAR */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 245px;
  padding: 22px 15px;
  background: #071a35;
  color: #fff;
  z-index: 20;
  overflow-y: auto;
}

.sidebar a, .sidebar button { color: #dceaff; }

.main-content {
  margin-right: 245px;
  min-height: 100vh;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin: 12px 22px 22px 22px;
  background: #fff;
  border-radius: 13px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.05);
}

#menu-toggle { display: none; }

/* STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.stat-card, .panel {
  padding: 18px;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(0,0,0,0.05);
}

.stat-card h3 {
  margin-top: 0;
  font-size: 14px;
  color: #63758b;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
  color: #087de0;
}

/* VEHICLES */
.vehicle-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.vehicle-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px;
  border: 1px solid #e2eaf3;
  border-radius: 12px;
  background: #fff;
  color: #172b45;
  text-align: right;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.vehicle-item:hover, .vehicle-item.selected {
  border-color: #168fe8;
  background: #f0f8ff;
}

.vehicle-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.vehicle-info strong { font-size: 14px; }
.vehicle-info small { color: #718096; font-size: 11px; overflow-wrap: anywhere; }

.vehicle-status {
  flex-shrink: 0;
  padding: 5px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: bold;
}

.vehicle-status.online { background: #e3f8ec; color: #16834b; }
.vehicle-status.offline { background: #fff0ef; color: #c14b43; }

/* MAP */
.content-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.6fr);
  gap: 18px;
  align-items: start;
}

.map-panel { min-width: 0; }

.map-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.map-heading h3 { margin: 0 0 5px; }
.map-heading p { margin: 0; }
.map-status, .map-last-refresh { color: #718096; font-size: 12px; }
.map-last-refresh { text-align: left; white-space: nowrap; }

.map-container, #map {
  width: 100%;
  height: min(62vh, 620px);
  min-height: 390px;
  border-radius: 13px;
  background: #e1eaf3;
  overflow: hidden;
  z-index: 1;
}

.selected-vehicle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  background: #f2f7fc;
  color: #29415e;
  font-size: 13px;
}

.selected-vehicle strong { color: #087de0; }
.selected-vehicle small { color: #718096; }

.spot-marker-wrap {
  background: transparent;
  border: 0;
}

.car-marker {
  display: flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #087de0;
  box-shadow: 0 2px 9px rgba(0,0,0,.35);
  color: #fff;
}

.car-marker b { font-size: 18px; line-height: 1; }
.car-marker span {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 17px;
  height: 17px;
  padding: 0 3px;
  border-radius: 10px;
  background: #06152b;
  color: #fff;
  font: bold 10px/17px Arial, sans-serif;
  text-align: center;
}

.car-marker.selected {
  background: #e58a13;
  transform: scale(1.12);
}

.map-popup { min-width: 160px; line-height: 1.8; color: #172b45; }
.map-popup strong { display: block; color: #087de0; }

/* PAGE HEADINGS AND BUTTONS */
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.page-heading h2 { margin: 0 0 6px; }
.page-heading p { margin: 0; color: #718096; }

.secondary-button, .logout-button, .icon-button {
  border: 0;
  border-radius: 9px;
  padding: 10px 14px;
  background: #087de0;
  color: #fff;
  cursor: pointer;
}

.secondary-button:disabled { opacity: .6; cursor: wait; }
.account-area { display: flex; align-items: center; gap: 12px; }
.top-brand { color: #071a35; font-weight: 800; letter-spacing: .5px; }
.side-heading { margin-bottom: 18px; font-weight: bold; }
.nav-item {
  display: block;
  width: 100%;
  margin: 5px 0;
  padding: 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: right;
  cursor: pointer;
}
.nav-item.active, .nav-item:hover { background: #12345d; color: #fff; }

.empty-state { color: #718096; font-size: 13px; }

/* MOBILE NAVIGATION */
.mobile-nav { display: none; }

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-right: 0; padding: 15px; }
  #menu-toggle { display: inline-flex; }
  .content-grid { grid-template-columns: 1fr; }
  .vehicles-panel { order: 2; }
  .map-panel { order: 1; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .main-content { padding: 10px; padding-bottom: 85px; }
  .topbar { margin: 10px; padding: 10px; }
  .mobile-nav {
    display: flex;
    position: fixed;
    right: 0;
    left: 0;
    bottom: 0;
    z-index: 30;
    justify-content: space-around;
    align-items: center;
    min-height: 62px;
    background: #071a35;
    box-shadow: 0 -3px 15px rgba(0,0,0,0.15);
  }
  .mobile-nav button {
    flex: 1;
    padding: 10px 3px;
    border: 0;
    background: transparent;
    color: #fff;
    text-align: center;
    font-size: 11px;
  }
  .map-container, #map { height: 55vh; min-height: 310px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .map-heading { flex-direction: column; }
  .map-last-refresh { text-align: right; }
}
