* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', sans-serif;
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: #f5f5f5;
}

/* --- Sidebar --- */
#sidebar {
    width: 340px;
    min-width: 340px;
    height: 100vh;
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

/* --- Header --- */
#sidebar-header {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: #1a1a2e;
    color: white;
    flex-shrink: 0;
}

#sidebar-header h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* --- Source + Language combined bar --- */
#source-lang-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

#source-toggle {
    display: flex;
    gap: 3px;
    flex: 1;
}

#source-toggle button {
    flex: 1;
    padding: 4px 2px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
}

#source-toggle button:hover {
    background: #f0f0f0;
}

#lang-toggle {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

#lang-en-btn,
#lang-de-btn {
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1.5px solid #ddd;
    background: white;
    color: #888;
}

/* --- Filters (collapsible) --- */
#filters {
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
    flex-shrink: 0;
}

#filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    cursor: pointer;
    user-select: none;
}

#filters-header:hover {
    background: #f0f0f0;
}

#filters-header-label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

#filters-chevron {
    font-size: 10px;
    color: #999;
}

#filters-body {
    padding: 6px 12px 10px;
}

#filters-body > div {
    margin-bottom: 6px !important;
}

#filters-body input[type="number"],
#filters-body input[type="text"] {
    padding: 5px 8px !important;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 12px;
    background: white;
    color: #333;
}

#filters-body input:focus,
#filters-body select:focus {
    outline: none;
    border-color: #4a90d9;
}

#filters-body select {
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 12px;
    background: white;
    color: #333;
}

/* Checkbox labels in filters */
#filters-body label[style*="display:flex"] {
    font-size: 11px !important;
}

/* Apply / Reset button row */
#apply-filters {
    flex: 1;
    padding: 7px;
    background: #1a1a2e;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.2px;
    margin-top: 0;
}

#apply-filters:hover {
    background: #2d2d4e;
}

#reset-filters {
    padding: 7px 12px !important;
    background: white;
    color: #e53935 !important;
    border: 2px solid #e53935 !important;
    border-radius: 5px !important;
    font-size: 12px !important;
    cursor: pointer;
}

/* --- Stats bar --- */
#stats-bar {
    padding: 5px 12px;
    background: #eef2ff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
}

.stat-value {
    font-size: 12px;
    font-weight: 700;
    color: #1a1a2e;
}

/* --- Listings list --- */
#listings-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
}

.listing-card {
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 7px;
    padding: 8px 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.listing-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    border-color: #ccc;
}

.listing-card.active {
    border-color: #4a90d9;
    box-shadow: 0 2px 8px rgba(74,144,217,0.25);
}

.card-title {
    font-size: 12px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    font-size: 11px;
    color: #666;
    margin: 1px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-price {
    font-size: 14px;
    font-weight: 700;
    color: #2e7d32;
    margin: 2px 0;
}

.card-district {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-coords {
    opacity: 0.5;
    border-left: 3px solid #ddd;
}

.badge-swap {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    background: #E6F1FB;
    color: #185FA5;
    margin-right: 3px;
}

.badge-check {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    background: #FAEEDA;
    color: #854F0B;
}

/* --- Load more --- */
#load-more-container {
    padding: 7px 10px 8px;
    text-align: center;
    flex-shrink: 0;
}

#load-more-btn {
    width: 100%;
    padding: 7px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f8f9fa;
    color: #666;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    letter-spacing: 0.2px;
}

#load-more-btn:hover {
    background: #ebebeb;
    border-color: #bbb;
    color: #444;
}

/* --- Map --- */
#map {
    flex: 1;
    height: 100vh;
}

/* --- Popup --- */
.popup-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 6px;
    max-width: 220px;
}

.popup-price {
    font-size: 18px;
    font-weight: 700;
    color: #2e7d32;
    margin-bottom: 4px;
}

.popup-meta {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.popup-desc {
    font-size: 12px;
    color: #444;
    margin-bottom: 10px;
    max-height: 60px;
    overflow: hidden;
}

.popup-link {
    display: inline-block;
    padding: 6px 14px;
    background: #1a1a2e;
    color: white;
    border-radius: 5px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
}

.popup-link:hover {
    background: #2d2d4e;
}

/* --- Loading indicator --- */
#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    color: #555;
    z-index: 9999;
    display: none;
}

/* --- Filter/checkbox label compatibility --- */
.filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    align-items: center;
}

.filter-row label {
    font-size: 11px;
    color: #555;
    width: 80px;
    flex-shrink: 0;
}

.filter-row input,
.filter-row select {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 12px;
    background: white;
    color: #333;
}

.filter-row input:focus,
.filter-row select:focus {
    outline: none;
    border-color: #4a90d9;
}
