/* ── topbar.css ── */

#topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    z-index: 900;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 14px;
}

/* Version badge */
#version-badge {
    font-size: 10px;
    color: var(--text-3);
    letter-spacing: 0.04em;
    flex-shrink: 0;
    opacity: 0.6;
}

/* Brand */
#brand {
    display: flex;
    align-items: baseline;
    gap: 9px;
    flex-shrink: 0;
}
.brand-wordmark {
    font-family: var(--font-display);
    font-size: 20px;
    color: var(--text-1);
    letter-spacing: 0.06em;
    line-height: 1;
}
.brand-sub {
    font-size: 10px;
    color: var(--text-3);
    letter-spacing: 0.04em;
    font-weight: 400;
    white-space: nowrap;
}

/* Center */
#topbar-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tb-group {
    display: flex;
    align-items: center;
    gap: 7px;
}
.tb-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
}

/* Basemap pill */
.basemap-pill {
    display: flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 3px;
    gap: 2px;
}
.bm-btn {
    padding: 3px 11px;
    border-radius: 100px;
    font-size: 12px;
    color: var(--text-2);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.bm-btn:hover { color: var(--text-1); }
.bm-btn.active {
    background: var(--surface);
    color: var(--accent);
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

/* Right nav */
#topbar-right {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.tb-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: var(--r-sm);
    font-size: 12px;
    color: var(--text-2);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.tb-btn:hover { background: var(--surface-2); color: var(--text-1); }
.tb-btn.active {
    background: var(--accent-lt);
    color: var(--accent);
    font-weight: 500;
}
.tb-btn svg { flex-shrink: 0; }

.tb-btn--browse {
    background: var(--accent);
    color: #fff !important;
    font-weight: 500;
    padding: 6px 13px;
    border-radius: var(--r-md);
    margin-left: 4px;
}
.tb-btn--browse:hover { background: var(--accent-hover) !important; }

.tb-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}

/* Custom style popover */
.bm-custom-wrap {
    position: relative;
}

#bm-custom-popover {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    padding: 12px 14px;
    width: 320px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#bm-custom-popover::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px; height: 10px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
    transform: translateX(-50%) rotate(45deg);
}

#bm-custom-popover label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-3);
}

#bm-custom-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 12px;
    font-family: 'Courier New', monospace;
    color: var(--text-1);
    background: var(--bg);
    outline: none;
    transition: border-color 0.15s;
}
#bm-custom-input:focus { border-color: var(--accent); }

.bm-popover-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.bm-pop-cancel {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 12px;
    color: var(--text-2);
    background: var(--surface-2);
    transition: background 0.15s;
}
.bm-pop-cancel:hover { background: var(--border); }

.bm-pop-apply {
    padding: 5px 14px;
    background: var(--accent);
    color: #fff;
    border-radius: var(--r-sm);
    font-size: 12px;
    font-weight: 500;
    transition: background 0.15s;
}
.bm-pop-apply:hover { background: var(--accent-hover); }
