/* ═══════════════════════════════════════
   CLEN | كلن — Booking Step 2 — Location
   ═══════════════════════════════════════ */

/* ═══════════════════════════════════════
   Booking Step 2 — Location (Figma 4159:4874)
   ═══════════════════════════════════════ */

.booking-step--location {
  width: 100%;
}

.location-step {
  display: flex;
  flex-direction: column;
  gap: var(--booking-step-gap, 24px);
  direction: rtl;
}

.location-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
}

.location-header__row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.location-step__title {
  margin: 0;
  font-size: clamp(15px, 3.8vw, 17px);
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-rhino);
  text-align: right;
}

.location-step__subtitle {
  margin: 0;
  width: 100%;
  font-weight: 400;
  color: var(--color-pale-sky);
  text-align: right;
}

.location-change-branch {
  flex: none;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 22px;
  color: var(--color-primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.location-change-branch:hover {
  color: var(--color-primary-dark);
}

.location-branch-picker {
  width: 100%;
  border: 1px solid var(--color-border-tab);
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-surface);
}

.location-branch-picker__list {
  display: flex;
  flex-direction: column;
}

.location-branch-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  width: 100%;
  padding: var(--space-3);
  text-align: right;
  direction: rtl;
  background: none;
  border: none;
  border-block-end: 1px solid var(--color-border-light);
  cursor: pointer;
}

.location-branch-option:last-child {
  border-block-end: none;
}

.location-branch-option--active,
.location-branch-option:hover {
  background-color: var(--color-primary-subtle);
}

.location-branch-option__name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-mirage);
}

.location-branch-option__address {
  font-size: 12px;
  color: var(--color-pale-sky);
}

.location-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.location-body__main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.location-card {
  box-sizing: border-box;
  width: 100%;
  background: var(--color-card);
}

.location-card--saved {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  direction: rtl;
}

.location-saved--loading .location-saved__list {
  visibility: hidden;
  min-height: 96px;
}

.location-saved__loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  background: var(--color-card);
}

.location-saved__loading[hidden] {
  display: none;
}

.location-saved__loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: location-saved-spin 0.8s linear infinite;
}

.location-saved__loading-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-pale-sky);
}

@keyframes location-saved-spin {
  to {
    transform: rotate(360deg);
  }
}

.location-card__heading {
  margin: 0;
  width: 100%;
  font-size: 14px;
  font-weight: 600;
  line-height: 21px;
  color: var(--color-mirage);
  text-align: right;
}

.location-saved__list {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, minmax(48px, auto));
  grid-auto-columns: minmax(140px, calc((100% - 6px) / 2));
  gap: 6px;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  direction: rtl;
}

.location-saved__list::-webkit-scrollbar {
  height: 4px;
}

.location-saved__list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 999px;
}

.location-address-card {
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  max-height: 56px;
  padding: 6px 8px;
  text-align: right;
  direction: rtl;
  background: var(--color-address-card-bg);
  border: 1px solid var(--color-border-tab);
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  scroll-snap-align: start;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.saved-address-city {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  font-weight: var(--font-weight-regular);
  font-size: 11px;
  color: var(--color-gray-900);
  margin-bottom: 0;
  min-width: 0;
}

.saved-address-city__text {
  font-weight: var(--font-weight-bold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
}

.saved-address-sep {
  flex-shrink: 0;
  font-weight: var(--font-weight-regular);
  color: var(--color-gray-500);
}

.saved-address-area {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  font-weight: var(--font-weight-regular);
  color: var(--color-gray-900);
}

.saved-address-text {
  flex: 1;
  min-height: 0;
  width: 100%;
  font-size: 10px;
  color: var(--color-gray-500);
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.location-address-card--selected {
  border: 2px solid var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
  background: var(--color-primary-subtle, rgba(99, 110, 178, 0.08));
}

.location-address-card--selected .saved-address-city__text {
  color: var(--color-primary);
}

.location-address-card__check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  color: var(--color-white);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.85);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.location-address-card--selected .location-address-card__check {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.location-map-wrap {
  width: 100%;
  flex-shrink: 0;
}

.location-map {
  position: relative;
  width: 100%;
  height: clamp(220px, 38vh, 320px);
  min-height: 220px;
  flex-shrink: 0;
  border: 1px dashed var(--color-periwinkle);
  border-radius: 14px;
  overflow: hidden;
  background: var(--color-surface-tint);
  touch-action: none;
  overscroll-behavior: contain;
  visibility: visible;
  opacity: 1;
}

.location-map__canvas {
  width: 100%;
  height: 100%;
  min-height: 220px;
  display: block;
  touch-action: none;
}

.location-gps-btn {
  position: absolute;
  bottom: 10px;
  left: 50%;
  z-index: 10;
  transform: translateX(-50%);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: none;
  border-radius: 999px;
  background: var(--color-card);
  color: var(--color-rhino);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
  pointer-events: auto;
}

.location-gps-btn:active {
  transform: translateX(-50%) scale(0.98);
  background: var(--color-surface-tint);
}

.location-gps-btn__icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
  color: var(--color-primary);
}

.location-gps-btn__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.location-map__recenter-btn {
  position: absolute;
  right: 10px;
  bottom: 62px;
  z-index: 20;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--color-card);
  color: #333;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  pointer-events: auto;
}

.location-map__recenter-btn svg {
  width: 22px;
  height: 22px;
  display: block;
  color: #333;
}

.location-map__recenter-btn:active {
  background: #f5f5f5;
  transform: scale(0.96);
}

.location-map__recenter-btn.hidden {
  display: none;
}

.location-map--inactive {
  opacity: 0.92;
}

.location-map--inactive .location-map__pin {
  pointer-events: none;
  cursor: default;
}

.location-map__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}

.location-map__zone {
  position: absolute;
  width: 105px;
  height: 104px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
}

.location-map__car {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  border: 2px solid var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(99, 110, 178, 0.35);
}

.location-map__car img {
  width: 18px;
  height: 18px;
}

.location-map__pin {
  position: absolute;
  transform: translate(-50%, -100%);
  border: none;
  background: none;
  padding: 0;
  cursor: grab;
  z-index: 3;
  touch-action: none;
}

.location-map__pin:active {
  cursor: grabbing;
}

.location-map__pin img {
  display: block;
  width: 34px;
  height: 51px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.location-card--fields {
  padding: 19px 17px;
  border: 1px solid var(--color-border-tab);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(39, 45, 82, 0.08);
}

.location-fields {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}

.location-label {
  width: 100%;
  font-size: 13px;
  font-weight: 600;
  line-height: 21px;
  color: var(--color-mirage);
  text-align: right;
}

.location-input {
  box-sizing: border-box;
  width: 100%;
  font-size: 14px;
  line-height: 19px;
  color: var(--color-input-text);
  background: var(--color-card);
  border: 1px solid var(--color-border-tab);
  border-radius: 10px;
  text-align: right;
  direction: rtl;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  height: 41px;
  padding: 10.5px 14px;
}

.location-input::placeholder {
  color: var(--color-input-placeholder);
}

.location-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 110, 178, 0.15);
}

.location-map-warning {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 3;
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
}

@media (min-width: 768px) {
  .location-change-branch {
    font-size: 15px;
  }

  .location-address-card {
    padding: 7px 8px;
  }

  .location-input {
    height: 44px;
    font-size: 15px;
  }
}

@media (min-width: 1200px) {
  .location-change-branch {
    font-size: 16px;
  }

  .location-address-card__title {
    font-size: 15px;
  }

  .location-address-card--selected {
    border: 3px solid var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-subtle);
    padding-inline-start: 20px;
  }

  .location-body__main {
    flex-direction: row-reverse;
    align-items: flex-start;
    gap: 28px;
  }

  .location-map-wrap {
    flex: 1 1 0;
    min-width: 0;
  }

  .location-card--fields {
    flex: 0 0 min(480px, 46%);
    max-width: 524px;
  }

  .location-map {
    height: clamp(300px, 36vh, 360px);
  }
}

