:root {
    --bg: #0f1419;
    --panel: #171d26;
    --card: #1f2733;
    --card-hover: #283342;
    --line: #2c3645;
    --text: #e6edf3;
    --muted: #8b97a7;
    --accent: #4cc2ff;
    --accent-d: #1f8fd0;
    --danger: #ff6b6b;
    --ok: #5ad17f;
    --radius: 12px;
}

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

html, body { height: 100%; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ---- Panel ---- */
#panel {
    width: 360px;
    flex-shrink: 0;
    background: var(--panel);
    border-right: 1px solid var(--line);
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#panel header h1 {
    font-size: 1.4rem;
    letter-spacing: -0.3px;
}
.sub {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 6px;
    line-height: 1.4;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
}

.field-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 10px;
}
.field-label strong { color: var(--accent); }

/* ---- Inputs ---- */
input[type=text] {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 0.9rem;
    min-width: 0;
}
input[type=text]:focus { outline: none; border-color: var(--accent); }

.search-row { display: flex; gap: 8px; }

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: background 0.15s, transform 0.05s;
}
button:active { transform: translateY(1px); }

.search-row button {
    background: var(--accent);
    color: #04161f;
    font-weight: 600;
    padding: 0 14px;
    white-space: nowrap;
}
.search-row button:hover { background: #6fd0ff; }

.btn-row { display: flex; gap: 8px; margin-top: 8px; }
.ghost {
    flex: 1;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text);
    padding: 8px;
}
.ghost:hover { background: var(--card-hover); }

.hint {
    color: var(--muted);
    font-size: 0.78rem;
    margin-top: 10px;
    line-height: 1.45;
}

/* ---- Segmented (profile) ---- */
.seg { display: flex; gap: 6px; }
.seg button {
    flex: 1;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--line);
    padding: 9px 4px;
}
.seg button.active {
    background: var(--accent);
    color: #04161f;
    border-color: var(--accent);
    font-weight: 600;
}

/* ---- Range ---- */
input[type=range] {
    width: 100%;
    accent-color: var(--accent);
    margin: 4px 0 10px;
}

.preset-row { display: flex; gap: 6px; margin-bottom: 12px; }
.preset-row button {
    flex: 1;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--line);
    padding: 7px 0;
}
.preset-row button.active { background: var(--accent); color: #04161f; font-weight: 600; }

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--muted);
    cursor: pointer;
}
.check input { accent-color: var(--accent); }

/* ---- Primary CTA ---- */
.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-d));
    color: #04161f;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 13px;
    border-radius: var(--radius);
}
.primary:hover { filter: brightness(1.08); }
.primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Result ---- */
.result h2 { font-size: 1rem; margin-bottom: 10px; }
#resultList { list-style: none; display: flex; flex-direction: column; gap: 8px; }
#resultList li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.86rem;
}
#resultList .swatch {
    width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.3);
}
#resultList .area { color: var(--muted); margin-left: auto; }

/* ---- Ingatlan panel ---- */
#propsInput {
    width: 100%;
    min-height: 70px;
    resize: vertical;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 8px;
    padding: 9px 11px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.74rem;
    line-height: 1.4;
    margin-bottom: 8px;
}
#propsInput:focus { outline: none; border-color: var(--accent); }
.primary.small { padding: 9px; font-size: 0.85rem; flex: 2; }
#propsCard .btn-row button.ghost { flex: 1; }
#propsStatus { color: var(--accent); font-weight: 600; }

#propsList { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
#propsList li {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.8rem;
    cursor: pointer;
}
#propsList li:hover { border-color: var(--accent); background: var(--card-hover); }
#propsList .p-price { font-weight: 700; color: var(--accent); }
#propsList .p-meta { color: var(--muted); font-size: 0.74rem; margin-top: 2px; }
#propsList a { color: var(--accent); text-decoration: none; }

/* Ár-marker a térképen */
.price-marker {
    background: var(--accent);
    color: #04161f;
    font-weight: 700;
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    border: 1px solid #04161f;
}

.err {
    background: rgba(255,107,107,0.12);
    border: 1px solid var(--danger);
    color: #ffb3b3;
    padding: 11px;
    border-radius: 8px;
    font-size: 0.84rem;
}

footer p {
    color: #5f6b7a;
    font-size: 0.7rem;
    line-height: 1.5;
    margin-top: auto;
}

/* ---- Map ---- */
#map { flex: 1; height: 100%; background: #0a0e13; }

#spinner {
    position: absolute;
    top: 16px; right: 16px;
    z-index: 1000;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 9px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.dot {
    width: 11px; height: 11px;
    border: 2px solid var(--accent);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Leaflet popup dark theme */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: var(--panel);
    color: var(--text);
}
.leaflet-popup-content { font-size: 0.85rem; }

/* ---- Mobile ---- */
@media (max-width: 720px) {
    #app { flex-direction: column; }
    #panel {
        width: 100%;
        height: auto;
        max-height: 52vh;
        border-right: none;
        border-bottom: 1px solid var(--line);
        order: 2;
    }
    #map { order: 1; min-height: 48vh; }
}
