/*
 * O To Tuan - Car Search CTA
 * Scoped styles for the sticky shortcode button and lazy-loaded modal.
 */

:root {
  --ott-car-search-red: #C8102E;
  --ott-car-search-red-dark: #9f0d25;
  --ott-car-search-white: #ffffff;
  --ott-car-search-surface: #ffffff;
  --ott-car-search-text: #1a1a1a;
  --ott-car-search-muted: #666666;
  --ott-car-search-border: rgba(200, 16, 46, 0.18);
  --ott-car-search-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
  --ott-car-search-focus: rgba(200, 16, 46, 0.26);
  --ott-car-search-radius: 12px;
  --ott-car-search-float-size: 52px;
  --ott-car-search-cta-bottom: 132px;
  --ott-car-search-cta-z: 9890;
  --ott-car-search-modal-z: 99998;
}

.ott-car-search-cta {
  position: fixed;
  right: 10px;
  bottom: var(--ott-car-search-cta-bottom);
  z-index: var(--ott-car-search-cta-z);
  max-width: min(260px, calc(100vw - 32px));
  bottom: 70px;
}

.ott-car-search-cta__button {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  max-width: min(260px, calc(100vw - 32px));
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--ott-car-search-red);
  color: var(--ott-car-search-white);
  box-shadow: 0 8px 22px rgba(200, 16, 46, 0.38);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
  transform: translateY(0);
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.ott-car-search-cta__button:hover,
.ott-car-search-cta__button:focus-visible {
  background: var(--ott-car-search-red-dark);
  box-shadow: 0 10px 26px rgba(200, 16, 46, 0.46);
  transform: translateY(-2px);
}

.ott-car-search-cta__button:active {
  transform: translateY(0) scale(0.98);
}

.ott-car-search-cta__button:focus-visible {
  outline: 3px solid var(--ott-car-search-focus);
  outline-offset: 3px;
}

.ott-car-search-cta__button.is-loading {
  cursor: wait;
  opacity: 0.88;
}

.ott-car-search-cta__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.ott-car-search-cta__icon svg {
  width: 18px;
  height: 18px;
}

.ott-car-search-cta__label {
  overflow-wrap: anywhere;
}

.ott-car-search-modal[hidden] {
  display: none;
}

.ott-car-search-modal {
  position: fixed;
  inset: 0;
  z-index: var(--ott-car-search-modal-z);
}

.ott-car-search-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.52);
  backdrop-filter: blur(2px);
}

.ott-car-search-modal__dialog {
  position: relative;
  width: min(640px, calc(100vw - 32px));
  margin: max(40px, 8vh) auto;
  background: var(--ott-car-search-surface);
  border-radius: 18px;
  border: 1px solid rgba(17, 17, 17, 0.06);
  box-shadow: var(--ott-car-search-shadow);
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  animation: ott-car-search-modal-in 0.2s ease forwards;
}

.ott-car-search-modal__content {
  padding: 34px 30px 28px;
}

.ott-car-search-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border: 1px solid #FFE6E6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--ott-car-search-white);
  color: var(--ott-car-search-red);
  box-shadow: 0 10px 26px rgba(17, 17, 17, 0.1);
  font-size: 26px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transform: scale(1);
  transition: border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.ott-car-search-modal__close:hover,
.ott-car-search-modal__close:focus-visible {
  border-color: #FFC7C7;
  color: var(--ott-car-search-red-dark);
  box-shadow: 0 12px 30px rgba(17, 17, 17, 0.14);
  transform: scale(1.04);
}

.ott-car-search-modal__close:active {
  transform: scale(0.98);
}

.ott-car-search-modal__close:focus-visible {
  outline: 3px solid var(--ott-car-search-focus);
  outline-offset: 2px;
}

.ott-car-search-modal__header {
  margin: 0 52px 26px 0;
}

.ott-car-search-modal__eyebrow {
  margin: 0 0 10px;
  color: var(--ott-car-search-red);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ott-car-search-modal__title {
  margin: 0;
  color: var(--ott-car-search-text);
  font-size: 28px;
  font-weight: 900;
  line-height: 1.14;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.ott-car-search-modal__description {
  margin: 16px 0 0;
  color: var(--ott-car-search-text);
  font-size: 16px;
  line-height: 1.55;
}

.ott-car-search-form {
  display: grid;
  gap: 18px;
}

.ott-car-search-form__field {
  display: grid;
  gap: 8px;
}

.ott-car-search-form__field label {
  color: var(--ott-car-search-text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.ott-car-search-form__field select {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid #E5E5E5;
  border-radius: 12px;
  background: #fff;
  color: var(--ott-car-search-text);
  font: inherit;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ott-car-search-form__field select.has-error {
  border-color: rgba(200, 16, 46, 0.68);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.08);
}

.ott-car-search-form__error {
  margin: 2px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(200, 16, 46, 0.18);
  border-radius: var(--ott-car-search-radius);
  background: rgba(200, 16, 46, 0.06);
  color: var(--ott-car-search-red);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.ott-car-search-form__error[hidden] {
  display: none;
}

.ott-car-search-form__field select:focus {
  border-color: rgba(200, 16, 46, 0.48);
  outline: 3px solid rgba(200, 16, 46, 0.14);
  outline-offset: 0;
}

.ott-car-search-form__field select:disabled {
  color: var(--ott-car-search-muted);
  cursor: not-allowed;
  opacity: 0.72;
}

.ott-car-search-form__submit {
  min-height: 48px;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--ott-car-search-radius);
  background: var(--ott-car-search-red);
  color: var(--ott-car-search-white);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(200, 16, 46, 0.3);
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.ott-car-search-form__submit:hover,
.ott-car-search-form__submit:focus-visible {
  background: var(--ott-car-search-red-dark);
  box-shadow: 0 10px 24px rgba(200, 16, 46, 0.36);
}

.ott-car-search-form__submit-icon,
.ott-car-search-form__submit-icon svg {
  width: 18px;
  height: 18px;
}

.ott-car-search-form__submit:active {
  transform: translateY(1px);
}

.ott-car-search-form__submit:focus-visible {
  outline: 3px solid var(--ott-car-search-focus);
  outline-offset: 3px;
}

body.ott-car-search-modal-open {
  overflow: hidden;
}

@keyframes ott-car-search-modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 767px) {
  :root {
    --ott-car-search-cta-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
  }

  .ott-car-search-cta {
    right: 14px;
    bottom: var(--ott-car-search-cta-bottom);
    left: auto;
    width: auto;
    max-width: none;
  }

  .ott-car-search-cta__button {
    width: auto;
    min-width: 104px;
    height: 46px;
    min-height: 46px;
    max-width: none;
    padding: 0 14px;
    border-radius: 999px;
    gap: 7px;
    box-shadow: 0 8px 22px rgba(200, 16, 46, 0.38);
  }

  .ott-car-search-cta__button:hover,
  .ott-car-search-cta__button:focus-visible {
    box-shadow: 0 10px 26px rgba(200, 16, 46, 0.46);
  }

  .ott-car-search-cta__icon,
  .ott-car-search-cta__icon svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
  }

  .ott-car-search-cta__label {
    font-size: 0;
    line-height: 1;
  }

  .ott-car-search-cta__label::after {
    content: "Tìm xe";
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
  }

  .ott-car-search-modal__dialog {
    width: min(560px, calc(100vw - 20px));
    margin: 16px auto calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .ott-car-search-modal__content {
    padding: 24px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .ott-car-search-modal__close {
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
  }

  .ott-car-search-modal__header {
    margin-right: 48px;
  }

  .ott-car-search-modal__title {
    font-size: 23px;
  }

  .ott-car-search-modal__description {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ott-car-search-cta__button,
  .ott-car-search-modal__close,
  .ott-car-search-form__submit,
  .ott-car-search-modal__dialog {
    animation: none;
    transition: none;
  }
}
