/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

#map {
    height: 100vh;
    width: 100vw;
}

/* ==================== LOADING ==================== */
#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 1000;
    text-align: center;
}

#loading i {
    font-size: 48px;
    color: #007bff;
    display: block;
    margin-bottom: 15px;
}

#loading p {
    color: #666;
    margin-top: 10px;
    font-size: 14px;
}

/* ==================== TOOLBAR ==================== */
.toolbar {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.toolbar-item {
    position: relative;
}

.toolbar-btn {
    background: white;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.toolbar-btn:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
}

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

/* ==================== SEARCH BOX ==================== */
.search-box {
    display: flex;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    overflow: hidden;
}

.search-box input {
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    width: 250px;
    outline: none;
}

.search-box button {
    background: #adbbca;
    color: white;
    border: none;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.search-box button:hover {
    background: #9ca3aa;
}

.search-results {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    max-height: 400px;
    overflow-y: auto;
    min-width: 300px;
    display: none;
    z-index: 1001;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: #f8f9fa;
}

.search-result-item strong {
    display: block;
    color: #333;
    margin-bottom: 4px;
}

.search-result-item small {
    color: #666;
}

/* ==================== DROPDOWN MENU ==================== */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    padding: 15px;
    min-width: 220px;
    display: none;
    z-index: 1001;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-menu h3 {
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #c4cbd3;
    font-size: 16px;
    color: #333;
}

/* ==================== CHECKBOX ITEMS ==================== */
.checkbox-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    gap: 10px;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.color-dot.functional { background: #2ca02c; }
.color-dot.construction { background: #ff7f0e; }
.color-dot.proposed { background: #1f77b4; }

.checkbox-item .count {
    margin-left: auto;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

/* ==================== LANG OPTIONS ==================== */
.lang-option {
    display: block;
    width: 100%;
    padding: 10px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.2s;
    font-size: 14px;
}

.lang-option:hover {
    background: #f8f9fa;
}

.lang-option.active {
    background: #adbbca;
    color: white;
}

.lang-option i {
    margin-right: 8px;
    width: 20px;
}

/* ==================== LAST UPDATE ==================== */
.last-update {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-size: 12px;
    white-space: nowrap;
}

.last-update small {
    color: #666;
    margin-right: 5px;
}

.last-update span {
    font-weight: bold;
    color: #363f28;
}

#refreshBtn.spinning i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==================== POPUP ==================== */
.popup-content {
    max-height: 300px;
    overflow-y: auto;
}

.popup-content h3 {
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #adbbca;
    color: #333;
}

.popup-section {
    margin-bottom: 12px;
}

.popup-section-title {
    font-weight: bold;
    color: #16181a;
    margin-bottom: 5px;
    font-size: 13px;
}

.popup-tag {
    display: list-item;
    background: #f8f9fa;
    padding: 3px 8px;
    margin: 5px;
    border-radius: 4px;
    font-size: 12px;
    border-left: 3px solid #adbbca;
}

.popup-tag-key {
    font-weight: bold;
    color: #333;
}

.popup-tag-value {
    color: #666;
}

.popup-link {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 13px;
    transition: background 0.3s;
}

.popup-link:hover {
    background: #e7eaee;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .toolbar {
        top: auto;
        bottom: 10px;
        right: 10px;
        left: 10px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .search-box input {
        width: 150px;
    }
    
    .dropdown-menu {
        right: auto;
        left: 0;
    }
    
    .search-results {
        right: auto;
        left: 0;
        min-width: 250px;
    }
}