/* ═══════════════════════════════════════
   CLEN | كلن — Booking Step 1 — OTP
   ═══════════════════════════════════════ */

/* ─── OTP flow container ─── */
.booking-step--otp {
  margin-block-end: 0;
}

.otp-panels {
  position: relative;
  min-height: clamp(260px, 42vh, 340px);
}

/* ─── Panel states + fade transition ─── */
.otp-panel {
  opacity: 0;
  visibility: hidden;
  position: absolute;
  inset: 0;
  transition: opacity 0.28s ease, visibility 0.28s ease;
  pointer-events: none;
}

.otp-panel.is-active {
  opacity: 1;
  visibility: visible;
  position: relative;
  pointer-events: auto;
}

.otp-panel.is-leaving {
  opacity: 0;
  visibility: hidden;
  position: absolute;
  pointer-events: none;
}

.otp-panel.is-entering {
  opacity: 0;
  visibility: visible;
  position: relative;
}

.otp-panel__title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  text-align: right;
  margin-block-end: var(--space-2);
  line-height: 1.3;
}

.otp-panel__subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  text-align: right;
  margin-block-end: var(--space-8);
  line-height: 1.5;
}

.otp-panel__subtitle strong {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
}

.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-primary);
  font-size: var(--font-size-sm);
  text-decoration: none;
  margin-bottom: var(--space-4);
}

#otp-panel-phone .btn-back-home {
  margin-bottom: var(--space-3);
}

/* ─── Phone field (RTL: +966 on the right) ─── */
.otp-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  text-align: right;
  margin-block-end: var(--space-3);
}

.otp-phone-field {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  direction: rtl;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--color-surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.otp-phone-field:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.otp-phone-field--error {
  border-color: var(--color-error);
}

.otp-phone-field--error:focus-within {
  box-shadow: 0 0 0 3px var(--color-error-bg);
}

.otp-phone-field__code {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-inline: var(--space-4);
  background-color: var(--color-surface-tint);
  border-inline-start: 1px solid var(--color-border);
  flex-shrink: 0;
}

.otp-phone-field__flag {
  display: block;
  width: 24px;
  height: 18px;
  object-fit: cover;
  border-radius: 2px;
}

.otp-phone-field__prefix {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  direction: ltr;
}

.otp-phone-field__input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  padding: var(--space-4) var(--space-4);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  background: transparent;
  direction: ltr;
  text-align: left;
}

.otp-phone-field__input::placeholder {
  color: var(--color-text-muted);
}

/* ─── Submit button ─── */
.otp-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  margin-block-start: var(--space-8);
  padding: var(--space-4) var(--space-6);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-on-primary);
  background-color: var(--color-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  min-height: 48px;
}

.otp-submit:hover {
  background-color: var(--color-primary-dark);
}

.otp-submit__icon {
  display: block;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
}

#otp-confirm-btn {
  margin-block-start: var(--space-6);
  margin-block-end: var(--space-2);
}

/* ─── OTP digit inputs (LTR entry) ─── */
.otp-digits {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: var(--space-3);
  direction: ltr;
  margin-block-end: var(--space-4);
}

.otp-digit {
  width: var(--otp-digit-size);
  height: var(--otp-digit-size);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: clamp(18px, 4.5vw, 24px);
  font-weight: var(--font-weight-bold);
  text-align: center;
  color: var(--color-text-primary);
  background-color: var(--color-surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  padding: 0;
  direction: ltr;
}

.otp-digit:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.otp-digit--error {
  border-color: var(--color-error);
}

.otp-digits--error {
  animation: otp-shake 0.45s ease;
}

@keyframes otp-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* ─── Errors ─── */
.otp-error {
  font-size: var(--font-size-sm);
  color: var(--color-error);
  text-align: right;
  margin-block-start: var(--space-2);
  margin-block-end: 0;
  line-height: 1.4;
}

/* ─── Resend — one line, centered ─── */
.otp-resend {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-block-start: var(--space-6);
  text-align: center;
  width: 100%;
}

#otp-timer-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  white-space: nowrap;
}

.otp-timer {
  color: var(--color-primary);
  font-weight: var(--font-weight-bold);
}

.otp-resend__btn {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.otp-resend__btn:hover {
  color: var(--color-primary-dark);
}

.otp-resend-ready {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  white-space: nowrap;
}

/* ─── Sent-to row — one line, right-aligned ─── */
.otp-sent-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  direction: rtl;
  margin-block-end: var(--space-8);
  text-align: right;
  width: 100%;
  overflow: hidden;
}

.otp-sent-row__label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  white-space: nowrap;
  flex-shrink: 0;
}

.otp-sent-row__phone {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  direction: ltr;
  white-space: nowrap;
  flex-shrink: 0;
}

.otp-change-phone {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.otp-change-phone:hover {
  color: var(--color-primary-dark);
}

/* Hide footer on OTP step — flow is self-contained */
.booking-footer--hidden {
  display: none;
}

.booking-app:has(#booking-footer.booking-footer--hidden) .booking-main.app__main--no-navbar {
  padding-block-end: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
}

.booking-app:has(#booking-footer.booking-footer--hidden) .booking-spacer {
  height: 0;
}

@media (min-width: 768px) {
  .otp-digits {
    gap: var(--space-4);
  }

  .otp-submit {
    min-height: 52px;
    font-size: var(--font-size-md, 16px);
  }
}

@media (min-width: 1200px) {
  .otp-panels {
    min-height: 320px;
  }

  .otp-submit {
    max-width: 400px;
    margin-inline: auto;
    margin-block-start: var(--space-10);
  }
}

