/* ================================================================================
   SEARCH.CSS - Search Overlay & Modals
   Scoped to #searchOverlay and search modals
   ================================================================================ */

/* ================================
   SEARCH OVERLAY CONTAINER
   ================================ */
#searchOverlay .search-container {
    display: flex;
    flex: 1;
    background: var(--bg-home-page);
    padding-bottom: env(safe-area-inset-bottom);
}

#searchOverlay .search-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-lg);
    gap: var(--space-lg);
    min-height: 0;
}

/* ================================
   SEARCH MODAL FORM ELEMENTS
   ================================ */
.search-modal .form-input,
.search-modal .form-select {
    border: 2px solid var(--border-light);
    border-radius: var(--radius-xl);
    font-size: var(--text-md);
    margin: var(--space-xl);
    transition: border-color 0.25s ease;
    overflow: hidden;
    padding: var(--space-xl);
    width: -webkit-fill-available;
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
}

.search-modal .form-input:focus,
.search-modal .form-select:focus {
    outline: none;
    border-color: var(--border-purple);
    box-shadow: 0 0 0 3px var(--bg-purple);
}

.search-modal .form-input::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

/* ================================
   LOCATION CONFIRM MODAL
   ================================ */


/* ================================
   COUNTRY DROPDOWN
   ================================ */
.country-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    margin-top: var(--space-sm);
    max-height: 400px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.country-dropdown .country-region {
    padding: var(--space-sm) var(--space-md);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    background: var(--bg-section);
    position: sticky;
    top: 0;
    z-index: 1;
}

.country-dropdown .country-option {
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    transition: background var(--transition);
    color: var(--text-primary);
}

.country-dropdown .country-option:hover {
    background: var(--bg-section);
}

/* ================================
   DISTANCE MODAL
   ================================ */
#distanceModal .modal-content {
    max-width: 400px;
}

#distanceModal .modal-header {
    background: var(--primary-gradient);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#distanceModal .modal-title {
    margin: 0;
    font-size: var(--text-lg);
    color: white;
}

#distanceModal .modal-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-circle);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

#distanceModal .modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

#distanceModal .distance-options {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

#distanceModal .distance-option {
    display: flex;
    flex-direction: column;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-section);
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

#distanceModal .distance-option:hover {
    background: var(--bg-purple);
    border-color: var(--border-purple);
    transform: translateX(4px);
}

#distanceModal .distance-option.popular {
    background: var(--bg-purple);
    border-color: var(--border-purple);
}

#distanceModal .distance-option.popular::after {
    content: '⭐';
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
}

#distanceModal .distance-number {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
}

#distanceModal .distance-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

#placesSearchModal .place-details {
    background: var(--bg-grey);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

#placesSearchModal .btn-primary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: var(--space-lg);
}

/* ================================
   SEARCH BOX
   ================================ */
#searchOverlay .search-box {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-input);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-xl);
    transition: border-color var(--transition), box-shadow var(--transition);
}

#searchOverlay .search-box:focus-within {
    border-color: var(--border-purple);
    box-shadow: 0 0 0 3px var(--bg-purple);
}

#searchOverlay .search-box-icon {
    font-size: var(--text-md);
    line-height: 1;
    flex-shrink: 0;
}

#searchOverlay .search-box-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    padding: 0;
    color: var(--text-primary);
    /* 16px minimum or iOS zooms the viewport on focus */
    font-size: max(var(--text-md), 16px);
    font-family: inherit;
}

#searchOverlay .search-box-input::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

#searchOverlay .search-box-clear {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-muted);
    border: none;
    border-radius: var(--radius-circle);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
}

#searchOverlay .search-box-clear[hidden] {
    display: none;
}

/* ================================
   SUGGESTIONS
   ================================ */
#searchOverlay .search-suggestions {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#searchOverlay .suggest-group-head {
    font-size: var(--text-sm);
    color: var(--text-muted);
    padding: var(--space-lg) var(--space-xs) var(--space-xs);
}

#searchOverlay .suggest-chips {
    display: flex;
    gap: var(--space-xs);
    overflow-x: auto;
    scrollbar-width: none;
    padding: var(--space-md) var(--space-xs) var(--space-xs);
}

#searchOverlay .suggest-chips::-webkit-scrollbar {
    display: none;
}

#searchOverlay .suggest-chip {
    flex-shrink: 0;
    padding: var(--space-xs) var(--space-md);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}

#searchOverlay .suggest-chip.is-active {
    background: var(--bg-purple);
    border-color: var(--border-purple);
    color: var(--text-primary);
}

#searchOverlay .suggest-group[hidden] {
    display: none;
}

#searchOverlay .suggest-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-xs);
    border-bottom: 1px solid var(--divider-color);
    cursor: pointer;
    transition: background var(--transition);
}

#searchOverlay .suggest-row:hover,
#searchOverlay .suggest-row:active {
    background: var(--hover-subtle);
}

#searchOverlay .suggest-icon {
    font-size: var(--text-lg);
    line-height: 1;
    flex-shrink: 0;
}

#searchOverlay .suggest-body {
    flex: 1;
    min-width: 0;
}

#searchOverlay .suggest-title {
    font-size: var(--text-md);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#searchOverlay .suggest-meta {
    font-size: var(--text-sm);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#searchOverlay .suggest-aside {
    flex-shrink: 0;
    font-size: var(--text-sm);
    color: var(--text-purple);
    white-space: nowrap;
}

/* Tier dot - shared component, not search-specific. A tier means the
   same thing wherever a venue appears, so it's defined once here rather
   than re-scoped per surface. Was #searchOverlay-only, which is why the
   venue picker rendered correct classes with no styling at all. */
.tier-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: var(--radius-circle);
    margin-left: var(--space-xs);
    vertical-align: middle;
    flex-shrink: 0;
}

.tier-dot.tier-diamond { background: var(--tier-dot-diamond); }
.tier-dot.tier-gold    { background: var(--tier-dot-gold); }
.tier-dot.tier-silver  { background: var(--tier-dot-silver); }
.tier-dot.tier-bronze  { background: var(--tier-dot-bronze); }
.tier-dot.tier-unknown,
.tier-dot.tier-nogf    { background: var(--tier-dot-unknown); }

/* ================================
   EMPTY / LOADING / ERROR STATES
   ================================ */
#searchOverlay .suggest-hint {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: var(--space-xs) var(--space-xs) var(--space-md);
    line-height: 1.5;
}

#searchOverlay .suggest-status {
    padding: var(--space-xl) var(--space-md);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* Add-venue escape hatch - amber, matching the "Can't find it?" prompt used in
   the snap and owner-dashboard flows. */
#searchOverlay .suggest-row.suggest-add {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: var(--bg-amber);
    border: 1px solid var(--border-amber);
    border-radius: var(--radius-lg);
}

#searchOverlay .suggest-row.suggest-add .suggest-title {
    color: var(--amber);
    font-weight: 600;
}

/* Distinct from the venue rows below it — this is an action, not a result.
   Purple rather than the add-row's amber, since it's a search not a create. */
#searchOverlay .suggest-row.suggest-nearby {
    margin-bottom: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-purple);
    border: 1px solid var(--border-purple);
    border-radius: var(--radius-lg);
}

#searchOverlay .suggest-row.suggest-nearby .suggest-title {
    color: var(--text-purple);
    font-weight: 600;
}

/* Google Maps attribution. Values are Google's, not ours: weight 400, normal
   style and letter spacing, 12-16sp, and a colour from their permitted set
   (#5E5E5E) that holds 4.5:1 against the dropdown background. Don't restyle
   this to match the app — the spec forbids modification. */
#searchOverlay .suggest-attribution {
    font-family: Roboto, sans-serif;
    font-style: normal;
    font-weight: 400;
    font-size: 12px;
    letter-spacing: normal;
    white-space: nowrap;
    color: #5e5e5e;
    padding: var(--space-xs) var(--space-xs) var(--space-sm);
}

/* The matched letters. Deliberately subtle — the job is to show WHY a row is
   in the list, not to dominate the name it's part of. */
#searchOverlay .suggest-match {
    font-weight: 700;
    color: var(--text-primary);
}