/* Contact Popup Styles */

/* Contact Popup Overlay */
.contact-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(19, 20, 25, 0.9);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: none; /* Start completely hidden */
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  /* Prevent mobile viewport shifting */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.contact-popup-overlay.active {
  display: flex;
  opacity: 1;
  visibility: visible;
}

/* Contact Popup Container */
.contact-popup-container {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.contact-popup-overlay.active .contact-popup-container {
  transform: scale(1) translateY(0);
}

/* Popup Header */
.contact-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px 32px 0;
  border-bottom: 1px solid #f1f6f9;
  margin-bottom: 32px;
  position: relative;
  z-index: 5;
}

.contact-popup-title {
  font-family: var(--font-primary);
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.2;
  color: var(--font-dark);
  margin: 0;
}

.contact-popup-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #6b7280;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.contact-popup-close:hover {
  background: #f5f6f8;
  color: #131419;
}

/* Popup Content */
.contact-popup-content {
  padding: 0 32px 32px;
}

.contact-popup-subtitle {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.7;
  color: #6b7280;
  margin: 0 0 32px;
}

/* Form Styles */
.popup-contact-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.popup-contact-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.popup-contact-form .form-group {
  display: flex;
  flex-direction: column;
}

.popup-contact-form label {
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--font-dark);
  margin-bottom: 8px;
  display: block;
}

.popup-contact-form input,
.popup-contact-form textarea,
.popup-contact-form input[type="text"],
.popup-contact-form input[type="tel"],
.popup-contact-form input[type="search"] {
  width: 100%;
  padding: 16px 0 !important;
  border: none;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 0;
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--font-dark);
  background: transparent;
  transition: all 0.2s ease;
  outline: none;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  pointer-events: auto;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

.popup-contact-form input::placeholder,
.popup-contact-form textarea::placeholder,
.popup-contact-form input[type="text"]::placeholder,
.popup-contact-form input[type="tel"]::placeholder,
.popup-contact-form input[type="search"]::placeholder {
  color: #9ca3af;
}

.popup-contact-form input:focus,
.popup-contact-form textarea:focus,
.popup-contact-form input[type="text"]:focus,
.popup-contact-form input[type="tel"]:focus,
.popup-contact-form input[type="search"]:focus {
  border-bottom-color: #FF002E !important;
  box-shadow: none;
}

.popup-contact-form input.-error,
.popup-contact-form textarea.-error,
.popup-contact-form input[type="text"].-error,
.popup-contact-form input[type="tel"].-error,
.popup-contact-form input[type="search"].-error {
  border-bottom-color: #ef4444 !important;
  box-shadow: none;
}

/* 3. Hide the empty per-field error span until you actually set .is-active */
.popup-contact-form .form__error {
  display: none;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: var(--font-primary);
  font-size: var(--text-xs);
  color: #ef4444;
  transition: all 0.2s ease;
}

.popup-contact-form .form__error.is-active {
  display: block;
  height: auto;
  margin-top: 4px;
  opacity: 1;
  transform: translateY(0);
}

.popup-contact-form .form-actions {
  margin-top: 8px;
  display: flex;
  justify-content: center;
}

/* Submit Button Styling */
.popup-submit-btn {
  background: #FF002E;
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 8px;
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  white-space: nowrap;
}

.popup-submit-btn:hover {
  background: #e6002a;
  transform: translateY(-1px);
}

/* 4. Collapse the "ajax-form-alert" area unless there's a message */
.popup-contact-form .ajax-form-alert {
  display: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all 0.3s ease;
}

.popup-contact-form .ajax-form-alert.is-active {
  display: block;
  margin-top: 16px;
  padding: 16px;
  opacity: 1;
  transform: translateY(0);
}

.ajax-form-alert.is-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.ajax-form-alert.is-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

/* Responsive Design */
@media (max-width: 768px) {
  .popup-contact-form .form-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .popup-contact-form {
    gap: 20px;
  }
  
  /* Prevent mobile zoom by ensuring 16px minimum font size for inputs only */
  .popup-contact-form input,
  .popup-contact-form textarea,
  .popup-contact-form input[type="text"],
  .popup-contact-form input[type="tel"],
  .popup-contact-form input[type="search"] {
    font-size: 16px !important;
    transform: translateZ(0); /* Force hardware acceleration to prevent shake */
    -webkit-appearance: none; /* Remove iOS styling */
    appearance: none; /* Standard property for compatibility */
  }
}

@media (max-width: 480px) {
  .contact-popup-header {
    padding: 20px 20px 0;
    margin-bottom: 20px;
  }
  
  .contact-popup-title {
    font-size: var(--text-xl);
    line-height: 1.2;
  }
  
  .contact-popup-content {
    padding: 0 20px 20px;
  }
  
  .popup-submit-btn {
    padding: 16px 24px;
    min-width: auto;
  }
  
  /* Prevent mobile shake during input focus */
  .contact-popup-container {
    position: relative;
    transform: none !important;
    margin: 20px;
    max-height: calc(100vh - 40px);
  }
  
  .contact-popup-overlay.active .contact-popup-container {
    transform: none !important;
  }
}