/* Styles used only by the rent-a-car page */

.branch-section {
  padding-top: 0;
  padding-bottom: 72px;
}

.branch-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.branch-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--border-card);
  border-radius: 16px;
  background-color: var(--white);
}

.branch-name {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
}

.branch-detail {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.branch-detail strong {
  color: var(--text);
}

#booking-dialog .page-message {
  margin-bottom: 0;
}

/* ---------- Search bar ---------- */
.search-section {
  padding-top: 8px;
  padding-bottom: 8px;
}

.search-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--border-card);
  border-radius: 16px;
  background-color: var(--white);
}

.search-hint {
  margin: 16px 0 0;
  font-size: 15px;
  color: var(--text-secondary);
}

/* ---------- Slide switch ---------- */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  justify-self: start;
  position: relative;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}

/* The real checkbox stays in the page for keyboards and screen readers, but is not drawn */
.switch-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.switch-track {
  display: block;
  width: 48px;
  height: 28px;
  padding: 3px;
  border-radius: 999px;
  background-color: #C3C9C7;
  transition: background-color 200ms ease;
}

.switch-thumb {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--white);
  box-shadow: 0 1px 3px rgba(18, 18, 18, 0.3);
  transition: transform 200ms ease;
}

.switch-input:checked + .switch-track {
  background-color: var(--accent);
}

.switch-input:checked + .switch-track .switch-thumb {
  transform: translateX(20px);
}

.switch-input:focus-visible + .switch-track {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

@media (hover: hover) {
  .switch:hover .switch-track {
    background-color: var(--text-muted);
  }

  .switch:hover .switch-input:checked + .switch-track {
    background-color: var(--accent-hover);
  }
}

/* ---------- Date fields and calendar ---------- */
.date-input-wrap {
  position: relative;
}

.date-input-wrap input {
  padding-right: 44px;
}

/* The icon button sits inside the right edge of the field. Its 20px icon ends 12px from the edge, where the drop down chevron ends */
.date-icon-button {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background-color: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 150ms ease;
}

.calendar {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 4;
  box-sizing: border-box;
  width: 100%;
  min-width: 280px;
  max-width: 340px;
  padding: 16px;
  border: 1px solid var(--border-card);
  border-radius: 16px;
  background-color: var(--white);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.12);
  font-family: inherit;
  animation: banner-rise 200ms ease;
}

.calendar[hidden] {
  display: none;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.calendar-title {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.calendar .calendar-nav {
  width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 8px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-weekdays span {
  padding: 6px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.calendar-day {
  min-height: 44px;
  padding: 0;
  border: 1.5px solid transparent;
  border-radius: 8px;
  background-color: var(--white);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.calendar-day-today {
  border-color: var(--accent);
}

.calendar .calendar-day-selected {
  border-color: var(--accent);
  background-color: var(--accent);
  color: var(--white);
}

.calendar-day:disabled {
  background-color: var(--white);
  color: #B4BAB8;
  cursor: not-allowed;
}

.calendar-day:focus-visible {
  outline-offset: 2px;
}

@media (hover: hover) {
  .date-icon-button:hover {
    color: var(--accent);
  }

  .calendar-day:not(:disabled):not(.calendar-day-selected):hover {
    background-color: var(--close-bg);
  }
}

/* ---------- Passengers dropdown ---------- */
.dropdown {
  position: relative;
}

/* The real select stays in the page as the stored value, but is not drawn */
.form-field .dropdown-native {
  position: absolute;
  width: 1px;
  min-height: 0;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.dropdown-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--border-field);
  border-radius: 8px;
  background-color: var(--white);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.dropdown-button svg {
  flex: none;
  color: var(--text-secondary);
  transition: transform 150ms ease;
}

.dropdown-button[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.dropdown-button:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 79, 70, 0.3);
}

.dropdown-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 4;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--border-card);
  border-radius: 12px;
  background-color: var(--white);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.12);
  animation: banner-rise 200ms ease;
}

.dropdown-list[hidden] {
  display: none;
}

.dropdown-option {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.dropdown-option-active {
  background-color: var(--close-bg);
}

.dropdown-option-selected {
  background-color: var(--accent);
  color: var(--white);
  font-weight: 600;
}

@media (hover: hover) {
  .dropdown-button:hover {
    border-color: var(--text);
  }

  .dropdown-option:not(.dropdown-option-selected):hover {
    background-color: var(--close-bg);
  }
}

/* ---------- Card number and the card it was recognised as ---------- */
.card-number-wrap {
  position: relative;
}

.card-number-wrap input {
  padding-right: 112px;
}

.card-brand {
  position: absolute;
  top: 50%;
  right: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background-color: var(--panel-bg);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transform: translateY(-50%);
  pointer-events: none;
}

.card-brand:empty {
  display: none;
}

/* ---------- Price on a searched car: tiny grey text under the button ---------- */
.search-price {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 400;
  text-align: center;
  color: var(--text-muted);
}

/* ---------- Car dialog ---------- */
dialog.dialog-wide {
  max-width: 720px;
}

.dialog-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dialog-step {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.details-step {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 16px;
}

.payment-step {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 16px;
}

.booking-recap {
  margin: 0;
  padding: 12px 16px;
  border-radius: 10px;
  background-color: var(--panel-bg);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.dialog-subtitle {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Gallery */
.gallery {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gallery-main {
  display: block;
  width: 100%;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  border-radius: 12px;
  background-color: var(--photo-bg);
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.gallery-thumb {
  display: block;
  padding: 0;
  border: 2px solid var(--border-card);
  border-radius: 8px;
  background-color: var(--photo-bg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 150ms ease;
}

.gallery-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 8 / 5;
  object-fit: cover;
}

.gallery-thumb-active {
  border-color: var(--accent);
}

.gallery-thumb:focus-visible {
  outline-offset: 2px;
}

/* Details */
.car-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.car-info-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.car-info-name {
  font-size: 21px;
  font-weight: 700;
}

.car-description {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.car-specs {
  grid-template-columns: repeat(2, 1fr);
}

.feature-list {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.trip-info {
  display: flex;
  flex-direction: column;
}

.trip-info .cost-panel {
  margin-top: 16px;
}

.view-more-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.details-actions {
  flex-direction: column-reverse;
}

.details-actions .button {
  width: 100%;
}

@media (hover: hover) {
  .gallery-thumb:hover {
    border-color: var(--text);
  }

  .gallery-thumb-active:hover {
    border-color: var(--accent);
  }
}

@media (min-width: 768px) {
  .search-panel {
    grid-template-columns: repeat(3, 1fr) auto;
    align-items: start;
    padding: 24px;
  }

  .switch {
    grid-column: 1 / -1;
  }

  .search-button {
    margin-top: 22px;
    height: 44px;
    min-height: 44px;
    min-width: 140px;
  }

  .calendar-day {
    min-height: 40px;
  }

  .branch-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .details-step {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .trip-info,
  .details-actions {
    grid-column: 1 / -1;
  }

  .details-actions {
    flex-direction: row;
  }

  .details-actions .button {
    width: auto;
  }
}
