/* ===== Theme ===== */
:root {
    --bg: #f4f1ed;
    --ink: #1f1f1f;
    --muted: #6b6259;
    --accent: #c15f2f;
    --panel: #ffffff;
    --panel-border: #e2d9cf;
    --shadow: 0 10px 30px rgba(0,0,0,0.08);
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html, body {
    height: 100%;
}
body {
    margin: 0;
    font-family: "Fira Sans", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at 20% -10%, #fbe7d8 0%, transparent 60%),
        radial-gradient(1000px 500px at 120% 10%, #e9f1f6 0%, transparent 55%),
        var(--bg);
}

/* ===== Topbar / Controls ===== */
#fuse-search {
    width: min(420px, 100%);
    padding: 10px 12px;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow);
}

#result-count {
    margin-left: auto;
    font-size: 14px;
    color: var(--muted);
}

.status {
    font-size: 13px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 4px 8px;
}

.status.error {
    color: #8a2f1f;
    background: #ffe9e4;
    border-color: #f2c1b7;
}

.hidden {
    display: none;
}

/* ===== App Layout ===== */
.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Topbar ===== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: linear-gradient(180deg, rgba(244,241,237,0.95) 0%, rgba(244,241,237,0.8) 100%);
    padding: 10px 14px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--panel-border);
    backdrop-filter: blur(6px);
}

/* ===== View Toggle ===== */
.toggle {
    display: inline-flex;
    background: #fff;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.toggle button {
    border: 0;
    padding: 8px 12px;
    background: transparent;
    font-weight: 600;
    cursor: pointer;
}

.toggle button.active {
    background: var(--accent);
    color: #fff;
}


/* ===== Views ===== */
.view {
    flex: 1;
    display: none;
    padding: 12px 16px 20px;
    min-height: 0;
}

.view.active {
    display: flex;
    flex-direction: column;
}

/* ===== Map ===== */
#map {
    flex: 1;
    min-height: 0;
    width: 100%;
    border-radius: 14px;
    box-shadow: var(--shadow);
    border: 1px solid var(--panel-border);
    overflow: hidden;
}

/* ===== Table ===== */
#table-container {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 10px;
    width: 100%;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* ===== Leaflet Controls ===== */
.leaflet-control.filter-control {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    padding: 8px 10px;
    font-family: "Fira Sans", sans-serif;
    backdrop-filter: blur(4px);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    max-width: calc(100vw - 40px);
    overflow-x: auto;
}

.leaflet-control.filter-control label {
    display: inline-flex;
    align-items: center;
    line-height: 1.35;
    margin-bottom: 0;
    white-space: nowrap;
}


/* ===== Responsive ===== */
@media (max-width: 560px) {
    .view { padding: 8px 10px 16px; }
    #fuse-search { width: 100%; }
}

/* ===== Tabulator ===== */
/* Allow wrapping for long text */
.tabulator .tabulator-cell {
    white-space: normal;
    line-height: 1.25;
}

.tabulator .tabulator-row {
    height: auto;
}

.tabulator .tabulator-row:hover {
    background: #faf6f2;
}

.tabulator .tabulator-cell.pin-cell {
    cursor: pointer;
    font-size: 16px;
}

#location-table {
    flex: 1;
    min-height: 0;
}
