/**
 * ModernMail Form Core Styles
 * Essential styles for form functionality
 */

/* ===== FORM CONTAINER ===== */
#payment-form {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  contain: layout style paint;
  will-change: transform, opacity;
  /* Prevent zoom on mobile */
  touch-action: manipulation;
}

#payment-form * {
  box-sizing: border-box;
}

/* ===== HIDE DEFAULT FILE INPUT ===== */
#payment-form #upload-button,
#payment-form input[type="file"] {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: auto !important;
  visibility: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  overflow: hidden !important;
  z-index: -1 !important;
}

/* ===== NAVIGATION ===== */
.form-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  padding: 1rem;
  background: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Step 1 specific navigation - Next button on the right */
.form-navigation.step-1 {
  justify-content: flex-end;
}

.nav-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #f3f4f6;
  color: #6b7280;
  line-height: 1;
}

.nav-button:hover:not(:disabled) {
  background: #e5e7eb;
  transform: translateY(-1px);
}

.nav-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Disable hover effects when button is disabled */
.nav-button:disabled:hover,
.nav-button.disabled:hover {
  transform: none !important;
  box-shadow: none !important;
  filter: none !important;
  background: #f3f4f6 !important;
  color: #6b7280 !important;
}

.nav-next,
.nav-submit {
  background: linear-gradient(135deg, #f06666 0%, #e61145 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(240, 102, 102, 0.3);
}

.nav-next:hover:not(:disabled),
.nav-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #e61145 0%, #d70015 100%);
  box-shadow: 0 6px 20px rgba(240, 102, 102, 0.4);
  transform: translateY(-2px);
}

/* Disable hover effects for Next/Submit buttons when disabled */
.nav-next:disabled:hover,
.nav-submit:disabled:hover {
  background: linear-gradient(135deg, #f06666 0%, #e61145 100%) !important;
  box-shadow: 0 4px 15px rgba(240, 102, 102, 0.3) !important;
  transform: none !important;
}

.nav-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== PROGRESS BAR ===== */
.progress-container {
  margin-top: 0.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 0.75rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  max-width: 450px;
  margin: 0 auto;
  gap: 1rem;
}

.progress-step {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.progress-step-number {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #f3f4f6;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  transition: all 0.3s ease;
  border: 3px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.progress-step.active .progress-step-number {
  background: linear-gradient(135deg, #f06666 0%, #e61145 100%);
  color: white;
  border-color: #f06666;
  box-shadow: 0 6px 20px rgba(240, 102, 102, 0.4);
  transform: scale(1.05);
}

.progress-step.completed .progress-step-number {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border-color: #10b981;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.progress-step-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  text-align: center;
  transition: all 0.3s ease;
}

.progress-step.active .progress-step-label {
  color: #e61145;
  font-weight: 600;
}

.progress-step.completed .progress-step-label {
  color: #10b981;
  font-weight: 600;
}

/* ===== FORM STEPS ===== */
.form-steps-container {
  position: relative;
}

.form-step {
  display: none;
}

.form-step.active {
  display: block !important;
  animation: fadeInUp 0.3s ease-out;
}

.form-step.active .step-content {
  display: block !important;
}

.form-step.active .file-upload-container {
  display: block !important;
}

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

/* ===== ENHANCED VISUAL HIERARCHY & SPACING ===== */


.step-content {
  max-width: 100%;
  margin: 0 auto;
  /* Ensure proper positioning context for absolute children */
  position: relative;
  overflow: visible;
}

/* Improved section spacing */
.file-upload-section {
  margin-bottom: 2rem;
}

.file-summary {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 0.75rem;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.625rem;
  margin-bottom: 2rem;
  /* Ensure proper positioning context for absolute children */
  position: relative;
  overflow: visible;
}

.option-group {
  margin-bottom: 0.625rem;
  padding: 1rem;
  background: #ffffff;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
  /* Ensure proper positioning context for absolute children */
  position: relative;
  overflow: visible;
}

.option-group:hover {
  border-color: #d1d5db;
}

.option-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: #374151;
  line-height: 1.25rem;
}

/* Enhanced form row spacing */
.form-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: start;
}

/* Ensure town/city and postcode fields have consistent styling */
.form-row .option-group {
  display: flex;
  flex-direction: column;
}

.form-row .option-select {
  font-size: 0.875rem;
  padding: 0.875rem 1rem;
  min-height: 48px;
  width: 100%;
}

/* Better return address section spacing */
.return-address-container {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.return-address-toggle {
  margin-bottom: 1rem;
}

.return-address-form {
  margin-top: 1rem;
  padding: 1.5rem;
  background: #f9fafb;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
}

.return-address-form:not([hidden]) {
  display: block;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    max-height: 500px;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.return-address-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.return-address-lookup {
  background: #fef2f2;
  border: 1px solid #f06666;
  position: relative;
}

.return-address-lookup .autocomplete-suggestions {
  z-index: 1001;
}

.return-address-autocomplete {
  background: white;
}

.return-address-autocomplete:focus {
  border-color: #f06666;
  box-shadow: 0 0 0 3px rgba(240, 102, 102, 0.1);
}

/* ===== RADIO OPTIONS ===== */
.radio-options {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Prevent zoom on radio inputs */
.radio-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  font-size: 16px; /* Prevent mobile zoom */
}

.radio-options.horizontal {
  flex-direction: row;
}

.radio-options.vertical {
  flex-direction: column;
}

.radio-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  border: 2px solid #e5e7eb;
  background: #ffffff;
  min-height: 48px;
}

.radio-option:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.radio-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-option input[type="radio"]:checked + .radio-label {
  color: #f06666;
  font-weight: 600;
}

.radio-option input[type="radio"]:checked {
  background: #f06666;
}

.radio-option input[type="radio"]:checked ~ .radio-option {
  border-color: #f06666;
  background: #fef2f2;
}

/* Custom radio button styling */
.radio-option::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  background: #ffffff;
  transition: all 0.2s ease;
}

.radio-option input[type="radio"]:checked::before {
  border-color: #f06666;
  background: #f06666;
}

.radio-option input[type="radio"]:checked + .radio-label::before {
  content: '';
  position: absolute;
  left: 1.375rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #ffffff;
  z-index: 1;
}

.radio-label {
  font-size: 1rem; /* Increased to prevent mobile zoom */
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  line-height: 1.4;
  padding-left: 2rem;
  position: relative;
  width: 100%;
}

/* ===== CHECKBOX OPTIONS ===== */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checkbox-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.checkbox-option:hover {
  background: #f3f4f6;
}

.checkbox-input {
  width: 1rem;
  height: 1rem;
  accent-color: #f06666;
  cursor: pointer;
  margin-top: 0.125rem;
}

.checkbox-label {
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  line-height: 1.4;
}

.checkbox-label a {
  color: #f06666;
  text-decoration: none;
  font-weight: 500;
}

.checkbox-label a:hover {
  text-decoration: underline;
}

/* ===== ERROR STATES ===== */
.error-message {
  color: #dc2626;
  font-size: 0.875rem;
  margin-top: 0.75rem;
  padding: 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
  display: none; /* Hidden by default */
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.1);
  position: relative;
}

.error-message::before {
  content: '⚠️';
  font-size: 1rem;
  margin-right: 0.5rem;
}

/* Only show error message when explicitly triggered */
.error-message:not([hidden]) {
  display: flex !important;
}

/* Ensure error message is hidden by default */
#error {
  display: none !important;
}

#error:not([hidden]) {
  display: flex !important;
  animation: slideInError 0.3s ease-out;
}

/* Hide field errors by default - only show when explicitly triggered */
.field-error {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

.field-error:not([hidden]) {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure error elements with hidden attribute are completely hidden */
.field-error[hidden],
#error[hidden] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

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

/* Override browser default styling for required fields */
.option-select:required {
  background-color: transparent !important;
}

.option-select:invalid {
  background-color: transparent !important;
  box-shadow: none !important;
}

/* Override any browser validation styles that might show error messages */
.option-select:invalid + .field-error,
.option-select:required:invalid + .field-error {
  display: none !important;
}

/* Only show field errors when explicitly triggered by JavaScript */
.field-error.show-error {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Enhanced error content styles */
.error-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.error-content .error-message {
  margin-bottom: 0;
  background: none;
  border: none;
  padding: 0;
  color: #dc2626;
  font-weight: 500;
}

.error-retry-btn,
.error-refresh-btn {
  padding: 0.5rem 1rem;
  border: 1px solid #dc2626;
  background: #dc2626;
  color: white;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  align-self: flex-start;
}

.error-retry-btn:hover,
.error-refresh-btn:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  transform: translateY(-1px);
}

.error-refresh-btn {
  background: #6b7280;
  border-color: #6b7280;
}

.error-refresh-btn:hover {
  background: #4b5563;
  border-color: #4b5563;
}

.field-error {
  color: #dc2626;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.field-error::before {
  content: '⚠️';
  font-size: 0.875rem;
  margin-right: 0.25rem;
}

.option-select.error {
  border-color: #dc2626;
  background: #fef2f2;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
}

/* Error state for specific fields */
#recipient.option-select.error,
#addressline1.option-select.error,
#return-addressline1.option-select.error {
  background: #fef2f2;
  border-color: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
}

/* ===== ENHANCED FORM VALIDATION ===== */
.option-select:focus:invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.option-select:focus:valid {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

/* Real-time validation indicators */
.option-group {
  position: relative;
}

.option-group.has-error .option-select {
  border-color: #ef4444;
  background-color: #fef2f2;
}

.option-group.has-error {
  margin-bottom: 0;
}

.option-group.has-success .option-select {
  border-color: #22c55e;
  background-color: #f0fdf4;
}

/* Removed validation icons - using slim green border instead */

/* Enhanced error messages */
.field-error {
  display: none;
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.375rem;
  color: #dc2626;
  font-size: 0.875rem;
  line-height: 1.25rem;
  animation: slideInError 0.3s ease-out;
}

.field-error.show-error {
  display: block;
}

.field-error::before {
  content: '⚠️ ';
  margin-right: 0.25rem;
}

/* Success messages */
.field-success {
  display: none;
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 0.375rem;
  color: #16a34a;
  font-size: 0.875rem;
  line-height: 1.25rem;
  animation: slideInSuccess 0.3s ease-out;
}

/* Hide success messages for address fields - green border is sufficient */
.option-group:has(#addressline1) .field-success,
.option-group:has(#addressline2) .field-success,
.option-group:has(#towncity) .field-success,
.option-group:has(#postcode) .field-success,
.option-group:has(#return-addressline1) .field-success,
.option-group:has(#return-addressline2) .field-success,
.option-group:has(#return-towncity) .field-success,
.option-group:has(#return-postcode) .field-success {
  display: none !important;
}

.field-success.show-success {
  display: block;
}

.field-success::before {
  content: '';
  margin-right: 0;
}

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

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.field-success.show-success {
  animation: slideInSuccess 0.3s ease-out, successPulse 0.6s ease-out 0.3s;
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
  #payment-form {
    background: #1f2937;
    color: #f9fafb;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  }
  
  .option-select {
    background: #374151;
    color: #f9fafb;
    border-color: #4b5563;
  }
  
  .option-select:focus {
    border-color: #f06666;
    box-shadow: 0 0 0 3px rgba(240, 102, 102, 0.1);
  }
  
  .option-select:hover {
    background: #4b5563;
  }
  
  .nav-button {
    background: #374151;
    color: #f9fafb;
  }
  
  .nav-button:hover:not(:disabled) {
    background: #4b5563;
  }
  
  .progress-step-number {
    background: #374151;
    color: #f9fafb;
    border-color: #4b5563;
  }
  
  .progress-step.active .progress-step-number {
    background: #f06666;
    color: white;
  }
  
  .form-navigation {
    background: #1f2937;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }
  
  .upload-title,
  .upload-subtitle,
  .progress-step-label,
  .option-label,
  .file-label,
  .file-name {
    color: #f9fafb;
  }
  
  .upload-subtitle,
  .progress-step-label {
    color: #d1d5db;
  }
  
  .file-name {
    color: #10b981;
  }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  #payment-form {
    margin: 0.5rem;
    padding: 1.25rem;
  }

  .form-navigation {
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
  }

  .nav-button {
    width: 100%;
    justify-content: center;
    padding: 1rem 1.5rem; /* Larger touch targets */
    font-size: 1rem; /* Larger text */
    min-height: 48px; /* Minimum touch target size */
  }

  .progress-steps {
    gap: 0.75rem;
  }

  .progress-step-number {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.875rem;
  }

  .progress-step-label {
    font-size: 0.75rem;
  }

  .options-grid {
    gap: 0.5rem;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .return-address-container {
    padding: 1rem;
  }

  .radio-options.horizontal {
    flex-direction: column;
  }

  /* Improved mobile input styling */
  .option-select {
    padding: 1rem;
    font-size: 1rem;
    min-height: 48px;
    background: #ffffff; /* Ensure white background on mobile */
  }

  .option-label {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  /* Better spacing for mobile */
  .option-group {
    padding: 1.25rem;
    margin-bottom: 0.5rem;
  }
}

@media (max-width: 480px) {
  .progress-step-number {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.6875rem;
  }

  .progress-step-label {
    font-size: 0.625rem;
  }

  .option-select {
    padding: 0.625rem;
    font-size: 0.8125rem;
    background: #ffffff; /* Ensure white background on small mobile */
  }

  .return-address-container {
    padding: 0.5rem;
  }

  .radio-option {
    padding: 0.75rem 1rem;
    min-height: 48px; /* Minimum touch target size */
    border: 2px solid #e5e7eb;
    background: #ffffff;
  }

  .radio-option::before {
    left: 1rem;
    width: 1.5rem;
    height: 1.5rem;
  }

  .radio-option input[type="radio"]:checked + .radio-label::before {
    left: 1.375rem;
    width: 0.75rem;
    height: 0.75rem;
  }

  .radio-label {
    font-size: 1rem;
    padding-left: 2.5rem;
  }

  .checkbox-option {
    padding: 0.75rem;
    min-height: 48px;
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.nav-button:focus-visible,
.option-select:focus-visible,
.radio-input:focus-visible,
.checkbox-input:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* ===== UTILITY CLASSES ===== */
.nav-submit[hidden] {
  display: none !important;
}

/* Hide address fields until address is selected */
.address-field-hidden {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

.address-field-visible {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  height: auto !important;
  overflow: visible !important;
  animation: fadeInUp 0.3s ease-out;
}

/* Ensure consistent styling for newly visible address fields */
.address-field-visible .option-select {
  font-family: inherit;
  font-weight: 400;
  line-height: 1.5;
  border-radius: 0.5rem;
  background: #ffffff;
  color: #374151;
}

/* Ensure form-row displays as grid when visible */
.address-field-visible.form-row {
  display: grid !important;
  grid-template-columns: 1.2fr 0.8fr !important;
  gap: 1rem !important;
}

/* Ensure file preview is hidden by default */
#display-preview {
  display: none !important;
}

#display-preview:not([hidden]) {
  display: block !important;
}

/* ===== PRINT STYLES ===== */
@media print {
  .form-navigation,
  .progress-container {
    display: none !important;
  }

  .form-step {
    display: block !important;
  }
} 

/* ===== ENHANCED VISUAL HIERARCHY & SPACING ===== */
.field-help {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.25rem;
  font-style: italic;
}

/* Better error and success message spacing */
.field-error,
.field-success {
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
}

/* ===== ADDRESS LOOKUP CONTAINER ===== */
.address-lookup-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
  /* Ensure proper positioning context for absolute children */
  overflow: visible;
  /* Force full width for proper suggestion positioning */
  min-width: 100%;
  max-width: none;
}

.address-lookup-container .option-select {
  flex: 1;
  /* Ensure the input field doesn't interfere with suggestion positioning */
  position: relative;
}

/* ===== MANUAL ENTRY MODE STYLING ===== */
/* Visual indicator for manual entry mode */
.manual-entry-mode {
  background-color: #ffffff !important;
  border-color: #66cc66 !important;
  color: #374151 !important;
  /* Ensure no red glow in manual mode */
  box-shadow: none !important;
}

.manual-entry-mode::placeholder {
  color: #6b7280 !important;
  font-style: italic;
}

/* Override any validation styling when in manual mode */
.manual-entry-mode.valid {
  border-color: #22c55e !important;
  background-color: #ffffff !important;
  color: #374151 !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1) !important;
}

/* Ensure green border is visible in manual mode when focused */
.manual-entry-mode:focus {
  border-color: #22c55e !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1) !important;
}

/* High specificity overrides for manual entry mode */
#addressline1.manual-entry-mode,
#addressline1.manual-entry-mode:focus,
#addressline1.manual-entry-mode.valid,
#return-addressline1.manual-entry-mode,
#return-addressline1.manual-entry-mode:focus,
#return-addressline1.manual-entry-mode.valid {
  border-color: #22c55e !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1) !important;
}

/* Override any existing red border styling */
#addressline1.manual-entry-mode,
#return-addressline1.manual-entry-mode {
  border-color: #66cc66 !important;
}

#addressline1.manual-entry-mode:focus,
#addressline1.manual-entry-mode.valid,
#return-addressline1.manual-entry-mode:focus,
#return-addressline1.manual-entry-mode.valid {
  border-color: #22c55e !important;
}

/* ===== MANUAL ENTRY BUTTON ===== */
/* Only apply these styles when the button is NOT inside a suggestion item */
.manual-entry-btn:not(.suggestion-item .manual-entry-btn) {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #f06666 0%, #e61145 100%);
  border: none;
  border-radius: 0.5rem;
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-decoration: none;
  width: 100%;
  justify-content: center;
}

/* Only apply these styles when the button is NOT inside a suggestion item */
.manual-entry-btn:not(.suggestion-item .manual-entry-btn):hover {
  background: linear-gradient(135deg, #e61145 0%, #d70015 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(240, 102, 102, 0.3);
}

.manual-entry-btn:not(.suggestion-item .manual-entry-btn):active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(240, 102, 102, 0.2);
}

.manual-entry-btn .manual-entry-icon {
  font-size: 1rem;
}

.manual-entry-btn:not(.suggestion-item .manual-entry-btn):focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(230, 17, 69, 0.1);
}

/* Manual entry suggestion item styling */
.suggestion-item.manual-entry {
  border-top: 1px solid #e5e7eb;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  background: #fef2f2;
  width: 100%;
  box-sizing: border-box;
}

.suggestion-item.manual-entry .manual-entry-btn {
  width: 100%;
  background: linear-gradient(135deg, #f06666 0%, #e61145 100%);
  border: none;
  border-radius: 0.375rem;
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  box-sizing: border-box;
}

.suggestion-item.manual-entry .manual-entry-btn:hover {
  background: linear-gradient(135deg, #e61145 0%, #d70015 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(240, 102, 102, 0.2);
}

.suggestion-item.manual-entry .manual-entry-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(240, 102, 102, 0.2);
}

.suggestion-item.manual-entry .manual-entry-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(230, 17, 69, 0.2);
}

.suggestion-item.no-results {
  text-align: center;
  padding: 1rem;
}

.suggestion-item.no-results .suggestion-text {
  display: block;
  color: #6b7280;
  margin-bottom: 0.75rem;
  font-style: italic;
}

/* ===== CLEAR ADDRESS BUTTON ===== */
.clear-address-button-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  background: #f3f4f6;
  border: 2px solid #d1d5db;
  border-radius: 0.5rem;
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  white-space: nowrap;
  flex-shrink: 0;
}

.clear-address-button-inline:hover {
  background: linear-gradient(135deg, #f06666 0%, #e61145 100%);
  border-color: #e61145;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(240, 102, 102, 0.3);
}

.clear-address-button-inline:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(240, 102, 102, 0.2);
}

/* Clear icon removed - no longer needed */

.clear-address-button-inline:focus {
  outline: none;
  border-color: #e61145;
  box-shadow: 0 0 0 3px rgba(230, 17, 69, 0.1);
}

/* Legacy clear button (keeping for return address) */
.clear-address-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #f3f4f6;
  border: 2px solid #d1d5db;
  border-radius: 0.5rem;
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  width: 100%;
  justify-content: center;
}

.clear-address-button:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
  color: #374151;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.clear-address-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Clear icon removed - no longer needed */

.clear-address-button:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Enhanced mobile spacing */
@media (max-width: 768px) {
  .step-container {
    padding: 1rem 0;
  }
  
  .options-grid {
    gap: 1rem;
    margin-bottom: 1.25rem;
  }
  
  .option-group {
    margin-bottom: 1rem;
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
  }
  
  .form-row .option-select {
    font-size: 1rem;
    min-height: 48px;
  }
  
  .return-address-container {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
  }
  
  .return-address-form {
    margin-top: 1rem;
    padding: 1rem;
  }
  
  .return-address-grid {
    gap: 1rem;
  }
  
  .form-navigation {
    margin-top: 1.25rem;
    padding: 1rem;
  }
  
  .progress-container {
    padding: 1rem;
  }
  
  .progress-steps {
    gap: 1.25rem;
  }
}

@media (max-width: 480px) {
  .step-container {
    padding: 0.75rem 0;
  }
  
  .options-grid {
    gap: 0.375rem;
    margin-bottom: 1rem;
  }
  
  .option-group {
    margin-bottom: 0.375rem;
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }
  
  .form-row .option-select {
    font-size: 1rem;
    min-height: 48px;
  }
  
  .return-address-container {
    margin-top: 1rem;
    padding-top: 1rem;
  }
  
  .return-address-form {
    margin-top: 0.75rem;
    padding: 0.75rem;
  }
  
  .return-address-grid {
    gap: 0.75rem;
  }
  
  .form-navigation {
    margin-top: 1rem;
    padding: 0.75rem;
  }
  
  .progress-container {
    padding: 0.75rem;
  }
  
  .progress-steps {
    gap: 1rem;
  }
}

/* ===== UNIFIED INPUT STYLES ===== */
/* Ensure all input fields have consistent styling */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="search"],
input[type="url"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input[type="color"],
select,
textarea,
.option-select {
  /* Unified font styling */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  font-size: 0.875rem !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
  color: #374151 !important;
  
  /* Unified sizing and spacing */
  padding: 0.875rem 1rem !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.5rem !important;
  background: #ffffff !important;
  width: 100% !important;
  box-sizing: border-box !important;
  
  /* Unified transitions */
  transition: all 0.2s ease !important;
  
  /* Remove browser defaults */
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  outline: none !important;
}

/* Focus state for all inputs */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
input[type="month"]:focus,
input[type="week"]:focus,
input[type="color"]:focus,
select:focus,
textarea:focus,
.option-select:focus {
  border-color: #f06666 !important;
  box-shadow: 0 0 0 3px rgba(240, 102, 102, 0.1) !important;
}

/* Hover state for all inputs */
input[type="text"]:hover,
input[type="email"]:hover,
input[type="tel"]:hover,
input[type="search"]:hover,
input[type="url"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="date"]:hover,
input[type="time"]:hover,
input[type="datetime-local"]:hover,
input[type="month"]:hover,
input[type="week"]:hover,
input[type="color"]:hover,
select:hover,
textarea:hover,
.option-select:hover {
  border-color: #9ca3af !important;
}

/* ===== FORM FIELD STYLES ===== */
.option-select {
  padding: 0.875rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 400;
  line-height: 1.5;
  background: #ffffff;
  transition: all 0.2s ease;
  width: 100%;
  cursor: pointer;
  color: #374151;
}

.option-select:focus {
  outline: none;
  border-color: #f06666;
  box-shadow: 0 0 0 3px rgba(240, 102, 102, 0.1);
  transition: all 0.2s ease;
}

/* Enhanced focus state for address fields */
#recipient.option-select:focus,
#addressline1.option-select:focus,
#return-addressline1.option-select:focus {
  outline: none;
  border-color: #f06666;
  box-shadow: 0 0 0 3px rgba(240, 102, 102, 0.1);
  transition: all 0.2s ease;
}

.option-select:hover {
  border-color: #9ca3af;
}

/* Custom dropdown arrow */
.option-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 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

.option-select:focus {
  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='%23f06666' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
}

/* Make recipient name and address lookup fields white to encourage typing */
#recipient.option-select,
#addressline1.option-select,
#return-addressline1.option-select {
  background: #ffffff !important;
}

/* Style readonly fields (town/city, postcode) to look consistent */
.option-select[readonly] {
  background: #ffffff !important;
  color: #374151;
  cursor: default;
  border-color: #d1d5db;
  font-family: inherit;
  font-weight: 400;
  line-height: 1.5;
}

.option-select[readonly]:focus {
  border-color: #d1d5db;
  box-shadow: none;
  background: #ffffff !important;
}

/* Clean validation styling */
.option-select.has-value {
  background: #ffffff;
  border: 2px solid #22c55e;
  font-family: inherit;
  font-weight: 400;
  line-height: 1.5;
}

.option-select.valid {
  background: #ffffff !important;
  border: 2px solid #22c55e !important;
  font-family: inherit;
  font-weight: 400;
  line-height: 1.5;
}

/* Apply green border to recipient name and address lookup fields when valid */
#recipient.option-select.valid,
#addressline1.option-select.valid,
#return-addressline1.option-select.valid {
  background: #ffffff !important;
  border: 2px solid #22c55e !important;
}

/* Universal valid class styling for all input fields */
input.valid,
select.valid,
textarea.valid {
  background: #ffffff !important;
  border: 2px solid #22c55e !important;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.1) !important;
}

/* ===== MOBILE TOUCH TARGET OPTIMIZATION ===== */
@media (max-width: 768px) {
  /* Increase touch targets for mobile */
  .nav-button {
    min-height: 48px;
    min-width: 48px;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }
  
  .option-select {
    min-height: 48px;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-weight: 400;
    line-height: 1.5;
  }
  
  .radio-input {
    width: 1.5rem;
    height: 1.5rem;
    min-width: 1.5rem;
    min-height: 1.5rem;
  }
  
  .radio-option {
    min-height: 48px;
    padding: 0.75rem;
  }
  
  .checkbox-input {
    width: 1.5rem;
    height: 1.5rem;
    min-width: 1.5rem;
    min-height: 1.5rem;
  }
  
  .checkbox-option {
    min-height: 48px;
    padding: 0.75rem;
  }
  
  /* Improve file upload touch area */
  .file-upload-container {
    min-height: 120px;
    padding: 2rem 1.5rem;
  }
  
  /* Better spacing for progress steps */
  .progress-step-number {
    width: 3rem;
    height: 3rem;
    font-size: 1rem;
  }
  
  .progress-step-label {
    font-size: 0.875rem;
  }
}

@media (max-width: 480px) {
  /* Even larger touch targets for small screens */
  .nav-button {
    min-height: 52px;
    padding: 1rem 1.5rem;
    font-size: 1.125rem;
  }
  
  .option-select {
    min-height: 52px;
    padding: 1rem 1.25rem;
    font-size: 1.125rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-weight: 400;
    line-height: 1.5;
  }
  
  .radio-input {
    width: 1.75rem;
    height: 1.75rem;
    min-width: 1.75rem;
    min-height: 1.75rem;
  }
  
  .checkbox-input {
    width: 1.75rem;
    height: 1.75rem;
    min-width: 1.75rem;
    min-height: 1.75rem;
  }
  
  /* Better file upload area */
  .file-upload-container {
    min-height: 140px;
    padding: 3rem 1.5rem;
  }
  
  .upload-icon {
    font-size: 3.5rem;
  }
  
  .upload-title {
    font-size: 1.25rem;
  }
  
  .upload-subtitle {
    font-size: 1rem;
  }
}

/* Prevent zoom on input focus for iOS */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  .option-select,
  .nav-button,
  .radio-input,
  .checkbox-input {
    font-size: 16px;
  }
} 

/* ===== RADIO AND CHECKBOX STYLES ===== */
.radio-options {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

/* Fix for radio button selection - ensure only the selected option shows as selected */
.radio-option:not(:has(input[type="radio"]:checked)) {
  border-color: #e5e7eb !important;
  background: #ffffff !important;
}

.radio-option:has(input[type="radio"]:checked) {
  border-color: #f06666 !important;
  background: #fef2f2 !important;
}

/* Override any sibling selectors that might cause both radio buttons to appear selected */
.radio-option input[type="radio"]:checked ~ .radio-option {
  border-color: #e5e7eb !important;
  background: #ffffff !important;
}

/* Additional override to ensure only one radio button is selected at a time */
.radio-option:not(:has(input[type="radio"]:checked)) {
  border-color: #e5e7eb !important;
  background: #ffffff !important;
}

.radio-option:has(input[type="radio"]:checked) {
  border-color: #f06666 !important;
  background: #fef2f2 !important;
}

.radio-options.horizontal {
  flex-direction: row;
}

.radio-options.vertical {
  flex-direction: column;
}

.radio-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid #e5e7eb;
  background: #ffffff;
  min-height: 48px;
}

.radio-option:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-option input[type="radio"]:checked + .radio-label {
  color: #f06666;
  font-weight: 600;
}

.radio-option input[type="radio"]:checked {
  background: #f06666;
}

.radio-option input[type="radio"]:checked ~ .radio-option {
  border-color: #f06666;
  background: #fef2f2;
}

/* Custom radio button styling */
.radio-option::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  background: #ffffff;
  transition: all 0.2s ease;
}

.radio-option input[type="radio"]:checked::before {
  border-color: #f06666;
  background: #f06666;
}

.radio-option input[type="radio"]:checked + .radio-label::before {
  content: '';
  position: absolute;
  left: 1.375rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #ffffff;
  z-index: 1;
}

.radio-label {
  font-size: 1rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  line-height: 1.4;
  padding-left: 2rem;
  position: relative;
  width: 100%;
}

/* Checkbox styles */
.checkbox-group {
  margin-top: 0.5rem;
}

.checkbox-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.checkbox-option:hover {
  background: #f9fafb;
}

.checkbox-input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: #f06666;
  cursor: pointer;
  min-width: 1.25rem;
  min-height: 1.25rem;
  margin-top: 0.125rem;
}

.checkbox-label {
  font-size: 0.875rem;
  color: #374151;
  line-height: 1.4;
  cursor: pointer;
}

.checkbox-label a {
  color: #f06666;
  text-decoration: underline;
}

.checkbox-label a:hover {
  color: #e61145;
}

/* Fix for radio button circle not filling when checked */
.radio-option:has(input[type="radio"]:checked)::before {
  border-color: #f06666 !important;
  background: #f06666 !important;
}

/* JavaScript fallback for radio button styling */
.radio-option.radio-checked::before {
  border-color: #f06666 !important;
  background: #f06666 !important;
} 