/* HelpBix Lead Form Modal Styles - Modern Professional Mobile-First Design */

/* Base Modal Styles */
.helpbix-lead-modal {
  z-index: 99999;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  animation: modalFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.helpbix-lead-modal.closing {
  animation: modalFadeOut 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from { 
    opacity: 0; 
    transform: translateY(30px) scale(0.9); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  }
}

@keyframes modalFadeOut {
  from { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  }
  to { 
    opacity: 0; 
    transform: translateY(30px) scale(0.9); 
  }
}

/* Backdrop - No click to dismiss */
.helpbix-lead-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  animation: backdropFadeIn 0.4s ease;
  /* Remove pointer events to prevent dismissal on backdrop click */
  pointer-events: none;
}

@keyframes backdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Modal Content */
.helpbix-lead-modal-content {
  position: relative;
  z-index: 2;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  padding: 0;
  max-width: 95vw;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  animation: contentSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  margin: 20px;
}

@keyframes contentSlideIn {
  from { 
    opacity: 0; 
    transform: translateY(50px) scale(0.85); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  }
}

/* Close Button - Only way to dismiss */
.helpbix-lead-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.helpbix-lead-modal-close:hover {
  background: #ef4444;
  color: white;
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.helpbix-lead-modal-close:active {
  transform: scale(0.95) rotate(90deg);
}

/* Header Section */
.helpbix-lead-modal-header {
  text-align: center;
  padding: 40px 32px 32px 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

.helpbix-lead-modal-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.3;
}

.helpbix-lead-modal-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.2;
  position: relative;
  z-index: 1;
  letter-spacing: -0.02em;
}

.helpbix-lead-modal-subtitle {
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 400;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

/* Form Wrapper */
.helpbix-lead-form-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  background: #ffffff;
}

.helpbix-lead-form-wrapper form {
  padding-bottom: 16px; /* Extra bottom padding */
}

.helpbix-lead-form-wrapper::-webkit-scrollbar {
  width: 6px;
}

.helpbix-lead-form-wrapper::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.helpbix-lead-form-wrapper::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* Form */
.helpbix-lead-form {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Field Styles - Fixed spacing and modern design */
.helpbix-lead-field {
  position: relative;
  display: flex;
  flex-direction: column;
  margin-bottom: 0; /* Remove default margin */
  min-height: 80px; /* Ensure consistent field height */
}

.helpbix-lead-field input,
.helpbix-lead-field textarea,
.helpbix-lead-field select {
  width: 100%;
  padding: 20px 24px;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  font-size: 1rem;
  background: #ffffff;
  color: #1e293b;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
  min-height: 60px;
}

.helpbix-lead-field input:focus,
.helpbix-lead-field textarea:focus,
.helpbix-lead-field select:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  background: #ffffff;
  transform: translateY(-2px);
}

.helpbix-lead-field input:invalid:not(:placeholder-shown),
.helpbix-lead-field textarea:invalid:not(:placeholder-shown) {
  border-color: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

/* Floating Labels - Enhanced positioning */
.helpbix-lead-field label {
  position: absolute;
  left: 24px;
  top: 20px;
  color: #94a3b8;
  font-size: 1rem;
  font-weight: 500;
  background: transparent;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2;
  padding: 0 8px;
  border-radius: 4px;
}

.helpbix-lead-field input:focus + label,
.helpbix-lead-field input:not(:placeholder-shown) + label,
.helpbix-lead-field textarea:focus + label,
.helpbix-lead-field textarea:not(:placeholder-shown) + label,
.helpbix-lead-field select:focus + label,
.helpbix-lead-field select:not([value=""]):not(:focus):not(:placeholder-shown) + label {
  top: -12px;
  left: 20px;
  font-size: 0.875rem;
  color: #667eea;
  background: #ffffff;
  font-weight: 600;
  transform: scale(0.9);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.helpbix-lead-field input:invalid:not(:placeholder-shown) + label,
.helpbix-lead-field textarea:invalid:not(:placeholder-shown) + label {
  color: #ef4444;
}

/* Textarea specific */
.helpbix-lead-field textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
  padding-top: 24px;
  padding-bottom: 24px;
  margin-bottom: 8px; /* Extra spacing for textarea */
}

/* Select specific */
.helpbix-lead-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 20px center;
  background-repeat: no-repeat;
  background-size: 20px;
  padding-right: 60px;
}

/* Submit Button - Modern gradient design */
.helpbix-lead-submit-wrapper {
  margin-top: 16px;
  padding-top: 8px;
}

.helpbix-lead-submit {
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  border: none;
  border-radius: 16px;
  padding: 20px 32px;
  font-size: 1.125rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  min-height: 64px;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.helpbix-lead-submit::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.helpbix-lead-submit:hover::before {
  left: 100%;
}

.helpbix-lead-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

.helpbix-lead-submit:active:not(:disabled) {
  transform: translateY(-1px);
}

.helpbix-lead-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Loading Animation */
.loading-spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Success State */
.helpbix-lead-success {
  text-align: center;
  padding: 48px 32px;
  animation: successFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes successFadeIn {
  from { 
    opacity: 0; 
    transform: scale(0.8) translateY(20px); 
  }
  to { 
    opacity: 1; 
    transform: scale(1) translateY(0); 
  }
}

.success-icon {
  color: #10b981;
  margin-bottom: 24px;
  animation: successIconBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes successIconBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.success-message {
  font-size: 1.25rem;
  color: #1e293b;
  font-weight: 700;
  line-height: 1.4;
}

/* Error State */
.helpbix-lead-error {
  background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  animation: errorSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.1);
}

@keyframes errorSlideIn {
  from { 
    opacity: 0; 
    transform: translateY(-20px) scale(0.95); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  }
}

.error-icon {
  color: #ef4444;
  flex-shrink: 0;
  animation: errorIconShake 0.5s ease;
}

@keyframes errorIconShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.error-message {
  color: #dc2626;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
}

/* Mobile-First Responsive Design */
@media (max-width: 640px) {
  .helpbix-lead-modal-content {
    width: calc(100vw - 40px);
    max-width: calc(100vw - 40px);
    margin: 20px;
    border-radius: 20px;
    max-height: calc(100vh - 40px);
  }
  
  .helpbix-lead-modal-header {
    padding: 32px 24px 24px 24px;
  }
  
  .helpbix-lead-modal-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }
  
  .helpbix-lead-modal-subtitle {
    font-size: 0.95rem;
  }
  
  .helpbix-lead-form-wrapper {
    padding: 24px;
  }
  
  .helpbix-lead-form {
    gap: 28px;
  }
  
  .helpbix-lead-field {
    min-height: 72px; /* Slightly smaller on mobile */
  }
  
  .helpbix-lead-field input,
  .helpbix-lead-field textarea,
  .helpbix-lead-field select {
    padding: 18px 20px;
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 56px;
    border-radius: 14px;
  }
  
  .helpbix-lead-field label {
    left: 20px;
    top: 18px;
    font-size: 16px;
  }
  
  .helpbix-lead-field input:focus + label,
  .helpbix-lead-field input:not(:placeholder-shown) + label,
  .helpbix-lead-field textarea:focus + label,
  .helpbix-lead-field textarea:not(:placeholder-shown) + label,
  .helpbix-lead-field select:focus + label,
  .helpbix-lead-field select:not([value=""]):not(:focus):not(:placeholder-shown) + label {
    left: 16px;
    font-size: 14px;
  }
  
  .helpbix-lead-submit {
    padding: 18px 24px;
    font-size: 1.125rem;
    min-height: 56px;
    border-radius: 14px;
  }
  
  .helpbix-lead-modal-close {
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
  
  .success-icon {
    margin-bottom: 20px;
  }
  
  .success-message {
    font-size: 1.125rem;
  }
}

/* Tablet Optimizations */
@media (min-width: 641px) and (max-width: 1024px) {
  .helpbix-lead-modal-content {
    width: 500px;
    max-width: 90vw;
  }
  
  .helpbix-lead-modal-header {
    padding: 36px 28px 28px 28px;
  }
  
  .helpbix-lead-form-wrapper {
    padding: 28px;
  }
}

/* Desktop Enhancements */
@media (min-width: 1025px) {
  .helpbix-lead-modal-content {
    width: 480px;
    max-width: 480px;
  }
  
  .helpbix-lead-modal-header {
    padding: 44px 36px 36px 36px;
  }
  
  .helpbix-lead-form-wrapper {
    padding: 36px;
  }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .helpbix-lead-modal-content {
    box-shadow: 
      0 25px 50px -12px rgba(0, 0, 0, 0.25),
      0 0 0 1px rgba(255, 255, 255, 0.1);
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .helpbix-lead-modal,
  .helpbix-lead-modal-content,
  .helpbix-lead-field input,
  .helpbix-lead-field textarea,
  .helpbix-lead-field select,
  .helpbix-lead-field label,
  .helpbix-lead-submit,
  .helpbix-lead-modal-close {
    animation: none;
    transition: none;
  }
  
  .loading-spinner {
    animation: none;
  }
  
  .success-icon {
    animation: none;
  }
  
  .error-icon {
    animation: none;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .helpbix-lead-modal-content {
    background: #1a1a1a;
    color: #f8fafc;
  }
  
  .helpbix-lead-modal-header {
    background: linear-gradient(135deg, #4c1d95 0%, #7c3aed 100%);
  }
  
  .helpbix-lead-modal-title {
    color: #f8fafc;
  }
  
  .helpbix-lead-modal-subtitle {
    color: rgba(248, 250, 252, 0.9);
  }
  
  .helpbix-lead-field input,
  .helpbix-lead-field textarea,
  .helpbix-lead-field select {
    background: #262626;
    border-color: #404040;
    color: #f8fafc;
  }
  
  .helpbix-lead-field input:focus,
  .helpbix-lead-field textarea:focus,
  .helpbix-lead-field select:focus {
    border-color: #7c3aed;
    background: #262626;
  }
  
  .helpbix-lead-field label {
    color: #a3a3a3;
    background: #1a1a1a;
  }
  
  .helpbix-lead-field input:focus + label,
  .helpbix-lead-field input:not(:placeholder-shown) + label,
  .helpbix-lead-field textarea:focus + label,
  .helpbix-lead-field textarea:not(:placeholder-shown) + label,
  .helpbix-lead-field select:focus + label,
  .helpbix-lead-field select:not([value=""]):not(:focus):not(:placeholder-shown) + label {
    background: #1a1a1a;
  }
  
  .helpbix-lead-modal-close {
    background: rgba(38, 38, 38, 0.9);
    color: #a3a3a3;
  }
  
  .helpbix-lead-modal-close:hover {
    background: #ef4444;
    color: white;
  }
  
  .helpbix-lead-submit {
    background: linear-gradient(135deg, #7c3aed 0%, #4c1d95 100%);
  }
  
  .helpbix-lead-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%);
  }
} 