/* Smart Address Autocomplete Styles */

/* Address Input Container */
.address-input-container {
    position: relative;
    width: 100%;
}

/* Input styling improvements */
.address-input-container input {
    width: 100%;
    padding: 0.8rem 3rem 0.8rem 0.8rem; /* Extra right padding for location button */
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.address-input-container input:focus {
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
    outline: none;
}

/* Current Location Button */
.current-location-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.current-location-btn:hover {
    background: #45a049;
    transform: translateY(-50%) scale(1.05);
}

.current-location-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    animation: pulse 1s infinite;
}

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

/* Suggestions Dropdown */
.address-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-height: 350px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: 1px;
}

/* Individual suggestion items */
.suggestion-item {
    padding: 0;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background-color 0.2s;
    display: block;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
    background: #f8f9fa;
}

.suggestion-item:last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

.suggestion-content {
    display: flex;
    align-items: center;
    padding: 1rem;
    gap: 0.8rem;
}

.suggestion-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.suggestion-text {
    flex: 1;
    min-width: 0;
}

.suggestion-main {
    font-weight: 600;
    color: #2c5530;
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.suggestion-main strong {
    background: rgba(76, 175, 80, 0.2);
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
    font-weight: 700;
}

.suggestion-sub {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.3;
    word-wrap: break-word;
}

/* Loading state */
.suggestion-loading,
.suggestion-no-results,
.suggestion-error {
    background: #f9f9f9;
}

.suggestion-loading .suggestion-main {
    color: #666;
    font-weight: normal;
}

.suggestion-no-results .suggestion-main {
    color: #999;
    font-weight: normal;
}

.suggestion-error .suggestion-main {
    color: #d32f2f;
    font-weight: normal;
}

/* Selected Address Display */
.address-selected {
    background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 100%);
    padding: 0.8rem;
    border-radius: 8px;
    border: 2px solid #4caf50;
    margin-top: 0.5rem;
    position: relative;
    overflow: hidden;
}

.address-selected::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: #4caf50;
}

.address-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.address-main strong {
    color: #2e7d32;
    font-size: 1.05rem;
}

.country-flag {
    font-size: 1.2rem;
    margin-left: 0.5rem;
}

.address-details {
    color: #558b2f;
    font-size: 0.9rem;
    font-style: italic;
}

/* Form enhancements */
.form-group.has-autocomplete {
    margin-bottom: 1.5rem;
}

.form-group.has-autocomplete label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c5530;
}

/* Address popup in map */
.address-popup h4 {
    margin: 0 0 0.5rem 0;
    color: #2e7d32;
    font-size: 1.1rem;
}

.address-popup p {
    margin: 0 0 0.5rem 0;
    color: #666;
    font-size: 0.9rem;
}

.address-popup small {
    color: #999;
    font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .suggestion-content {
        padding: 0.8rem;
        gap: 0.6rem;
    }
    
    .suggestion-main {
        font-size: 0.95rem;
    }
    
    .suggestion-sub {
        font-size: 0.8rem;
    }
    
    .current-location-btn {
        padding: 0.3rem 0.5rem;
        font-size: 1rem;
    }
    
    .address-selected {
        padding: 0.7rem;
    }
    
    .address-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    
    .country-flag {
        margin-left: 0;
    }
}

/* Accessibility improvements */
.suggestion-item:focus-visible {
    outline: 2px solid #4caf50;
    outline-offset: -2px;
}

.current-location-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .address-suggestions {
        background: #2d2d2d;
        border-color: #555;
        box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    }
    
    .suggestion-item:hover,
    .suggestion-item.highlighted {
        background: #3d3d3d;
    }
    
    .suggestion-main {
        color: #81c784;
    }
    
    .suggestion-sub {
        color: #bbb;
    }
    
    .address-selected {
        background: linear-gradient(135deg, #1e3a1e 0%, #2d4a2d 100%);
        border-color: #4caf50;
    }
    
    .address-main strong {
        color: #81c784;
    }
    
    .address-details {
        color: #a5d6a7;
    }
}