/*
  Lịch xe trống + form đặt xe (Catalog Shared/_RentalBookingForm.cshtml) và popup đặt xe #rental-booking-portal
  (Views/Shared/_RentalBookingPortalPartial.cshtml). Nạp ở _Layout. JS: assets/js/rental-booking.js. 1rem = 10px.
*/
.rd-booking-root, .rental-booking-portal, .rental-detail {
  --rd-line: #e6eaf0;
  --rd-muted: #5f6b7a;
  --rd-soft: #EEF3FB;
  --rd-free: #EEF3FB;
  --rd-free-text: #0B2D66;
  --rd-hold: #FFEFE6;
  --rd-hold-text: #D9501A;
  --rd-busy: #fde8e8;
  --rd-busy-text: #b42318;
}
.rd-booking-root [hidden] { display: none !important; }

.rd-block-title { margin: 0; font-size: 1.7rem; font-weight: 700; }

/* ===== Lịch trống ===== */
.rd-calendar { margin-bottom: 1.6rem; padding: 1.6rem; border: 1px solid var(--rd-line); border-radius: 1.4rem; background: #fff; }
.rd-calendar__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.rd-calendar__nav { display: flex; align-items: center; gap: .6rem; }
.rd-calendar__month { min-width: 11rem; text-align: center; font-weight: 600; font-size: 1.4rem; }
.rd-calendar__btn { width: 3.2rem; height: 3.2rem; border: 1px solid var(--rd-line); border-radius: 50%; background: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.rd-calendar__btn:disabled { opacity: .35; cursor: default; }
.rd-calendar__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .4rem; min-height: 24rem; transition: opacity .2s; }
.rd-calendar__grid.is-loading { opacity: .5; }
.rd-cal__wd { text-align: center; font-size: 1.2rem; font-weight: 600; color: var(--rd-muted); padding: .4rem 0; }
.rd-cal__day {
  aspect-ratio: 1 / 1; max-height: 4.4rem; width: 100%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: .9rem; font-size: 1.4rem; font-weight: 600;
  background: var(--rd-free); color: var(--rd-free-text); cursor: pointer; transition: transform .1s, border-color .2s;
}
.rd-cal__day:hover:not(:disabled) { border-color: var(--color-primary); }
.rd-cal__day:active:not(:disabled) { transform: scale(.95); }
.rd-cal__day.is-empty { background: transparent; cursor: default; }
.rd-cal__day.is-hold { background: var(--rd-hold); color: var(--rd-hold-text); }
.rd-cal__day.is-partial { background: linear-gradient(135deg, var(--rd-free) 50%, var(--rd-busy) 50%); color: var(--rd-busy-text); }
.rd-cal__day.is-busy { background: var(--rd-busy); color: var(--rd-busy-text); text-decoration: line-through; cursor: not-allowed; }
.rd-cal__day.is-past { background: #f4f5f7; color: #b8bec7; text-decoration: none; cursor: default; }
.rd-cal__day.is-today { border-color: var(--rd-free-text); }
.rd-cal__day.is-selected { background: var(--color-primary); color: #fff; }
.rd-calendar__legend { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; margin: 1.2rem 0 0; padding: 0; list-style: none; font-size: 1.2rem; color: var(--rd-muted); }
.rd-calendar__legend li { display: inline-flex; align-items: center; gap: .6rem; }
.rd-calendar__legend i { width: 1.2rem; height: 1.2rem; border-radius: .3rem; display: inline-block; }
.rd-calendar__legend .is-free { background: var(--rd-free); border: 1px solid var(--rd-free-text); }
.rd-calendar__legend .is-hold { background: var(--rd-hold); border: 1px solid var(--rd-hold-text); }
.rd-calendar__legend .is-partial { background: linear-gradient(135deg, var(--rd-free) 50%, var(--rd-busy) 50%); border: 1px solid var(--rd-busy-text); }
.rd-calendar__legend .is-busy { background: var(--rd-busy); border: 1px solid var(--rd-busy-text); }
.rd-calendar__hint { margin: .8rem 0 0; font-size: 1.2rem; color: var(--rd-muted); }

/* ===== Form đặt xe ===== */
.rd-booking { padding: 1.6rem; border: 1px solid var(--rd-line); border-radius: 1.4rem; background: #fff; scroll-margin-top: 10rem; }
.rd-booking .rd-block-title { margin-bottom: 1.2rem; }
.rd-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.rd-field { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.2rem; min-width: 0; }
.rd-label { font-size: 1.3rem; font-weight: 600; color: var(--rd-muted); }
.rd-label small { font-weight: 400; }
.rd-input {
  width: 100%; min-height: 4.4rem; padding: .9rem 1.2rem; border: 1px solid var(--rd-line); border-radius: 1rem;
  background: #fff; font: inherit; font-size: 1.4rem; color: inherit;
}
.rd-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(11, 45, 102, .14); }
textarea.rd-input { min-height: 0; resize: vertical; }
.rd-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.rd-mode { position: relative; cursor: pointer; }
.rd-mode input { position: absolute; opacity: 0; pointer-events: none; }
.rd-mode span { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.2rem; border: 1px solid var(--rd-line); border-radius: 1rem; transition: border-color .2s, background .2s; }
.rd-mode small { color: var(--rd-muted); font-size: 1.2rem; }
.rd-mode input:checked + span { border-color: var(--color-primary); background: var(--rd-soft); box-shadow: 0 0 0 1px var(--color-primary) inset; }
.rd-mode input:focus-visible + span { outline: 2px solid var(--color-primary); }

.rd-status { margin: -.2rem 0 1.2rem; padding: 1rem 1.2rem; border-radius: 1rem; font-size: 1.3rem; background: #f4f5f7; color: var(--rd-muted); }
.rd-status.is-success { background: var(--rd-free); color: var(--rd-free-text); }
.rd-status.is-warning { background: var(--rd-hold); color: var(--rd-hold-text); }
.rd-status.is-error { background: var(--rd-busy); color: var(--rd-busy-text); }
.rd-estimate { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; padding: 1.2rem 1.4rem; border-radius: 1rem; background: var(--rd-soft); }
.rd-estimate small { color: var(--rd-muted); }
.rd-estimate b { color: var(--color-primary); font-size: 2rem; }
.rd-booking .btn.is-loading { opacity: .7; pointer-events: none; }
.rd-booking .btn[disabled] { opacity: .5; cursor: not-allowed; }
.rd-booking__note { margin: 1.2rem 0 0; font-size: 1.2rem; color: var(--rd-muted); }
.rd-success { padding: 1.6rem; border-radius: 1rem; background: var(--rd-free); color: var(--rd-free-text); }
.rd-success b { font-size: 1.7rem; }
.rd-success p { margin: .6rem 0 0; }
.rd-policy-icon { width: 2.4rem; height: 2.4rem; color: var(--color-primary); }


/* ===== Popup đặt xe ===== */
.rbp-card { max-width: 96rem; max-height: 92vh; overflow-y: auto; padding: 2.4rem; }
.rbp-close { position: sticky; top: 0; float: right; margin: -1rem -1rem 0 0; background: #fff; z-index: 2; cursor: pointer; }
.rbp-car { display: flex; align-items: center; gap: 1.6rem; padding-bottom: 1.6rem; margin-bottom: 1.6rem; border-bottom: 1px solid var(--rd-line); min-height: 8rem; }
.rbp-car img { flex: 0 0 16rem; width: 16rem; height: 10rem; object-fit: cover; border-radius: 1.2rem; background: #f3f4f6; }
.rbp-car__text { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.rbp-car__text small { color: var(--rd-muted); font-size: 1.2rem; text-transform: uppercase; letter-spacing: .04em; }
.rbp-car__text b { font-size: 1.9rem; line-height: 1.3; }
.rbp-car__price { color: var(--color-primary); font-weight: 700; font-size: 1.7rem; }
.rbp-car__price small { color: var(--rd-muted); font-weight: 400; font-size: 1.3rem; }
.rbp-car__price del { color: var(--rd-muted); font-weight: 400; font-size: 1.3rem; }
.rbp-body .rd-booking-root { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 2rem; align-items: start; }
.rbp-body .rd-calendar { margin-bottom: 0; }
.rbp-body .rd-success { grid-column: 2; }
.rental-booking-portal.is-loading .rbp-body { opacity: .5; pointer-events: none; }

@media (max-width: 767px) {
  .rbp-card { padding: 1.6rem 1.2rem; max-height: 94vh; }
  .rbp-car img { flex-basis: 10rem; width: 10rem; height: 7rem; }
  .rbp-car__text b { font-size: 1.6rem; }
  .rbp-body .rd-booking-root { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
  .rbp-body .rd-success { grid-column: auto; }
}
@media (max-width: 575px) {
  .rd-row, .rd-modes { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .rd-modes { gap: .8rem; }
  .rd-calendar, .rd-booking { padding: 1.4rem 1.2rem; }
  .rd-cal__day { font-size: 1.3rem; border-radius: .7rem; }
}
