/**
 * Lead Modal Styles
 * Pre-booking questionnaire modal with AI integration
 */

/* Modal Backdrop */
.lead-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
  animation: modalFadeIn 0.3s ease-out;
}

.lead-modal.hidden {
  display: none;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Modal Content Container */
.lead-modal-content {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  position: relative;
  animation: modalSlideIn 0.3s ease-out;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Close Button */
.lead-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  transition: color 0.2s ease;
}

.lead-modal-close:hover {
  color: #333;
}

/* Modal Title */
.lead-modal-content h2 {
  font-family: var(--font-serif, 'Playfair Display', serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: #1A1F36;
  margin-bottom: 1.5rem;
  padding-right: 2rem;
}

/* Form Inputs */
#lead-form input,
#lead-form select,
#lead-form textarea {
  width: 100%;
  padding: 0.75rem;
  margin: 0.5rem 0;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 1rem;
  font-family: var(--font-sans, 'Inter', sans-serif);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #fff;
}

#lead-form input:focus,
#lead-form select:focus,
#lead-form textarea:focus {
  outline: none;
  border-color: #B2BDA3;
  box-shadow: 0 0 0 3px rgba(178, 189, 163, 0.2);
}

#lead-form input::placeholder,
#lead-form textarea::placeholder {
  color: #999;
}

#lead-form textarea {
  min-height: 80px;
  resize: vertical;
}

/* Submit Button */
#lead-form .btn-primary {
  background: linear-gradient(135deg, #B2BDA3, #a0b18f);
  color: #fff;
  border: none;
  padding: 0.875rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  width: 100%;
  margin-top: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(178, 189, 163, 0.3);
}

#lead-form .btn-primary:hover {
  background: linear-gradient(135deg, #a0b18f, #8fa07d);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(178, 189, 163, 0.4);
}

#lead-form .btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Loading State */
#lead-form .btn-primary.loading {
  position: relative;
  color: transparent;
}

#lead-form .btn-primary.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* AI Follow-Up Message */
.lead-ai-message {
  font-size: 0.95rem;
  color: #2a2a2a;
  margin-top: 1rem;
  padding: 1rem;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 8px;
  border-left: 4px solid #B2BDA3;
  animation: messageSlideIn 0.4s ease-out;
}

.lead-ai-message.hidden {
  display: none;
}

/* AI Message Content */
.ai-message-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ai-message-content p {
  margin: 0;
  line-height: 1.5;
}

/* AI Copy Container */
.ai-copy-container {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0;
}

.ai-copy-button {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.ai-copy-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #45a049, #3d8b40);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.ai-copy-button:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* AI Preview Container */
.ai-preview-container {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: white;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
}

.ai-preview-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #666;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ai-preview-message {
  font-size: 0.9rem;
  color: #333;
  line-height: 1.4;
  padding: 0.5rem;
  background: #f9f9f9;
  border-radius: 4px;
  border-left: 3px solid #25D366; /* WhatsApp green */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  white-space: pre-wrap;
  word-wrap: break-word;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Privacy Notice */
.lead-modal-privacy {
  font-size: 0.75rem;
  color: #888;
  text-align: center;
  margin-top: 1rem;
}

.lead-modal-privacy a {
  color: #B2BDA3;
  text-decoration: underline;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .lead-modal-content {
    padding: 1.5rem;
    width: 95%;
    border-radius: 8px;
  }

  .lead-modal-content h2 {
    font-size: 1.25rem;
  }

  #lead-form input,
  #lead-form select,
  #lead-form textarea {
    padding: 0.625rem;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  #lead-form .btn-primary {
    padding: 0.75rem 1.25rem;
  }
}

/* AI Sales Kit Styles */
.ai-box {
  background: #111;
  color: #fff;
  padding: 16px;
  border-radius: 10px;
  margin: 10px 0;
  border-left: 4px solid #B2BDA3;
}

.ai-box h5 {
  margin: 0 0 8px 0;
  font-size: 0.9rem;
  color: #B2BDA3;
  font-weight: 600;
}

.ai-box p {
  margin: 0 0 12px 0;
  line-height: 1.4;
  white-space: pre-wrap;
  font-size: 0.9rem;
}

.ai-box button {
  margin-right: 8px;
  margin-top: 10px;
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.ai-box button:first-of-type {
  background: #4CAF50;
  color: white;
}

.ai-box button:first-of-type:hover {
  background: #45a049;
}

.ai-box button:last-of-type {
  background: #25D366;
  color: white;
}

.ai-box button:last-of-type:hover {
  background: #1da851;
}

.sales-kit-container {
  margin-top: 1rem;
  max-height: 300px;
  overflow-y: auto;
  padding: 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #f9f9f9;
}

.sales-kit-container h4 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  color: #333;
  font-weight: 600;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .lead-modal,
  .lead-modal-content,
  .lead-ai-message {
    animation: none;
  }
}

/* Mobile Optimization - Simplify Lead Form */
@media (max-width: 768px) {
  /* Hide complex fields on mobile to reduce friction */
  #lead-form select[name="service"],
  #lead-form select[name="budget"],
  #lead-form textarea[name="challenge"] {
    display: none !important;
  }
  
  /* Show essential fields only */
  #lead-form input[name="name"],
  #lead-form input[name="phone"],
  #lead-form input[name="business"] {
    display: block !important;
  }
  
  /* Improve touch targets for mobile */
  #lead-form input,
  #lead-form button[type="submit"] {
    min-height: 48px !important;
    font-size: 16px !important; /* Prevents iOS zoom */
    padding: 14px 16px !important;
    width: 100% !important;
  }
  
  /* Adjust modal for mobile */
  .lead-modal-content {
    width: 95% !important;
    max-width: 95% !important;
    padding: 1.5rem !important;
    margin: 1rem !important;
    max-height: 85vh !important;
  }
  
  .lead-modal-content h2 {
    font-size: 1.25rem !important;
    margin-bottom: 1rem !important;
  }
  
  /* Increase spacing between form elements */
  #lead-form > * {
    margin-bottom: 16px !important;
  }
  
  /* Make submit button more prominent */
  #lead-form button[type="submit"] {
    background: #2563eb !important;
    color: white !important;
    font-weight: 600 !important;
    font-size: 1.1rem !important;
    border-radius: 8px !important;
    border: none !important;
    margin-top: 1rem !important;
  }
  
  /* Adjust close button for mobile */
  .lead-modal-close {
    font-size: 2rem !important;
    top: 0.5rem !important;
    right: 0.5rem !important;
    min-height: 44px !important;
    min-width: 44px !important;
  }
}

/* Trust signals styling */
.trust {
  font-size: 13px;
  opacity: 0.7;
  margin-top: 10px;
  color: #666;
  line-height: 1.4;
}

.trust div {
  margin-bottom: 4px;
}

.trust div:before {
  content: "✅ ";
  margin-right: 4px;
}

/* Input validation feedback */
.input.valid {
  border: 2px solid #B2BDA3 !important;
}

.input.error {
  border: 2px solid #ff6b6b !important;
}

/* Business type options for micro-commitment step */
.business-type-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.business-type-option {
  padding: 14px 16px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  background: white;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.business-type-option:hover {
  border-color: #B2BDA3;
  background: #f8f9fa;
}

.business-type-option.selected {
  border-color: #B2BDA3;
  background: #f0f4e8;
  font-weight: 600;
}

/* Modal subtext styling */
.modal-subtext {
  font-size: 14px;
  color: #666;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* Mobile sticky CTA */
@media (max-width: 768px) {
  .lead-modal-content {
    position: relative;
    padding-bottom: 80px !important;
  }
  
  .cta-button {
    position: sticky !important;
    bottom: 20px !important;
    z-index: 10 !important;
    background: #B2BDA3 !important;
    color: white !important;
    font-weight: 600 !important;
    padding: 16px !important;
    border-radius: 8px !important;
    border: none !important;
    width: 100% !important;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1) !important;
  }
}
