/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    height: 100vh;
    overflow: hidden;
    background-color: #f5f5f5;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

/* Header Styles */
.header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
}

.header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.search-container {
    display: flex;
    flex: 1;
    min-width: 200px;
    gap: 0.5rem;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

#search-input {
    flex: 1;
    padding: 0.5rem 2rem 0.5rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 150px;
}

#search-input:focus {
    outline: none;
    border-color: #3498db;
}

.search-clear-btn {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: #999;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    z-index: 1;
}

.search-clear-btn:hover {
    color: #333;
}

.search-clear-btn:active {
    color: #000;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
    white-space: nowrap;
    min-height: 44px; /* Touch-friendly */
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.provider-selector {
    min-width: 150px;
}

#map-provider-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: white;
    cursor: pointer;
    min-height: 44px; /* Touch-friendly */
}

/* Toolbar Styles */
.toolbar {
    display: flex;
    background-color: white;
    padding: 0.5rem;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 999;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.toolbar-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toolbar-btn:hover {
    background-color: #f0f0f0;
    border-color: #3498db;
}

.toolbar-btn:active {
    background-color: #e0e0e0;
}

.toolbar-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.toolbar-style-selector {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.toolbar-select {
    min-width: 120px;
    min-height: 44px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.toolbar-select:hover {
    border-color: #3498db;
}

.toolbar-select:focus {
    outline: none;
    border-color: #3498db;
}

/* Map Container */
.map-container {
    flex: 1;
    width: 100%;
    position: relative;
    min-height: 300px;
}

.map-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
}

/* Status Message */
.status-message {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    z-index: 10001;
    display: none;
    max-width: 90%;
    text-align: center;
}

.status-message.show {
    display: block;
    animation: fadeIn 0.3s;
}

.status-message.error {
    background-color: rgba(231, 76, 60, 0.9);
}

.status-message.success {
    background-color: rgba(46, 204, 113, 0.9);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Responsive Design - Mobile */
@media (max-width: 767px) {
    .header h1 {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container {
        width: 100%;
    }

    .btn {
        width: 100%;
    }

    .provider-selector {
        width: 100%;
    }

    .toolbar {
        padding: 0.5rem;
    }

    .toolbar-btn {
        min-width: 40px;
        min-height: 40px;
        font-size: 1rem;
    }
}

/* Responsive Design - Tablet */
@media (min-width: 768px) and (max-width: 1024px) {
    .header {
        padding: 0.75rem;
    }

    .header h1 {
        font-size: 1.3rem;
    }

    .controls {
        gap: 0.75rem;
    }
}

/* Loading indicator */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 1rem 2rem;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: none;
}

.loading.show {
    display: block;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Autocomplete Styles */
.search-container {
    position: relative;
}

.autocomplete-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1001;
    display: none;
    margin-top: -1px;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #333;
    background-color: white;
}

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

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: #e3f2fd;
    color: #1976d2;
}

.autocomplete-item:active {
    background-color: #e0f0ff;
}

/* Mobile autocomplete adjustments */
@media (max-width: 767px) {
    .autocomplete-container {
        max-height: 200px;
    }

    .autocomplete-item {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
}

