/* ==========================================================================
   Book a Visit Modal - Based on Figma Design (Arabic/RTL)
   ========================================================================== */

/* Modal Overlay */
.book-visit-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.book-visit-modal.active {
  opacity: 1;
  pointer-events: all;
}

.book-visit-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.55);
  /* backdrop-filter removed: iOS Safari promotes it to a GPU compositing layer
     that renders above all fixed-position children regardless of z-index,
     making the ITI country picker permanently invisible on iOS. */
}

/* Modal Container */
.book-visit-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 500px;
  max-height: calc(100vh - 40px);
  background: #ffffff;
  border-radius: 8px;
  padding: 25px;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  margin: 0 16px;
  display: flex;
  flex-direction: column;
}

.book-visit-modal.active .book-visit-container {
  transform: scale(1);
}

/* Close Button */
.book-visit-close {
  position: absolute;
  top: 17px;
  left: 17px;
  width: 16px;
  height: 16px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: #6B7280;
  transition: color 0.2s ease;
  z-index: 10;
}

.book-visit-close:hover {
  color: #111827;
}

/* Header */
.book-visit-header {
  margin-bottom: 24px;
  flex-shrink: 0;
}

.book-visit-title {
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 10px 0;
  color: #0A0A0A;
  font-size: 18px;
}

.book-visit-subtitle {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.57;
  color: #717182;
  margin: 0;
  max-width: 420px;
}

/* Form */
.book-visit-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  padding-left: 8px;
  margin-left: -8px;
}

.book-visit-form::-webkit-scrollbar {
  width: 6px;
}

.book-visit-form::-webkit-scrollbar-track {
  background: transparent;
}

.book-visit-form::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 3px;
}

.book-visit-form::-webkit-scrollbar-thumb:hover {
  background: #9CA3AF;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  color: #0A0A0A;
  text-align: right;
}

.form-label .required {
  color: #DC2626;
}

.form-input,
.form-textarea {
  width: 100%;
  height: 40px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.43;
  color: #6A6A6A;
  background: #ffffff;
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  transition: border-color 0.2s ease;
  text-align: right;
}

  .form-input::placeholder,
  .form-textarea::placeholder {
    color: #6A6A6A;
  }

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: #111827;
}

.form-textarea {
  height: auto;
  min-height: 64px;
  resize: vertical;
}

/* Select Wrapper */
.select-wrapper {
  position: relative;
}

.select-wrapper .form-input {
  appearance: none;
  padding-left: 40px;
  cursor: pointer;
}

.select-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #6B7280;
}

/* Date Input Wrapper */
.date-input-wrapper {
  position: relative;
}

.date-input-wrapper .form-input {
  padding-left: 12px;
}

.date-input-wrapper .form-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
}

.date-icon {
  display: none;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-start;
  margin-top: 16px;
  flex-direction: row-reverse;
}

.btn {
  height: 44px;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.43;
  border-radius: 22px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn--cancel {
  background: transparent;
  color: #6B7280;
  border: 1px solid #D1D5DB;
}

.btn--cancel:hover {
  background: #F3F4F6;
  color: #111827;
}

.btn--submit {
  background: #111827;
  color: #ffffff;
  min-width: 137px;
}

.btn--submit:hover {
  background: #374151;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}

.btn--submit:disabled {
  background: #D1D5DB;
  cursor: not-allowed;
}

/* Form Message */
.form-message {
  padding: 12px 16px;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.43;
  margin-top: 16px;
  text-align: right;
}

.form-message.success {
  background: #D1FAE5;
  color: #065F46;
}

.form-message.error {
  background: #FEE2E2;
  color: #991B1B;
}

/* Responsive */
@media (max-width: 900px) {
  .book-visit-container {
    max-height: calc(90vh - 50px);
    width: calc(100% - 32px);
    padding: 20px;
  }

  .book-visit-header {
    margin-bottom: 24px;
  }

  .form-actions {
    flex-direction: column;
  } 
}

/* International Phone Input Overrides */

/* v26: fullscreen popup container is appended to body with z-index 1060 by default.
   Our modal is z-index 9999, so we must override to render above it. */
.iti--container {
  z-index: 10000 !important;
}

/* Fullscreen popup (mobile) – light theme */
.iti--fullscreen-popup.iti--container {
  background-color: rgba(0, 0, 0, 0.4);
  padding: 16px;
}

.iti--fullscreen-popup .iti__dropdown-content {
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  max-height: 75vh;
}

/* Search input – 36px right padding clears the search icon (moved to right for RTL). */
.book-visit-modal .iti__search-input,
.iti--container .iti__search-input {
  height: 48px;
  font-size: 16px;
  padding: 12px 36px 12px 16px;
  background-position: right 10px center;
  border-bottom: 1px solid #E0E0E0;
  box-sizing: border-box;
  width: 100%;
}

/* Desktop inline dropdown container */
.book-visit-modal .iti__dropdown-content {
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

/* Taller country list */
.book-visit-modal .iti__country-list,
.iti--fullscreen-popup .iti__country-list {
  max-height: 30vh;
}

.book-visit-modal .iti {
  width: 100%;
  display: block;
}

/* RTL: move country button to the right side, clear left position set by v26 */
.book-visit-modal .iti__selected-country {
  left: auto;
  right: 0;
  border: none;
  background-color: transparent;
}

/* RTL: right side reserved for flag + dial code button.
   !important beats v26's inline style (paddingRight set by JS after measuring the button). */
.book-visit-modal #visitPhoneDisplay {
  padding-right: 110px !important;
  padding-left: 12px !important;
}
