/* ========================================
   HUBSPOT LEGACY FORMS - ZENHR BRAND STYLING
   For forms created in legacy mode (v2.js)
   ======================================== */

/* ----------------------------------------
   Form Container
   ---------------------------------------- */

.hs-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Reset Webflow default list styles */
.hs-form ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

/* ----------------------------------------
   Field Wrapper
   ---------------------------------------- */

.hs-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

/* Phone field needs overflow visible for dropdown */
.hs-phone.hs-form-field {
  overflow: visible;
}

/* ----------------------------------------
   Labels
   ---------------------------------------- */

.hs-form-field label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #FFFFFF;
  line-height: 1.4;
}

/* Required Indicator (asterisk) */
.hs-form-required {
  color: #FCA5A5;
  margin-left: 2px;
}

/* ----------------------------------------
   Input Wrapper
   ---------------------------------------- */

.hs-form-field .input {
  position: relative;
  background-color: #FFFFFF;
  border-radius: 12px;
}

/* ----------------------------------------
   Text Inputs (text, email)
   ---------------------------------------- */

.hs-input[type="text"],
.hs-input[type="email"],
.hs-input[type="tel"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #0F0F0F;
  background-color: #FFFFFF;
  border: 1px solid #C9D3E6;
  border-radius: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}

.hs-input[type="text"]::placeholder,
.hs-input[type="email"]::placeholder,
.hs-input[type="tel"]::placeholder {
  color: #64748B;
}

.hs-input[type="text"]:hover,
.hs-input[type="email"]:hover,
.hs-input[type="tel"]:hover {
  border-color: #94A3B8;
}

.hs-input[type="text"]:focus,
.hs-input[type="email"]:focus,
.hs-input[type="tel"]:focus {
  border-color: #008483;
  box-shadow: 0 0 0 3px rgba(0, 132, 131, 0.15);
}

/* ----------------------------------------
   Phone Number Field (with country selector)
   ---------------------------------------- */

.hs-fieldtype-intl-phone {
  display: flex;
  align-items: stretch;
  border: 1px solid #C9D3E6 !important;
  border-radius: 12px;
  overflow: visible !important;
  background-color: #FFFFFF;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  z-index: 1;
}

.hs-fieldtype-intl-phone:focus-within {
  border-color: #008483 !important;
  box-shadow: 0 0 0 3px rgba(0, 132, 131, 0.15) !important;
  z-index: 2;
}

/* Country selector dropdown (native - hidden when JS enhanced) */
.hs-fieldtype-intl-phone select.hs-input {
  padding: 12px;
  padding-inline-end: 8px;
  background-color: #F8FAFC;
  border: none;
  border-inline-end: 1px solid #E2E8F0;
  border-radius: 0;
  font-size: 14px;
  color: #0F0F0F;
  cursor: pointer;
  transition: background-color 0.15s ease;
  min-width: 80px;
  flex-shrink: 0;
}

.hs-fieldtype-intl-phone select.hs-input:hover {
  background-color: #F1F5F9;
}

.hs-fieldtype-intl-phone select.hs-input:focus {
  outline: none;
  box-shadow: none;
}

/* ----------------------------------------
   Custom Searchable Phone Dropdown (JS Enhanced)
   ---------------------------------------- */

.hs-phone-custom-dropdown {
  position: static;
  flex-shrink: 0;
  width: 120px; /* Fixed width for consistency */
}

/* Selected value button */
.hs-phone-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  background-color: #F8FAFC;
  border: none !important;
  border-inline-end: 1px solid #E2E8F0 !important;
  border-radius: 12px 0 0 12px !important;
  font-size: 14px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #0F0F0F;
  cursor: pointer;
  transition: background-color 0.15s ease;
  width: 100%;
  box-shadow: none !important;
  outline: none !important;
  position: relative;
  z-index: 0;
}

/* RTL support for button border radius */
[dir="rtl"] .hs-phone-selected {
  border-radius: 0 12px 12px 0 !important;
}

.hs-phone-selected:hover {
  background-color: #F1F5F9;
}

.hs-phone-selected:focus,
.hs-phone-selected:active {
  border: none !important;
  border-inline-end: 1px solid #E2E8F0 !important;
  box-shadow: none !important;
  outline: none !important;
}

.hs-phone-selected svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

/* Rotate arrow when dropdown is open */
.hs-phone-custom-dropdown:has(.hs-phone-dropdown-panel.is-open) .hs-phone-selected svg {
  transform: rotate(180deg);
}

.hs-phone-selected-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

/* Dropdown panel */
.hs-phone-dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 280px;
  max-height: 320px;
  background-color: #FFFFFF;
  border: 1px solid #C9D3E6;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  z-index: 1001;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.hs-phone-dropdown-panel.is-open {
  display: flex;
}

/* Search input */
.hs-phone-search {
  padding: 12px;
  font-size: 14px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #0F0F0F;
  background-color: #FFFFFF;
  border: none;
  border-bottom: 1px solid #E2E8F0;
  outline: none;
}

.hs-phone-search::placeholder {
  color: #64748B;
}

.hs-phone-search:focus {
  background-color: #F8FAFC;
}

/* Options list */
.hs-phone-options {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

/* Custom scrollbar */
.hs-phone-options::-webkit-scrollbar {
  width: 8px;
}

.hs-phone-options::-webkit-scrollbar-track {
  background: #F8FAFC;
}

.hs-phone-options::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}

.hs-phone-options::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

/* Individual option */
.hs-phone-option {
  padding: 10px 12px;
  font-size: 14px;
  color: #0F0F0F;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.hs-phone-option:hover {
  background-color: #F8FAFC;
}

.hs-phone-option:active {
  background-color: #F1F5F9;
}

/* Selected option (current country) */
.hs-phone-option--selected {
  background-color: #CCFBF1;
  color: #008483;
  font-weight: 500;
}

.hs-phone-option--selected:hover {
  background-color: #99F6E4;
}

/* Phone number input inside the container */
.hs-fieldtype-intl-phone input[type="tel"].hs-input {
  border: none !important;
  border-radius: 0 12px 12px 0 !important;
  box-shadow: none !important;
  flex: 1;
  padding-inline-start: 12px;
  position: relative;
  z-index: 0;
}

/* RTL support for input border radius */
[dir="rtl"] .hs-fieldtype-intl-phone input[type="tel"].hs-input {
  border-radius: 12px 0 0 12px !important;
}

.hs-fieldtype-intl-phone input[type="tel"].hs-input:focus {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Hidden phone field (combined value) */
.hs-fieldtype-intl-phone input[type="hidden"] {
  display: none;
}

/* ----------------------------------------
   Submit Button
   ---------------------------------------- */

.hs-submit {
  margin-top: 8px;
}

.hs-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100% !important;
  padding: 16px 28px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  color: #FFFFFF;
  background-color: #008483;
  border: 1px solid transparent;
  border-radius: 32px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hs-button:hover {
  background-color: #006f6e;
}

.hs-button:active {
  transform: scale(0.98);
}

.hs-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 132, 131, 0.3);
}

.hs-button[disabled] {
  opacity: 0.7;
  pointer-events: none;
}

/* ----------------------------------------
   Error States
   ---------------------------------------- */

.hs-form-field .hs-error-msgs {
  margin-top: 4px;
}

.hs-error-msg,
.hs-error-msg.hs-main-font-element {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: #FCA5A5;
  background-color: rgba(220, 38, 38, 0.1);
  padding: 6px 10px;
  border-radius: 4px;
  margin: 4px 0 0 0;
  border-inline-start: 3px solid #DC2626;
}

/* Main form validation error label */
label.hs-main-font-element {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #DC2626;
  background-color: rgba(220, 38, 38, 0.1);
  padding: 12px 16px;
  border-radius: 8px;
  border-inline-start: 4px solid #DC2626;
}

.hs-input.error,
.hs-input.invalid {
  border-color: #DC2626;
}

.hs-input.error:focus,
.hs-input.invalid:focus {
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

/* ----------------------------------------
   Submitted State
   ---------------------------------------- */

.submitted-message {
  padding: 20px;
  background-color: #ECFDF5;
  border: 1px solid #10B981;
  border-radius: 8px;
  color: #065F46;
  font-size: 14px;
  text-align: center;
}

/* ----------------------------------------
   Field Description (helper text)
   ---------------------------------------- */

.hs-field-desc {
  font-size: 12px;
  color: #64748B;
  margin-top: 4px;
}

/* ----------------------------------------
   RTL Font Support (Arabic - Almarai)
   ---------------------------------------- */

[dir="rtl"] .hs-form,
[dir="rtl"] .hs-input[type="text"],
[dir="rtl"] .hs-input[type="email"],
[dir="rtl"] .hs-input[type="tel"],
[dir="rtl"] .hs-button,
[dir="rtl"] .hs-phone-selected,
[dir="rtl"] .hs-phone-search,
[dir="rtl"] .hs-phone-option,
[dir="rtl"] .hs-form-field label,
[dir="rtl"] .hs-error-msg {
  font-family: 'Almarai', 'Inter', system-ui, -apple-system, sans-serif;
}

/* ----------------------------------------
   Responsive Adjustments
   ---------------------------------------- */

@media (min-width: 640px) {
  .hs-button {
    width: 100% !important;
  }

  .hs-submit .actions {
    display: flex;
    justify-content: flex-start;
  }
}

/* ----------------------------------------
   Accessibility
   ---------------------------------------- */

/* High contrast mode support */
@media (prefers-contrast: high) {
  .hs-input[type="text"],
  .hs-input[type="email"],
  .hs-input[type="tel"],
  .hs-fieldtype-intl-phone {
    border-width: 2px;
  }

  .hs-button {
    border: 2px solid #006f6e;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hs-input[type="text"],
  .hs-input[type="email"],
  .hs-input[type="tel"],
  .hs-fieldtype-intl-phone,
  .hs-fieldtype-intl-phone select.hs-input,
  .hs-button {
    transition: none;
  }

  .hs-button:active {
    transform: none;
  }
}

/* Focus Visible (Keyboard Navigation) */
.hs-input[type="text"]:focus-visible,
.hs-input[type="email"]:focus-visible,
.hs-input[type="tel"]:focus-visible,
.hs-fieldtype-intl-phone select.hs-input:focus-visible,
.hs-button:focus-visible {
  outline: 2px solid #008483;
  outline-offset: 2px;
}
