/* ===== REMOVE BROWSER AUTOCOMPLETE ARROWS ===== */
/* Remove browser autocomplete arrows and dropdown indicators */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="tel"],
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 {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Remove webkit autocomplete arrows */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Remove Firefox autocomplete arrows */
input[type="number"] {
  -moz-appearance: textfield;
}


/* Remove autocomplete dropdown arrows */
input::-webkit-calendar-picker-indicator {
  display: none;
  -webkit-appearance: none;
}

/* Remove search input clear button */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

/* Remove datalist dropdown arrows */
input::-webkit-list-button {
  display: none;
}

/* Remove any remaining browser styling */
input:focus {
  outline: none;
}

/* Ensure no background images are applied */
input {
  background-image: none !important;
}

/* ===== UNIFIED INPUT STYLES FOR ADDRESS FIELDS ===== */
/* Ensure all address input fields use consistent styling */
#addressline1,
#addressline2,
#towncity,
#postcode,
#return-addressline1,
#return-addressline2,
#return-towncity,
#return-postcode,
input[id*="addressline1"],
input[id*="addressline2"],
input[id*="towncity"],
input[id*="postcode"],
input[id*="recipient"],
input[id*="return-addressline1"],
input[id*="return-addressline2"],
input[id*="return-towncity"],
input[id*="return-postcode"] {
  /* 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 address inputs */
#addressline1:focus,
#addressline2:focus,
#towncity:focus,
#postcode:focus,
#return-addressline1:focus,
#return-addressline2:focus,
#return-towncity:focus,
#return-postcode:focus,
input[id*="addressline1"]:focus,
input[id*="addressline2"]:focus,
input[id*="towncity"]:focus,
input[id*="postcode"]:focus,
input[id*="recipient"]:focus,
input[id*="return-addressline1"]:focus,
input[id*="return-addressline2"]:focus,
input[id*="return-towncity"]:focus,
input[id*="return-postcode"]:focus {
  /* Default focus styling - will be overridden by manual-entry-mode */
  border-color: #f06666 !important;
  box-shadow: 0 0 0 3px rgba(240, 102, 102, 0.1) !important;
}

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

/* Hover state for address inputs */
#addressline1:hover,
#addressline2:hover,
#towncity:hover,
#postcode:hover,
#return-addressline1:hover,
#return-addressline2:hover,
#return-towncity:hover,
#return-postcode:hover,
input[id*="addressline1"]:hover,
input[id*="addressline2"]:hover,
input[id*="towncity"]:hover,
input[id*="postcode"]:hover,
input[id*="recipient"]:hover,
input[id*="return-addressline1"]:hover,
input[id*="return-addressline2"]:hover,
input[id*="return-towncity"]:hover,
input[id*="return-postcode"]:hover {
  border-color: #9ca3af !important;
}

/* Specific rules for address input fields */
#addressline1,
#addressline2,
#towncity,
#postcode,
#return-addressline1,
#return-addressline2,
#return-towncity,
#return-postcode,
input[id*="addressline1"],
input[id*="addressline2"],
input[id*="towncity"],
input[id*="postcode"] {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: none !important;
}

/* Remove any datalist dropdown arrows from address fields */
#addressline1::-webkit-list-button,
#addressline2::-webkit-list-button,
#towncity::-webkit-list-button,
#postcode::-webkit-list-button,
#return-addressline1::-webkit-list-button,
#return-addressline2::-webkit-list-button,
#return-towncity::-webkit-list-button,
#return-postcode::-webkit-list-button {
  display: none !important;
}

/* Remove any autocomplete dropdown indicators */
#addressline1::-webkit-calendar-picker-indicator,
#addressline2::-webkit-calendar-picker-indicator,
#towncity::-webkit-calendar-picker-indicator,
#postcode::-webkit-calendar-picker-indicator,
#return-addressline1::-webkit-calendar-picker-indicator,
#return-addressline2::-webkit-calendar-picker-indicator,
#return-towncity::-webkit-calendar-picker-indicator,
#return-postcode::-webkit-calendar-picker-indicator {
  display: none !important;
  -webkit-appearance: none !important;
}

/**
 * ModernMail Address Autocomplete Styles
 * Styles for address search and autocomplete functionality
 */

/* ===== ADDRESS INPUT VISIBILITY ===== */
/* Ensure address input is visible when address is selected in active form step */
.form-step.active .address-input-selected {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  background-color: #ffffff !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  padding: 0.75rem !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  color: #374151 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  position: relative !important;
  z-index: 1 !important;
}

/* CRITICAL FIX: Force address input visibility regardless of form step state */
/* This ensures the address input is always visible when it has a value */
#addressline1:not([value=""]),
#addressline1[value]:not([value=""]),
input#addressline1:not([value=""]),
input#addressline1[value]:not([value=""]),
.address-input-selected:not([value=""]),
.address-input-selected[value]:not([value=""]) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  clip: auto !important;
  clip-path: none !important;
  height: auto !important;
  width: 100% !important;
  overflow: visible !important;
  z-index: 9999 !important;
  background-color: #ffffff !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  padding: 0.75rem !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  color: #374151 !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}

/* Also force visibility for address inputs with specific classes */
input#addressline1.address-input-selected,
input#addressline1.option-select.address-autocomplete,
input#addressline1.option-select.address-autocomplete.address-input-selected {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  clip: auto !important;
  clip-path: none !important;
  height: auto !important;
  width: 100% !important;
  overflow: visible !important;
  z-index: 9999 !important;
  background-color: #ffffff !important; /* Keep white for address lookup to encourage typing */
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  padding: 0.75rem !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  color: #374151 !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}

/* ULTIMATE FALLBACK: Force visibility for any address input that has been populated */
/* This rule has maximum specificity and will override any other hiding rules */
input#addressline1[value]:not([value=""]),
input#addressline1:not([value=""]),
#addressline1[value]:not([value=""]),
#addressline1:not([value=""]) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  clip: auto !important;
  clip-path: none !important;
  height: auto !important;
  width: 100% !important;
  overflow: visible !important;
  z-index: 9999 !important;
  background-color: #ffffff !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  padding: 0.75rem !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  color: #374151 !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}

/* FINAL FALLBACK: Target data attributes set by JavaScript */
input#addressline1[data-has-value="true"],
input#addressline1[data-populated="true"],
#addressline1[data-has-value="true"],
#addressline1[data-populated="true"] {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  clip: auto !important;
  clip-path: none !important;
  height: auto !important;
  width: 100% !important;
  overflow: visible !important;
  z-index: 9999 !important;
  background-color: #ffffff !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  padding: 0.75rem !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  color: #374151 !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}

/* ULTIMATE EMERGENCY FALLBACK: Force visibility for any input with addressline1 in ID */
input[id*="addressline1"],
#addressline1,
input[name*="addressline1"] {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  clip: auto !important;
  clip-path: none !important;
  height: auto !important;
  width: 100% !important;
  overflow: visible !important;
  z-index: 9999 !important;
  background-color: #ffffff !important; /* Keep white for address lookup fields */
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  padding: 0.75rem !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  color: #374151 !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}

/* Additional safety rules to ensure address input visibility in active form step */
.form-step.active input[id*="addressline1"].address-input-selected,
.form-step.active input[id*="address1"].address-input-selected,
.form-step.active input[id*="address_line_1"].address-input-selected,
.form-step.active input[id*="address_line1"].address-input-selected,
.form-step.active input[id*="address"].address-input-selected {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  clip: auto !important;
  clip-path: none !important;
  height: auto !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0.75rem !important;
  overflow: visible !important;
}

/* Ensure addressline1 is visible when in active form step */
.form-step.active #addressline1,
.form-step.active input[name="addressline1"],
.form-step.active input[id*="addressline1"] {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  clip: auto !important;
  clip-path: none !important;
  height: auto !important;
  width: 100% !important;
  overflow: visible !important;
  z-index: 9999 !important;
}

/* Ensure addressline1 is properly styled when visible in active form step */
.form-step.active input#addressline1,
.form-step.active input#addressline1.address-input-selected,
.form-step.active input#addressline1.option-select,
.form-step.active input#addressline1.option-select.address-autocomplete,
.form-step.active input#addressline1.option-select.address-autocomplete.address-input-selected {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  clip: auto !important;
  clip-path: none !important;
  height: auto !important;
  width: 100% !important;
  overflow: visible !important;
  z-index: 9999 !important;
  background-color: #ffffff !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  padding: 0.75rem !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  color: #374151 !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}

/* Ensure address input is properly styled when visible in active form step */
.form-step.active input#addressline1,
.form-step.active input#addressline1.address-input-selected {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  clip: auto !important;
  clip-path: none !important;
  height: auto !important;
  width: 100% !important;
  overflow: visible !important;
  z-index: 9999 !important;
  background-color: #ffffff !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  padding: 0.75rem !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  color: #374151 !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}



/* Force visibility when address is selected in active form step */
.form-step.active #addressline1.address-input-selected,
.form-step.active input[name="addressline1"].address-input-selected,
.form-step.active input[id*="addressline1"].address-input-selected {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  background-color: #ffffff !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  padding: 0.75rem !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  color: #374151 !important;
}

/* Ensure address fields are visible when not explicitly hidden in active form step */
.form-step.active #addressline1:not([style*="display: none"]),
.form-step.active input[name="addressline1"]:not([style*="display: none"]),
.form-step.active input[id*="addressline1"]:not([style*="display: none"]) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure option-group containers are visible when they contain address fields in active form step */
.form-step.active .option-group:has(#addressline1),
.form-step.active .option-group:has(input[name="addressline1"]),
.form-step.active .option-group:has(input[id*="addressline1"]) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.address-input-selected:focus {
  outline: none !important;
  border-color: #f06666 !important;
  box-shadow: 0 0 0 3px rgba(240, 102, 102, 0.1) !important;
}

/* Ensure address input container is visible in active form step */
.form-step.active .address-input-container {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  margin-bottom: 1rem !important;
}

/* Force visibility for address fields when selected in active form step */
.form-step.active .address-field-selected {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure form groups containing address fields are visible in active form step */
.form-step.active .form-group:has(input[id*="addressline1"]),
.form-step.active .form-group:has(input[id*="address1"]),
.form-step.active .form-group:has(input[id*="address_line_1"]),
.form-step.active .form-group:has(input[id*="address_line1"]),
.form-step.active .form-group:has(input[id*="address"]) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Fallback address input styling for active form step */
.form-step.active .address-input-fallback {
  display: block !important;
  width: 100% !important;
  padding: 0.75rem !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  color: #374151 !important;
  background-color: #ffffff !important;
  margin-bottom: 1rem !important;
  box-sizing: border-box !important;
}

.address-input-fallback:focus {
  outline: none !important;
  border-color: #f06666 !important;
  box-shadow: 0 0 0 3px rgba(240, 102, 102, 0.1) !important;
}

/* ===== ADDRESS AUTOCOMPLETE ===== */
.address-autocomplete {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.return-address-autocomplete {
  position: relative;
}

.autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0 0 0.5rem 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 0;
  display: none;
  /* Ensure it appears as a separate box */
  min-height: 50px;
  backdrop-filter: blur(10px);
  border-top: 3px solid #f06666;
  /* Ensure proper positioning */
  position: absolute !important;
  z-index: 1000 !important;
  /* Ensure it's positioned relative to the address-lookup-container */
  width: 100%;
  box-sizing: border-box;
  /* Fix positioning to ensure it covers the full width */
  margin-left: 0;
  margin-right: 0;
  transform: translateX(0);
  /* Force full width expansion */
  min-width: 100%;
  max-width: none;
}

.autocomplete-suggestions:not([hidden]) {
  display: block;
}

/* Ensure the container has relative positioning for proper dropdown positioning */
.address-autocomplete,
.return-address-autocomplete {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

/* Ensure the option-group containing the address lookup has relative positioning */
.option-group:has(.address-autocomplete),
.option-group:has(.return-address-autocomplete) {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  /* Ensure proper positioning context and no width constraints */
  overflow: visible;
}

/* Ensure the address-lookup-container has relative positioning */
.address-lookup-container {
  position: relative;
  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;
}

/* Ensure return address suggestions appear above other elements */
#return-address-suggestions {
  z-index: 1001;
  /* Force full width positioning */
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

/* Ensure main address suggestions appear above other elements */
#address-suggestions {
  z-index: 1000;
  /* Force full width positioning */
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

.suggestion-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.selected {
  background: #f9fafb;
  color: #374151;
}

.suggestion-item.manual-entry {
  background: #fef2f2;
  border-top: 2px solid #f06666;
  font-weight: 500;
  color: #991b1b;
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
  border-radius: 0 0 0.5rem 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

.suggestion-item.manual-entry:hover {
  background: #fecaca;
}

.suggestion-item.manual-entry .suggestion-content {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.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-text {
  flex: 1;
  font-size: 0.875rem;
  color: #374151;
}

.suggestion-hint {
  font-size: 0.75rem;
  color: #6b7280;
  font-style: italic;
  margin-left: 0.5rem;
}

.suggestion-provider {
  font-size: 0.75rem;
  color: #6b7280;
  background: #f3f4f6;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-weight: 500;
}

/* ===== MANUAL ENTRY MODE STYLING ===== */
/* Visual indicator for manual entry mode */
.manual-entry-mode {
  background-color: #fef2f2 !important;
  border-color: #f06666 !important;
  color: #991b1b !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;
}

/* ===== ADDRESS TYPE LABELS ===== */
.address-type-label {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-left: 0.5rem;
  white-space: nowrap;
}

.address-type-label.residential {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.address-type-label.commercial {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* ===== MODE TOGGLE BUTTON ===== */
.address-mode-toggle {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.address-mode-toggle:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

.address-mode-toggle:active {
  background: #e2e8f0;
  transform: translateY(1px);
}

.address-mode-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== READONLY FIELDS ===== */
input[readonly] {
  background: #f9fafb;
  color: #6b7280;
  cursor: not-allowed;
}

input[readonly]:focus {
  border-color: #d1d5db;
  box-shadow: none;
}

/* ===== LOADING STATE ===== */
.suggestion-loading {
  padding: 1rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.suggestion-loading::before {
  content: '';
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #f06666;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ===== SKELETON LOADING ===== */
.suggestion-skeleton {
  height: 1.25rem;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 0.8s infinite;
  border-radius: 0.25rem;
  margin: 0.5rem 0;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== ENHANCED LOADING PROGRESS INDICATOR ===== */
.loading-container {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 1px solid #e9ecef;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  margin: 0.5rem 0;
}

.loading-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.loading-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #007cba;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
}

.loading-text {
  font-size: 1rem;
  color: #495057;
  margin-bottom: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.025em;
}

.loading-text.loading-pulse {
  animation: loadingPulse 2s ease-in-out infinite;
}

.loading-count {
  font-size: 0.875rem;
  color: #6c757d;
  font-weight: 500;
  background: linear-gradient(135deg, #007cba 0%, #0056b3 100%);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 1rem;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
  margin-bottom: 0.5rem;
}

.loading-subtitle {
  font-size: 0.75rem;
  color: #868e96;
  font-weight: 400;
  font-style: italic;
  margin-top: 0.25rem;
}

.loading-placeholder {
  padding: 1rem;
  background: #ffffff;
  border-top: 1px solid #e9ecef;
}

/* Loading animations */
@keyframes loadingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Enhanced skeleton loading */
.suggestion-skeleton {
  height: 1.25rem;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.2s ease-in-out infinite;
  border-radius: 0.25rem;
  margin: 0.5rem 0;
  position: relative;
  overflow: hidden;
}

.suggestion-skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
  animation: skeletonShine 1.5s ease-in-out infinite;
}

@keyframes skeletonShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ===== NO RESULTS ===== */
.suggestion-no-results {
  padding: 1rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* ===== FIELD HELP TEXT ===== */
.field-help {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
  line-height: 1.4;
  font-style: italic;
}

/* ===== MANUAL ENTRY MODE ===== */
.suggestion-item.manual-entry {
  background: #f0f9ff;
  border-top: 2px solid #0ea5e9;
}

.suggestion-item.manual-entry:hover,
.suggestion-item.manual-entry.selected {
  background: #e0f2fe;
}

.manual-entry-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: #0c4a6e;
}

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

/* ===== MANUAL ENTRY MESSAGE ===== */
.manual-entry-message {
  background: #f0f9ff;
  border: 1px solid #0ea5e9;
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #0c4a6e;
  animation: slideDown 0.3s ease-out;
}

.manual-entry-message p {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===== ADDRESS SELECTED MESSAGE ===== */
.address-selected-message {
  background: #f8f9fa; /* Light grey instead of green */
  border: 1px solid #d1d5db; /* Default border instead of green */
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #374151; /* Dark grey text instead of green */
  animation: slideDown 0.3s ease-out;
}

.address-selected-message p {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

/* ===== SUCCESS ANIMATION ===== */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.manual-entry-notice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.manual-entry-notice .manual-entry-icon {
  font-size: 1.125rem;
}

/* ===== IMPROVED INPUT STYLES ===== */
.address-input-container {
  position: relative;
}

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

.address-input-container input.valid {
  border-color: #22c55e; /* Green border for valid address inputs */
  background-color: #ffffff; /* White background */
  border-width: 2px;
}

/* Universal valid styling for all address fields */
#addressline1.valid,
#addressline2.valid,
#towncity.valid,
#postcode.valid,
#return-addressline1.valid,
#return-addressline2.valid,
#return-towncity.valid,
#return-postcode.valid,
input[id*="addressline1"].valid,
input[id*="addressline2"].valid,
input[id*="towncity"].valid,
input[id*="postcode"].valid,
input[id*="recipient"].valid,
input[id*="return-addressline1"].valid,
input[id*="return-addressline2"].valid,
input[id*="return-towncity"].valid,
input[id*="return-postcode"].valid {
  border-color: #22c55e !important; /* Green border for valid address inputs */
  background-color: #ffffff !important; /* White background */
  border-width: 2px !important;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.1) !important;
}

.address-input-container input.invalid {
  border-color: #ef4444;
  background-color: transparent;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  /* Unified input styles for mobile */
  #addressline1,
  #addressline2,
  #towncity,
  #postcode,
  #return-addressline1,
  #return-addressline2,
  #return-towncity,
  #return-postcode,
  input[id*="addressline1"],
  input[id*="addressline2"],
  input[id*="towncity"],
  input[id*="postcode"],
  input[id*="recipient"],
  input[id*="return-addressline1"],
  input[id*="return-addressline2"],
  input[id*="return-towncity"],
  input[id*="return-postcode"] {
    font-size: 1rem !important;
    padding: 0.875rem 1rem !important;
    min-height: 48px !important;
  }
  
  .autocomplete-suggestions {
    max-height: 250px;
  }
  
  .suggestion-item {
    padding: 0.625rem 0.875rem;
  }
  
  .suggestion-text {
    font-size: 0.8125rem;
  }
  
  .suggestion-provider {
    font-size: 0.6875rem;
  }
  
  .field-help {
    font-size: 0.6875rem;
  }
  
  .manual-entry-text {
    font-size: 0.8125rem;
  }
  
  .manual-entry-notice {
    font-size: 0.8125rem;
  }
  
  .address-mode-toggle {
    font-size: 0.6875rem;
    padding: 0.375rem 0.625rem;
  }

  /* Mobile loading optimizations */
  .loading-container {
    margin: 0.25rem 0;
    border-radius: 0.5rem;
  }

  .loading-progress {
    padding: 1rem;
  }

  .loading-spinner {
    width: 1.5rem;
    height: 1.5rem;
    border-width: 2px;
    margin-bottom: 0.75rem;
  }

  .loading-text {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
  }

  .loading-count {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
  }

  .loading-subtitle {
    font-size: 0.6875rem;
  }

  .loading-placeholder {
    padding: 0.75rem;
  }
}

@media (max-width: 480px) {
  .autocomplete-suggestions {
    max-height: 200px;
  }
  
  .suggestion-item {
    padding: 0.5rem 0.75rem;
  }
  
  .suggestion-text {
    font-size: 0.75rem;
  }
  
  .suggestion-provider {
    font-size: 0.625rem;
    padding: 0.0625rem 0.25rem;
  }
  
  .field-help {
    font-size: 0.625rem;
  }
  
  .manual-entry-text {
    font-size: 0.75rem;
  }
  
  .manual-entry-notice {
    font-size: 0.75rem;
  }
  
  .manual-entry-message,
  .address-selected-message {
    padding: 0.625rem;
    font-size: 0.8125rem;
  }
  
  .address-mode-toggle {
    font-size: 0.625rem;
    padding: 0.25rem 0.5rem;
    margin-top: 0.375rem;
  }

  /* Small mobile loading optimizations */
  .loading-container {
    margin: 0.125rem 0;
    border-radius: 0.375rem;
  }

  .loading-progress {
    padding: 0.75rem;
  }

  .loading-spinner {
    width: 1.25rem;
    height: 1.25rem;
    border-width: 2px;
    margin-bottom: 0.5rem;
  }

  .loading-text {
    font-size: 0.8125rem;
    margin-bottom: 0.375rem;
  }

  .loading-count {
    font-size: 0.6875rem;
    padding: 0.25rem 0.5rem;
  }

  .loading-subtitle {
    font-size: 0.625rem;
  }

  .loading-placeholder {
    padding: 0.5rem;
  }
} 

/* ===== LOAD MORE FUNCTIONALITY ===== */
.suggestion-item.load-more-option {
  background-color: #f8fafc;
  border-top: 1px solid #e2e8f0;
  color: #3b82f6;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.suggestion-item.load-more-option:hover {
  background-color: #eff6ff;
  color: #2563eb;
}

.suggestion-item.loading-more {
  background-color: #f8fafc;
  border-top: 1px solid #e2e8f0;
  color: #6b7280;
  font-style: italic;
  cursor: default;
}

.suggestion-item.loading-more .suggestion-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.suggestion-item.loading-more .suggestion-text::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid #d1d5db;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Ensure load more button appears before manual entry option */
.suggestion-item.load-more-option,
.suggestion-item.loading-more {
  order: 1;
}

.suggestion-item.manual-entry-option {
  order: 2;
}

/* ===== ENHANCEMENT INDICATOR ===== */
.enhancement-indicator {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.875rem;
  color: #6b7280;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ===== PROGRESSIVE ENHANCEMENT ===== */
.suggestion-item {
  transition: all 0.3s ease;
}

.suggestion-item.enhanced {
  background-color: #f0fdf4;
  border-left: 3px solid #22c55e;
}

.suggestion-item.enhancing {
  background-color: #fef3c7;
  border-left: 3px solid #f59e0b;
}

/* ===== SMALL SCREEN RESPONSIVE STYLES ===== */
@media (max-width: 480px) {
  /* Unified input styles for small screens */
  #addressline1,
  #addressline2,
  #towncity,
  #postcode,
  #return-addressline1,
  #return-addressline2,
  #return-towncity,
  #return-postcode,
  input[id*="addressline1"],
  input[id*="addressline2"],
  input[id*="towncity"],
  input[id*="postcode"],
  input[id*="recipient"],
  input[id*="return-addressline1"],
  input[id*="return-addressline2"],
  input[id*="return-towncity"],
  input[id*="return-postcode"] {
    font-size: 1.125rem !important;
    padding: 1rem 1.25rem !important;
    min-height: 52px !important;
  }
}

/* ===== RESIDENTIAL/COMMERCIAL LABELS ===== */
.residential-label,
.commercial-label {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.125rem 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.residential-label {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.commercial-label {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fed7aa;
} 

/* Postcode hint styling */
.suggestion-item.postcode-hint {
    background-color: #f8f9fa;
    border-left: 4px solid #007cba;
    padding: 12px 16px;
    cursor: default;
    font-style: italic;
    color: #666;
    border-radius: 0;
    transition: none;
}

.suggestion-item.postcode-hint:hover {
    background-color: #f8f9fa;
    transform: none;
}

.suggestion-item.postcode-hint .hint-text {
    font-size: 14px;
    line-height: 1.4;
}

/* ===== ADDRESS TYPE LABEL (ABOVE ADDRESS FIELD) ===== */
.address-type-label {
    margin-bottom: 8px;
    text-align: right;
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.address-type-label .residential-label,
.address-type-label .commercial-label {
    margin-left: 0;
    font-size: 11px;
    padding: 3px 8px;
    display: inline-block;
    font-weight: 600;
    border-radius: 3px;
} 