/**
 * Enhanced Selectors Styling for Tessera Amoris
 * Premium styling for Country/State/City and Nationality selectors
 */

/* ===== LOCATION SELECTOR STYLES ===== */

.location-selector-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
  margin: 24px 0;
  padding: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(245, 240, 235, 0.95) 100%);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(200, 150, 120, 0.2);
}

.location-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.location-field label {
  font-size: 14px;
  font-weight: 600;
  color: #5a4a3a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.location-field label::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4a574 0%, #c99a64 100%);
}

/* Country Select */
.country-select,
.state-select,
.city-select {
  padding: 12px 14px;
  border: 2px solid #e0d5c7;
  border-radius: 8px;
  font-size: 15px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: white;
  color: #4a4a4a;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23d4a574' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 40px;
}

.country-select:hover,
.state-select:hover,
.city-select:hover {
  border-color: #d4a574;
  box-shadow: 0 4px 12px rgba(212, 165, 116, 0.15);
}

.country-select:focus,
.state-select:focus,
.city-select:focus {
  outline: none;
  border-color: #c99a64;
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1), 0 4px 12px rgba(212, 165, 116, 0.2);
}

.country-select:disabled,
.state-select:disabled,
.city-select:disabled {
  background-color: #f5f5f5;
  color: #999;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Country Select with Flag */
.country-option-with-flag {
  display: flex;
  align-items: center;
  gap: 8px;
}

.country-option-with-flag::before {
  font-size: 18px;
}

/* "Other" Option Styling */
.city-other-option {
  font-style: italic;
  color: #d4a574;
  font-weight: 600;
  border-top: 1px solid #e0d5c7;
  padding-top: 4px;
  margin-top: 4px;
}

/* Hidden City Input Field (appears when "Other" is selected) */
.city-custom-input-wrapper {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  animation: slideDown 0.3s ease-out;
}

.city-custom-input-wrapper.active {
  display: flex;
}

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

.city-custom-input-wrapper label {
  font-size: 13px;
  font-weight: 600;
  color: #5a4a3a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.city-custom-input-wrapper input {
  padding: 10px 12px;
  border: 2px solid #e0d5c7;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: white;
  color: #4a4a4a;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.city-custom-input-wrapper input:focus {
  outline: none;
  border-color: #c99a64;
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1), 0 4px 12px rgba(212, 165, 116, 0.2);
}

.city-custom-input-wrapper input::placeholder {
  color: #bbb;
}

/* ===== NATIONALITY AUTOCOMPLETE STYLES ===== */

.nationality-field {
  position: relative;
  margin: 24px 0;
}

.nationality-field label {
  font-size: 14px;
  font-weight: 600;
  color: #5a4a3a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.nationality-field label::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4a574 0%, #c99a64 100%);
}

.nationality-input-wrapper {
  position: relative;
}

.nationality-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e0d5c7;
  border-radius: 8px;
  font-size: 15px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: white;
  color: #4a4a4a;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nationality-input:hover {
  border-color: #d4a574;
  box-shadow: 0 4px 12px rgba(212, 165, 116, 0.15);
}

.nationality-input:focus {
  outline: none;
  border-color: #c99a64;
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1), 0 4px 12px rgba(212, 165, 116, 0.2);
}

.nationality-input::placeholder {
  color: #bbb;
}

.premium-nationality-input {
  position: relative;
  display: grid;
  gap: clamp(0.75rem, 0.6rem + 0.6vw, 1rem);
  padding: clamp(0.9rem, 0.8rem + 0.7vw, 1.35rem);
  border-radius: 1.1rem;
  background: linear-gradient(140deg, rgba(248, 244, 236, 0.95), rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(212, 165, 116, 0.28);
  box-shadow: 0 22px 40px rgba(212, 165, 116, 0.18);
}

.nationality-autocomplete-wrapper {
  position: relative;
}

.nationality-autocomplete-wrapper::after {
  content: '';
  position: absolute;
  inset: auto 12px -10px;
  height: 12px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(212, 165, 116, 0.24) 0%, rgba(212, 165, 116, 0) 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nationality-autocomplete-wrapper:focus-within::after {
  opacity: 1;
}

.nationality-quick-picks {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem 1rem 1rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(244, 236, 222, 0.85));
  border: 1px solid rgba(212, 165, 116, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.nationality-quick-picks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nationality-quick-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #8c6d3f;
  font-weight: 700;
}

.nationality-quick-helper {
  font-size: 0.85rem;
  color: rgba(92, 70, 45, 0.75);
}

.nationality-quick-pills-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.nationality-quick-pills {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  scroll-padding: 0.5rem;
  mask-image: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.6) 12%, rgba(0, 0, 0, 0.95) 88%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.6) 12%, rgba(0, 0, 0, 0.95) 88%, transparent);
}

.nationality-quick-pills::-webkit-scrollbar {
  height: 6px;
}

.nationality-quick-pills::-webkit-scrollbar-thumb {
  background: rgba(212, 165, 116, 0.45);
  border-radius: 999px;
}

.nationality-quick-nav {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(212, 165, 116, 0.18);
  color: #704d1a;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 6px 12px rgba(212, 165, 116, 0.24);
}

.nationality-quick-nav:hover:not([disabled]) {
  background: rgba(212, 165, 116, 0.32);
  transform: translateY(-1px);
}

.nationality-quick-nav[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.nationality-quick-pills::after {
  content: '';
  flex: 0 0 0.25rem;
}

.nationality-quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 165, 116, 0.4);
  background: rgba(255, 255, 255, 0.92);
  color: #5b442a;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
  scroll-snap-align: start;
  box-shadow: 0 10px 18px rgba(212, 165, 116, 0.16);
}

.nationality-quick-pill .flag {
  font-size: 1.15rem;
  line-height: 1;
}

.nationality-quick-pill .name {
  white-space: nowrap;
}

.nationality-quick-pill .caption {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(91, 68, 42, 0.7);
  font-weight: 700;
}

.nationality-quick-pill:hover,
.nationality-quick-pill:focus-visible {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #d4a574, #c99a64);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 16px 28px rgba(212, 165, 116, 0.35);
}

.nationality-quick-pill:hover .caption,
.nationality-quick-pill:focus-visible .caption {
  color: rgba(255, 255, 255, 0.85);
}

.nationality-quick-pill.active {
  background: linear-gradient(135deg, #b88a4f, #a87934);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.65);
  box-shadow: 0 18px 32px rgba(167, 121, 52, 0.45);
}

.nationality-quick-pill.active .caption {
  color: rgba(255, 255, 255, 0.85);
}

.nationality-quick-footnote {
  font-size: 0.8rem;
  color: rgba(91, 68, 42, 0.7);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nationality-quick-footnote i {
  color: rgba(167, 121, 52, 0.8);
}

/* Autocomplete Suggestions Container */
.nationality-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid #e0d5c7;
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  display: none;
  margin-top: -2px;
}

.nationality-suggestions.active {
  display: block;
  animation: slideDown 0.3s ease-out;
}

/* Horizontal Nationality Suggestions Layout */
.nationality-suggestions-horizontal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  max-height: 200px;
  overflow-y: auto;
}

.nationality-suggestion-item {
  padding: 8px 12px;
  background: #f9f7f5;
  border: 1px solid #e0d5c7;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  color: #5a4a3a;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-weight: 500;
}

.nationality-suggestion-item:hover {
  background: linear-gradient(135deg, #d4a574 0%, #c99a64 100%);
  color: white;
  border-color: #c99a64;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}

.nationality-suggestion-item.selected {
  background: linear-gradient(135deg, #d4a574 0%, #c99a64 100%);
  color: white;
  border-color: #c99a64;
}

/* Vertical Nationality Suggestions Layout (Alternative) */
.nationality-suggestions-vertical {
  display: flex;
  flex-direction: column;
}

.nationality-suggestion-item-vertical {
  padding: 12px 14px;
  background: white;
  border-bottom: 1px solid #e0d5c7;
  cursor: pointer;
  font-size: 14px;
  color: #5a4a3a;
  transition: all 0.2s ease;
  font-weight: 500;
}

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

.nationality-suggestion-item-vertical:hover {
  background: #f9f7f5;
  padding-left: 18px;
  color: #c99a64;
}

.nationality-suggestion-item-vertical.selected {
  background: rgba(212, 165, 116, 0.1);
  color: #c99a64;
  font-weight: 700;
}

/* No Results Message */
.nationality-no-results {
  padding: 16px;
  text-align: center;
  color: #999;
  font-size: 13px;
  font-style: italic;
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 768px) {
  .location-selector-container {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }

  .premium-nationality-input {
    padding: 0.85rem 0.9rem 1rem;
    gap: 0.75rem;
  }

  .nationality-quick-picks {
    padding: 0.75rem 0.8rem 0.9rem;
  }

  .nationality-quick-helper {
    font-size: 0.78rem;
  }

  .nationality-quick-nav {
    width: 28px;
    height: 28px;
  }

  .nationality-quick-pill {
    font-size: 0.9rem;
    padding: 0.5rem 0.85rem;
  }

  .nationality-quick-pill .caption {
    font-size: 0.68rem;
  }

  .country-select,
  .state-select,
  .city-select,
  .nationality-input {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 14px 16px;
  }

  .nationality-suggestions {
    max-height: 250px;
  }

  .nationality-suggestions-horizontal {
    gap: 6px;
    padding: 10px;
  }

  .nationality-suggestion-item {
    padding: 6px 10px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .location-selector-container {
    gap: 12px;
    padding: 12px;
  }

  .premium-nationality-input {
    padding: 0.7rem 0.75rem 0.85rem;
    gap: 0.65rem;
  }

  .nationality-quick-picks {
    padding: 0.65rem 0.7rem 0.8rem;
  }

  .nationality-quick-picks-header {
    gap: 0.5rem;
  }

  .nationality-quick-helper {
    font-size: 0.72rem;
  }

  .nationality-quick-pills-wrapper {
    gap: 0.35rem;
  }

  .nationality-quick-nav {
    display: none;
  }

  .nationality-quick-pill {
    font-size: 0.85rem;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
  }

  .nationality-quick-pill .caption {
    display: none;
  }

  .location-field label,
  .nationality-field label {
    font-size: 12px;
  }

  .country-select,
  .state-select,
  .city-select,
  .nationality-input {
    padding: 12px 14px;
    font-size: 14px;
  }

  .nationality-suggestions-horizontal {
    gap: 4px;
    padding: 8px;
  }

  .nationality-suggestion-item {
    padding: 5px 8px;
    font-size: 11px;
  }
}

/* ===== SCROLLBAR STYLING ===== */

.nationality-suggestions::-webkit-scrollbar,
.nationality-suggestions-horizontal::-webkit-scrollbar {
  width: 6px;
}

.nationality-suggestions::-webkit-scrollbar-track,
.nationality-suggestions-horizontal::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 3px;
}

.nationality-suggestions::-webkit-scrollbar-thumb,
.nationality-suggestions-horizontal::-webkit-scrollbar-thumb {
  background: #d4a574;
  border-radius: 3px;
}

.nationality-suggestions::-webkit-scrollbar-thumb:hover,
.nationality-suggestions-horizontal::-webkit-scrollbar-thumb:hover {
  background: #c99a64;
}

/* ===== ACCESSIBILITY ===== */

.country-select:focus-visible,
.state-select:focus-visible,
.city-select:focus-visible,
.nationality-input:focus-visible {
  outline: 2px solid #c99a64;
  outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: more) {
  .country-select,
  .state-select,
  .city-select,
  .nationality-input {
    border-width: 3px;
  }

  .nationality-suggestion-item:hover {
    text-decoration: underline;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .country-select,
  .state-select,
  .city-select,
  .nationality-input,
  .nationality-suggestion-item,
  .city-custom-input-wrapper {
    transition: none;
  }

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

