/**
 * Carvo Rentals — the same design system as the office application.
 *
 * The values are lifted from `packages/ui/src/tokens.css`, not approximated: the
 * red, the greys, the radii and the 40px control height are the ones the staff
 * see every day, so the public site and the back office read as one product.
 * They are copied rather than imported because a WordPress plugin cannot reach
 * into the Next build, and duplicating twenty values is cheaper than a build step
 * that has to run on the customer's host.
 *
 * ## Living inside somebody else's theme
 *
 * Every rule is scoped under `.cvl`, and every element carries a `cvl-` class
 * rather than being styled by tag. Astra — the theme this replaces VikRentCar
 * under — styles bare `input`, `select` and `button` aggressively, and a
 * component that relied on element selectors would be overridden on some pages
 * and not others. The scoping is also why there is not a single `!important`
 * here: specificity does the work instead, which stays debuggable.
 *
 * `cvl-` and not `carvo-`: the CARVO plugin for carvo.app already owns
 * `carvo-brand`, `carvo-booking-row` and forty more, and two stylesheets both
 * claiming `--carvo-brand` on one page is a colour that changes with load order.
 * See the note in carvolite-portal.php.
 *
 * Font is inherited on purpose. The office app sets Instrument Sans; a public
 * site should look like the site it is part of, and forcing a webfont download
 * on a phone at the airport to match an internal tool is the wrong trade.
 */

.cvl {
  /* ── Brand ── */
  --cvl-brand: #d02027;
  --cvl-brand-hover: #b8161d;
  --cvl-brand-tint: #fdeded;
  --cvl-brand-tint-border: #f4c7c9;
  --cvl-brand-deep: #8e1319;

  /* ── Status ── */
  --cvl-success: #2fa96b;
  --cvl-success-tint: #eaf6f0;
  --cvl-success-tint-border: #c6e6d6;
  --cvl-success-deep: #17724a;
  --cvl-warning-tint: #fdf3e4;
  --cvl-warning-tint-border: #f2dfbe;
  --cvl-warning-deep: #8a5a12;
  --cvl-info-tint: #eaf0fd;
  --cvl-info-tint-border: #cfdcfa;
  --cvl-info-strong: #2456b8;

  /* ── Surfaces & lines ── */
  --cvl-surface: #ffffff;
  --cvl-sunken: #f6f7f8;
  --cvl-chip: #f1f2f4;
  --cvl-line: #e3e5ea;
  --cvl-line-soft: #eef0f3;
  --cvl-field: #f7f8f9;
  --cvl-field-border: #e1e4e9;

  /* ── Text ── */
  --cvl-ink: #161a1f;
  --cvl-ink-soft: #3e444c;
  --cvl-ink-muted: #6c737e;
  --cvl-ink-subtle: #9ba2ad;

  /* ── Radii, from the mock ── */
  --cvl-r-field: 10px;
  --cvl-r-card: 14px;
  --cvl-r-pill: 99px;

  /* ── Elevation ── */
  --cvl-shadow-card: 0 1px 2px rgba(16, 20, 28, 0.04);
  --cvl-shadow-hover: 0 6px 20px rgba(16, 20, 28, 0.09);
  --cvl-shadow-brand: 0 2px 6px rgba(208, 32, 39, 0.28);

  color: var(--cvl-ink);
  box-sizing: border-box;
}

.cvl *,
.cvl *::before,
.cvl *::after {
  box-sizing: inherit;
}

/* ── Fields ─────────────────────────────────────────────── */

.cvl-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.cvl-field__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--cvl-ink-muted);
}

.cvl .cvl-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--cvl-ink);
  background: var(--cvl-field);
  border: 1px solid var(--cvl-field-border);
  border-radius: var(--cvl-r-field);
  transition: border-color 0.15s, box-shadow 0.15s;
  /* Astra sets its own; ours has to win without !important. */
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

.cvl textarea.cvl-input {
  height: auto;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}

.cvl .cvl-input:focus {
  outline: none;
  border-color: var(--cvl-brand);
  box-shadow: 0 0 0 3px rgba(208, 32, 39, 0.12);
}

/**
 * `datetime-local` on iOS renders at the OS font size and overflows a 40px box.
 * Pinning the line-height is what keeps the control the same height as its
 * neighbours on a phone, where this form is mostly used.
 */
.cvl input[type='datetime-local'].cvl-input {
  line-height: 38px;
}

/* ── Buttons ────────────────────────────────────────────── */

.cvl .cvl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  border-radius: var(--cvl-r-field);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.cvl .cvl-btn--primary {
  background: var(--cvl-brand);
  color: #fff;
  box-shadow: var(--cvl-shadow-brand);
}

.cvl .cvl-btn--primary:hover,
.cvl .cvl-btn--primary:focus-visible {
  background: var(--cvl-brand-hover);
  color: #fff;
}

.cvl .cvl-btn--block {
  width: 100%;
}

.cvl .cvl-btn--disabled,
.cvl .cvl-btn[disabled] {
  background: var(--cvl-chip);
  color: var(--cvl-ink-subtle);
  box-shadow: none;
  cursor: not-allowed;
}

/* ── Search ─────────────────────────────────────────────── */

.cvl-search {
  padding: 18px;
  background: var(--cvl-surface);
  border: 1px solid var(--cvl-line);
  border-radius: var(--cvl-r-card);
  box-shadow: var(--cvl-shadow-card);
}

.cvl-search__title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/**
 * `auto-fit` with a 200px floor, so the row collapses from five columns to two to
 * one as the viewport narrows without a single media query — and without ever
 * producing a 90px-wide date field, which is unusable on a phone.
 */
.cvl-search__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  align-items: end;
}

.cvl-field--action {
  justify-content: flex-end;
}

.cvl-field--wide {
  grid-column: 1 / -1;
  margin-top: 12px;
}

/* ── Fleet ──────────────────────────────────────────────── */

.cvl-fleet__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--cvl-ink-muted);
}

.cvl-fleet__dates {
  font-weight: 600;
  color: var(--cvl-ink-soft);
}

.cvl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.cvl-card {
  display: flex;
  flex-direction: column;
  background: var(--cvl-surface);
  border: 1px solid var(--cvl-line);
  border-radius: var(--cvl-r-card);
  box-shadow: var(--cvl-shadow-card);
  overflow: hidden;
  transition: box-shadow 0.18s, transform 0.18s;
}

.cvl-card:hover {
  box-shadow: var(--cvl-shadow-hover);
  transform: translateY(-2px);
}

/**
 * A taken car stays on the page, dimmed. Removing it would make the grid shrink
 * as dates change, which reads as a broken site rather than as a busy week.
 */
.cvl-card--taken {
  opacity: 0.62;
}

.cvl-card--taken:hover {
  transform: none;
  box-shadow: var(--cvl-shadow-card);
}

.cvl-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--cvl-chip);
}

.cvl-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cvl-card__noimg {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--cvl-chip), var(--cvl-sunken));
}

.cvl-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: var(--cvl-r-pill);
}

.cvl-badge--taken {
  background: var(--cvl-chip);
  color: var(--cvl-ink-muted);
}

.cvl-badge--last {
  background: var(--cvl-brand);
  color: #fff;
}

.cvl-card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  padding: 14px;
}

.cvl-card__title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.cvl-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cvl-specs li {
  padding: 3px 9px;
  font-size: 11.5px;
  color: var(--cvl-ink-muted);
  background: var(--cvl-chip);
  border-radius: var(--cvl-r-pill);
}

.cvl-card__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--cvl-line-soft);
}

.cvl-price__amount {
  display: block;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.cvl-price__note {
  display: block;
  font-size: 11.5px;
  color: var(--cvl-ink-subtle);
}

/* ── Booking ────────────────────────────────────────────── */

.cvl-booking__summary {
  display: grid;
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--cvl-surface);
  border: 1px solid var(--cvl-line);
  border-radius: var(--cvl-r-card);
}

@media (max-width: 640px) {
  .cvl-booking__summary {
    grid-template-columns: 1fr;
  }
}

.cvl-booking__photo {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--cvl-r-field);
  display: block;
}

.cvl-booking__title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.cvl-booking__desc {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--cvl-ink-soft);
}

.cvl-booking__total {
  padding: 12px 14px;
  background: var(--cvl-sunken);
  border-radius: var(--cvl-r-field);
}

.cvl-booking__form {
  padding: 18px;
  background: var(--cvl-surface);
  border: 1px solid var(--cvl-line);
  border-radius: var(--cvl-r-card);
}

.cvl-terms {
  max-height: 160px;
  overflow-y: auto;
  margin-top: 14px;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--cvl-ink-soft);
  background: var(--cvl-sunken);
  border: 1px solid var(--cvl-line-soft);
  border-radius: var(--cvl-r-field);
  white-space: pre-line;
}

.cvl-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 12px;
  font-size: 13.5px;
  cursor: pointer;
}

.cvl-check input {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: var(--cvl-brand);
  flex-shrink: 0;
}

.cvl-booking__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.cvl-booking__note {
  margin: 0;
  flex: 1;
  min-width: 220px;
  font-size: 12px;
  color: var(--cvl-ink-subtle);
}

/**
 * The honeypot. Positioned off-screen rather than `display:none`, because the
 * bots worth catching skip hidden fields — see the note in templates/booking.php.
 */
.cvl-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ── Notices & results ──────────────────────────────────── */

.cvl-notice {
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  border: 1px solid;
  border-radius: var(--cvl-r-field);
}

.cvl-notice--info {
  color: var(--cvl-info-strong);
  background: var(--cvl-info-tint);
  border-color: var(--cvl-info-tint-border);
}

.cvl-notice--warn {
  color: var(--cvl-warning-deep);
  background: var(--cvl-warning-tint);
  border-color: var(--cvl-warning-tint-border);
}

.cvl-notice--error {
  color: var(--cvl-brand-deep);
  background: var(--cvl-brand-tint);
  border-color: var(--cvl-brand-tint-border);
}

.cvl-result:empty {
  display: none;
}

.cvl-result {
  margin-top: 14px;
}

.cvl-result__ok {
  padding: 16px;
  color: var(--cvl-success-deep);
  background: var(--cvl-success-tint);
  border: 1px solid var(--cvl-success-tint-border);
  border-radius: var(--cvl-r-field);
}

.cvl-result__ref {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: #fff;
  border: 1px solid var(--cvl-success-tint-border);
  border-radius: var(--cvl-r-field);
}

/* ── Status lookup ──────────────────────────────────────── */

.cvl-status__form {
  margin-bottom: 16px;
}

.cvl-status__card {
  padding: 16px;
  background: var(--cvl-surface);
  border: 1px solid var(--cvl-line);
  border-radius: var(--cvl-r-card);
}

.cvl-status__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--cvl-line-soft);
}

.cvl-status__ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.cvl-status__head .cvl-badge {
  position: static;
}

.cvl-badge--pritje {
  background: var(--cvl-warning-tint);
  color: var(--cvl-warning-deep);
}

.cvl-badge--konfirmuar {
  background: var(--cvl-success-tint);
  color: var(--cvl-success-deep);
}

.cvl-badge--anuluar {
  background: var(--cvl-chip);
  color: var(--cvl-ink-muted);
}

.cvl-status__list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  margin: 14px 0 0;
  font-size: 13.5px;
}

.cvl-status__list dt {
  color: var(--cvl-ink-muted);
}

.cvl-status__list dd {
  margin: 0;
  font-weight: 600;
}

.cvl-status__note {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--cvl-ink-subtle);
}

/* ── Motion ─────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .cvl *,
  .cvl *::before,
  .cvl *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
