/* ── Base ───────────────────────────────── */
body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f7f9fc;
}

#map {
    height: 100vh;
    width: 100%;
    z-index: 1;
}

/* ── Left Control Panel ─────────────────── */
.overlay-info {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    max-width: 280px;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.overlay-info h1 {
    margin: 0 0 6px 0;
    font-size: 17px;
    color: #222;
    font-weight: 700;
}

.overlay-info p {
    margin: 4px 0;
    font-size: 12px;
    color: #666;
    line-height: 1.5;
}

.file-input-container {
    margin-top: 14px;
}

.status {
    margin-top: 10px;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 4px;
    display: none;
}

.status.loading {
    display: block;
    background: #e3f2fd;
    color: #1565c0;
}

.status.error {
    display: block;
    background: #ffebee;
    color: #c62828;
}

.status.success {
    display: block;
    background: #e8f5e9;
    color: #2e7d32;
}

/* ── Buttons ────────────────────────────── */
.toggle-btn {
    margin-top: 10px;
    width: 100%;
    padding: 8px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    transition: background 0.25s;
}

.toggle-btn.active {
    background: #ff9800;
}

.toggle-btn:hover {
    opacity: 0.88;
}

.clear-btn {
    margin-top: 8px;
    width: 100%;
    padding: 8px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    transition: background 0.25s;
}

.clear-btn:hover {
    background: #d32f2f;
}

.road-btn {
    margin-top: 8px;
    width: 100%;
    padding: 8px;
    background: #795548;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    transition: background 0.25s;
}

.road-btn.active {
    background: #FFD600;
    color: #222;
}

.road-btn:hover {
    opacity: 0.88;
}

/* ── Measurement Labels ─────────────────── */
.dist-label {
    background: white;
    border: 1.5px solid #333;
    padding: 3px 7px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 13px;
    white-space: nowrap;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.road-label {
    background: #fff8e1;
    border-color: #FFD600;
    color: #5d4037;
}

/* ── Right Layer Panel ──────────────────── */
.layer-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    width: 240px;
    max-height: calc(100vh - 60px);
    background: rgba(255, 255, 255, 0.97);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.13);
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(6px);
}

.layer-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    background: linear-gradient(135deg, #2196F3, #1565c0);
    color: white;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.layer-panel-title {
    letter-spacing: 0.02em;
}

.layer-count {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
}

.layer-panel-body {
    overflow-y: auto;
    flex: 1;
    padding: 6px 0;
}

.layer-empty {
    text-align: center;
    color: #aaa;
    font-size: 12px;
    padding: 20px 10px;
}

/* ── Layer Items ────────────────────────── */
.layer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.layer-item:last-child {
    border-bottom: none;
}

.layer-item:hover {
    background: #f5f9ff;
}

.layer-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.layer-item-index {
    font-size: 11px;
    color: #888;
    font-weight: 600;
    min-width: 22px;
}

.layer-item-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.layer-item-dist {
    font-size: 13px;
    color: #1a237e;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-item-dist.road-dist {
    color: #827717;
}

.layer-item-del {
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    color: #f44336;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 7px;
    margin-left: 6px;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    line-height: 1.4;
}

.layer-item-del:hover {
    background: #f44336;
    color: white;
    border-color: #f44336;
}