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

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --border: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent: #4a9eff;
    --accent-hover: #6db3ff;
    --accent-dim: rgba(74, 158, 255, 0.15);
    --success: #3fb950;
    --warning: #d29922;
    --star: #e3b341;
    --radius: 10px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* Header */
#header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    position: relative;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand svg { width: 28px; height: 28px; }
.brand .accent { color: var(--accent); }

/* Search Bar */
#search-container {
    flex: 1;
    max-width: 520px;
    margin: 0 24px;
    position: relative;
}

#search-input {
    width: 100%;
    padding: 9px 16px 9px 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

#search-input::placeholder { color: var(--text-secondary); }

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

/* Header actions */
.header-actions {
    display: flex;
    gap: 8px;
}

.btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn:hover { border-color: var(--text-secondary); background: var(--border); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Main layout */
#main {
    display: flex;
    height: calc(100vh - 56px);
}

/* Sidebar */
#sidebar {
    width: 380px;
    min-width: 380px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 500;
}

/* Category filters */
#filters {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#filters::-webkit-scrollbar { height: 0; }

.filter-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.filter-btn:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.filter-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

/* Business list */
#business-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

#business-list::-webkit-scrollbar { width: 6px; }
#business-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.biz-card {
    padding: 14px;
    margin-bottom: 6px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.biz-card:hover { background: var(--bg-tertiary); border-color: var(--border); }
.biz-card.active { background: var(--accent-dim); border-color: var(--accent); }

.biz-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.biz-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.biz-category {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    text-transform: capitalize;
    flex-shrink: 0;
    margin-left: 8px;
}

.biz-address {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.biz-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.stars { color: var(--star); letter-spacing: 1px; }
.rating-num { color: var(--text-secondary); font-size: 12px; }

/* Map */
#map-container { flex: 1; position: relative; }
#map { width: 100%; height: 100%; }

/* Dark map tiles */
.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(1.1) saturate(0.3); }
.leaflet-control-zoom a {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}
.leaflet-control-attribution { display: none !important; }

/* Detail panel */
#detail-panel {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 420px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    z-index: 800;
}

#detail-panel.visible { display: block; }

.detail-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    line-height: 1;
}

.detail-close:hover { color: var(--text-primary); }

.detail-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.detail-cat { font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.detail-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary); margin-bottom: 6px; }
.detail-row svg { flex-shrink: 0; width: 16px; height: 16px; }
.detail-desc { margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--text-secondary); }
.detail-rating { margin-top: 10px; }

/* Add business modal */
#modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

#modal-overlay.visible { display: flex; }

#add-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

#add-modal h2 { font-size: 18px; margin-bottom: 20px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 5px; }

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--accent);
}

.form-group textarea { resize: vertical; min-height: 60px; }
.form-group select { appearance: none; cursor: pointer; }

.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

.result-count {
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
    #sidebar { width: 100%; min-width: 100%; position: absolute; height: 45%; bottom: 0; border-right: none; border-top: 1px solid var(--border); z-index: 600; }
    #map-container { height: 55%; }
    #main { flex-direction: column; }
}
