/**
 * Mapbox Address Search - Reusable CSS
 * Used across all Movix forms that need address search functionality
 */

/* CSS Variables for easy theming */
:root {
  --address-bg: #fff;
  --address-border: #ccc;
  --address-radius: 0.25rem;
  --address-shadow: rgba(0, 0, 0, 0.1);
  --address-hover-bg: #c0c3c6ae;
  --address-text: #333;
  --address-muted: #6c757d;
  --address-loading-text: #666;
  --focus-color: #80bdff;
  --focus-shadow: rgba(0, 123, 255, 0.25);
  --base-font-size: 1.125rem;
  --suggestion-title-size: 1.25rem;
}

/* Readonly field styling */
input[readonly], textarea[readonly] {
    background-color: #f0f0f0 !important;
    cursor: not-allowed;
}

.locked-address {
    background-color: #f8f9fa !important;
    border-color: #dee2e6 !important;
    color: #6c757d !important;
    cursor: not-allowed !important;
    position: relative;
}

.locked-address::before {
    content: '\F0341';
    font-family: 'Material Design Icons';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    z-index: 10;
}

.address-lock-info {
    margin-top: 5px;
    font-size: 0.875rem;
}

.address-lock-info i {
    margin-right: 3px;
}

.address-proximity-info {
    margin-top: 5px;
    font-size: 0.875rem;
}

.address-proximity-info i {
    margin-right: 3px;
}

/* Address search container */
.address-search-container {
  position: relative;
  font-size: var(--base-font-size);
}

/* Address search input */
.address-search {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--address-border);
  border-radius: var(--address-radius);
  transition: border-color 0.2s, box-shadow 0.2s;
  font-size: inherit;
}

.address-search:focus {
  border-color: var(--focus-color);
  box-shadow: 0 0 0 0.2rem var(--focus-shadow);
  outline: none;
}

/* Dropdown container */
.address-search-dropdown {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  background: var(--address-bg);
  border: 1px solid var(--address-border);
  border-top: none;
  border-radius: 0 0 var(--address-radius) var(--address-radius);
  box-shadow: 0 0.25rem 0.5rem var(--address-shadow);
  max-height: 15rem;
  overflow-y: auto;
  z-index: 1050;
  display: none;
}

.address-search-dropdown.show {
  display: block !important;
}

.address-search-dropdown[aria-hidden="true"] {
  display: none !important;
}

/* Individual suggestion styling */
.address-suggestion {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  transition: background-color 0.2s;
  font-size: inherit;
}

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

.address-suggestion:hover,
.address-suggestion[aria-selected="true"] {
  background-color: var(--address-hover-bg);
}

.address-suggestion strong {
  font-weight: 500;
  color: var(--address-text);
  font-size: var(--suggestion-title-size);
}

.address-suggestion .text-muted {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--address-muted) !important;
}

/* Loading state */
.address-loading {
  padding: 0.75rem 1rem;
  text-align: center;
  color: var(--address-loading-text);
  font-style: italic;
  font-size: inherit;
}

/* Mobile responsiveness */
@media (max-height: 20rem) {
  .address-search-dropdown {
    position: fixed;
    top: auto;
    bottom: 0;
    max-height: 50%;
    border-radius: var(--address-radius);
  }
}

/* Custom alert styling */
.custom-alert {
  max-width: 400px;
  margin: 1rem auto;
  text-align: center;
  background-color: rgba(255, 193, 7, 0.2) !important;
  color: #333 !important;
}

.custom-alert-error {
  max-width: 400px;
  margin: 1rem auto;
  text-align: center;
}
