/**
 * Mobile City Autocomplete Styles - Datepicker Style
 * Touch-optimized autocomplete for mobile devices
 * @version 2.0.0
 * @date 2025-12-07
 */

/* Overlay for fullscreen modal */
.city-autocomplete-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10010;
    display: flex;
    align-items: center;
    justify-content: center;
}

.city-autocomplete-overlay.hidden {
    display: none;
}

/* Main autocomplete container */
.city-autocomplete-mobile {
    background: #ffffff;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

/* Header with title and close button */
.autocomplete-header {
    background: #2a5a35;
    color: #ffffff;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.autocomplete-title {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

.autocomplete-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
    position: absolute;
    right: 8px;
}

.autocomplete-close:active {
    background: rgba(255, 255, 255, 0.2);
}

/* Input wrapper */
.autocomplete-input-wrapper {
    padding: 12px 16px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    position: relative;
}

.autocomplete-input {
    width: 100%;
    padding: 12px 44px 12px 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

.autocomplete-input:focus {
    outline: none;
    border-color: #2a5a35;
    box-shadow: 0 0 0 2px rgba(42, 90, 53, 0.1);
}

/* Clear button */
.autocomplete-clear-btn {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: #e0e0e0;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s, background-color 0.2s;
}

.autocomplete-clear-btn.visible {
    opacity: 1;
    visibility: visible;
}

.autocomplete-clear-btn:active {
    background: #ccc;
}

.autocomplete-clear-btn svg,
.autocomplete-clear-btn [data-lucide],
.autocomplete-clear-btn .fa {
    width: 16px;
    height: 16px;
    color: #666;
    font-size: 14px;
    line-height: 16px;
}

/* Results container */
.autocomplete-results {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px;
}

.autocomplete-results.no-results {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    color: #999;
    text-align: center;
}

/* Individual autocomplete items */
.autocomplete-item-mobile {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 12px;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 4px;
    margin: 2px 0;
    cursor: pointer;
    touch-action: manipulation;
    font-size: 14px;
    transition: background-color 0.2s;
}

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

.autocomplete-item-mobile:hover {
    background: #eeeeee;
    cursor: pointer;
}

.autocomplete-item-mobile:active,
.autocomplete-item-mobile.selected {
    background: #2a5a35;
    color: #ffffff;
}

.autocomplete-item-mobile.selected .location-icon,
.autocomplete-item-mobile.selected .country-name,
.autocomplete-item-mobile.selected .autocomplete-region {
    color: #ffffff !important;
}

/* Font Awesome Icon for POIs */
.autocomplete-item-mobile .location-icon {
    font-size: 14px;
    margin-right: 8px;
    color: #666666;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Unsichtbarer Platzhalter für normale Orte (ohne POI-Symbol) */
.autocomplete-item-mobile .location-icon-placeholder {
    visibility: hidden;
}

.autocomplete-item-mobile .location-info {
    flex: 1;
    overflow: hidden;
}

/* Main line with name and country */
.autocomplete-item-mobile .location-main {
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-item-mobile .station-name,
.autocomplete-item-mobile .city-name {
    font-weight: 500;
    color: #333333;
    font-size: 14px;
}

.autocomplete-item-mobile .country-name {
    color: #666666;
    font-size: 13px;
}

/* Region line below main text */
.autocomplete-item-mobile .autocomplete-region {
    font-size: 12px;
    color: #999999;
    padding-left: 28px;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* "Use custom input" button */
.autocomplete-use-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 16px;
    background: #f0f7f1;
    border-top: 1px solid #e0e0e0;
    color: #2a5a35;
    font-weight: 500;
    cursor: pointer;
    gap: 8px;
    min-height: 48px;
    flex-shrink: 0;
    transition: background-color 0.2s, color 0.2s;
}

.autocomplete-use-custom:active {
    background: #2a5a35;
    color: #ffffff;
}

.autocomplete-use-custom.hidden {
    display: none;
}

.autocomplete-use-custom i {
    font-size: 16px;
}

/* Loading state */
.autocomplete-results.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    color: #666;
}

.autocomplete-results.loading::after {
    content: 'Lade...';
    font-size: 14px;
}

/* Desktop: Hide mobile autocomplete completely */
@media (min-width: 769px) {
    .city-autocomplete-overlay {
        display: none !important;
    }
}
