/* ── Legacy control panel base ─────────────────────────────────────────── */
.control-panel {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    font-size: 12px;
    max-height: 80vh;
    overflow-y: auto;
    backdrop-filter: blur(4px);
}

#layer-panel {
    top: 10px;
    right: 10px;
    min-width: 200px;
}

#map-style-panel {
    top: 10px;
    left: 10px;
    min-width: 180px;
}

.control-panel h3,
#control-panel-merged h3 {
    margin: 0 0 10px 0;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    border: none;
    padding: 0;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

/* ── Layer list items ───────────────────────────────────────────────────── */
.layer-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 4px 0;
}

.layer-item input {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #4CAF50;
}

.layer-item label {
    cursor: pointer;
    user-select: none;
    color: #333;
    font-size: 11px;
}

/* ── Map style buttons ──────────────────────────────────────────────────── */
.style-button {
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 6px;
    border: 1.5px solid #ddd;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    color: #2c3e50;
    transition: all 0.2s ease;
}

.style-button:hover {
    background: #e8f0f7;
    border-color: #4CAF50;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.1);
}

.style-button.active {
    background: #4CAF50;
    color: white;
    border-color: #45a049;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

/* ── Merged control panel (layers + styles slide-out) ───────────────────── */
#control-panel-merged {
    position: absolute;
    top: 50px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    font-size: 12px;
    max-height: 80vh;
    overflow-y: auto;
    backdrop-filter: blur(4px);
    min-width: 200px;
    display: none;
}

#control-panel-merged.visible {
    display: block;
}

/* Visual connection bridge to the button above */
#control-panel-merged::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 8px;
    width: 24px;
    height: 6px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 3px 3px 0 0;
}

#control-panel-merged .section-divider {
    margin: 12px 0;
    padding: 4px 0;
    border-top: 1px solid #eee;
}

/* ── Hillshade slider ───────────────────────────────────────────────────── */
.hillshade-control {
    margin-top: 4px;
}

.hillshade-control label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    cursor: pointer;
}

.hillshade-control input[type=range] {
    width: 100%;
    margin-top: 4px;
    accent-color: #4CAF50;
}

.layer-group-header {
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    margin-bottom: 6px;
}

.layer-group-header:hover {
    background: #f0f0f0;
    border-radius: 3px;
    padding: 4px 0;
}

.layer-group-children {
    display: none;
    margin-left: 12px;
    margin-top: 4px;
}

/* ── Top-right button row ───────────────────────────────────────────────── */
#control-panel-top-right {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 1000;
    pointer-events: auto;
    align-items: center;
    justify-content: flex-end;
}

/* ── Hamburger dropdown menu ────────────────────────────────────────────── */
#ham-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1001; /* below ham-menu (1002) but above map layers */
}
#ham-overlay.open { display: block; }

#ham-menu {
    position: absolute;
    top: 58px;
    right: 10px;
    background: rgba(255,255,255,0.97);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    z-index: 1002;
    min-width: 180px;
    overflow: hidden;
    display: none;
    flex-direction: column;
}

#ham-menu.open {
    display: flex;
}

.ham-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 15px;
    font-family: system-ui, sans-serif;
    color: #2c3e50;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
    transition: background 0.15s;
}

.ham-item:hover {
    background: #f5f5f5;
}

.ham-item.active {
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
}

.ham-item + .ham-item {
    border-top: 1px solid #eee;
}
