/* ── Battle Map — Dark Ocean Theme ── */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0a0e17;
    color: #c8d6e5;
    overflow: hidden;
    height: 100vh;
}

/* ── Layout ── */
.bm-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.bm-sidebar {
    width: 340px;
    min-width: 340px;
    background: #0d1321;
    border-right: 1px solid #1a2238;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 1000;
}

.bm-map-wrap {
    flex: 1;
    position: relative;
}

#battleMap {
    width: 100%;
    height: 100%;
    background: #0a0e17;
}

/* ── Sidebar Header ── */
.bm-header {
    padding: 20px 18px 14px;
    border-bottom: 1px solid #1a2238;
}

.bm-header h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f5f6fa;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.bm-header .bm-subtitle {
    font-size: 0.72rem;
    color: #636e85;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

/* ── Stat Cards ── */
.bm-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid #1a2238;
}

.bm-stat {
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 6px;
    padding: 10px 10px 8px;
}

.bm-stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f5f6fa;
    line-height: 1.2;
}

.bm-stat-label {
    font-size: 0.65rem;
    color: #636e85;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 2px;
}

/* ── Section Blocks ── */
.bm-section {
    padding: 14px 18px;
    border-bottom: 1px solid #1a2238;
}

.bm-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #636e85;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 10px;
}

/* ── Legend ── */
.bm-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    cursor: pointer;
    transition: opacity 0.2s;
}

.bm-legend-item:hover { opacity: 0.8; }

.bm-legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.15);
}

.bm-legend-text {
    flex: 1;
}

.bm-legend-name {
    font-size: 0.78rem;
    color: #dfe6e9;
    font-weight: 500;
}

.bm-legend-density {
    font-size: 0.65rem;
    color: #636e85;
}

/* ── Zone Visual ── */
.bm-zone-visual {
    margin-bottom: 10px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #1e293b;
}

.bm-zone-visual img {
    display: block;
    width: 100%;
    height: auto;
}

/* ── Charts ── */
.bm-chart-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.bm-chart-label {
    font-size: 0.72rem;
    color: #b2bec3;
    width: 120px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bm-chart-bar-wrap {
    flex: 1;
    height: 10px;
    background: #1e293b;
    border-radius: 5px;
    overflow: hidden;
}

.bm-chart-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease;
}

.bm-chart-pct {
    font-size: 0.65rem;
    color: #636e85;
    width: 32px;
    text-align: right;
    flex-shrink: 0;
}

/* ── Current Legend ── */
.bm-current-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.bm-current-line {
    width: 24px;
    height: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}

.bm-current-name {
    font-size: 0.72rem;
    color: #b2bec3;
}

.bm-current-speed {
    font-size: 0.62rem;
    color: #636e85;
    margin-left: auto;
}

/* ── Zone Notes (sidebar callout) ── */
.bm-zone-notes {
    padding: 10px 18px;
    background: #111827;
    border-bottom: 1px solid #1a2238;
    border-left: 3px solid #ffd700;
    font-size: 0.73rem;
    color: #b2bec3;
    line-height: 1.5;
}

/* ── Info Panel (on-map overlay) ── */
.bm-info-panel {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(13, 19, 33, 0.92);
    border: 1px solid #1a2238;
    border-radius: 8px;
    padding: 14px 16px;
    max-width: 300px;
    z-index: 1000;
    display: none;
    backdrop-filter: blur(8px);
}

.bm-info-panel.visible { display: block; }

.bm-info-panel h3 {
    font-size: 0.85rem;
    color: #f5f6fa;
    margin-bottom: 6px;
}

.bm-info-panel p {
    font-size: 0.75rem;
    color: #b2bec3;
    line-height: 1.5;
}

.bm-info-panel .bm-info-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: #636e85;
    font-size: 1rem;
    cursor: pointer;
}

.bm-info-panel .bm-info-close:hover { color: #f5f6fa; }

/* ── Map Controls Override ── */
.leaflet-control-zoom a {
    background: #111827 !important;
    color: #c8d6e5 !important;
    border-color: #1e293b !important;
}

.leaflet-control-zoom a:hover {
    background: #1e293b !important;
}

.leaflet-control-attribution {
    background: rgba(13, 19, 33, 0.8) !important;
    color: #636e85 !important;
    font-size: 0.6rem !important;
}

.leaflet-control-attribution a { color: #74b9ff !important; }

/* ── Depth Profile (canvas sidebar) ── */
.bm-depth-diagram {
    display: flex;
    align-items: stretch;
    gap: 6px;
    height: 120px;
}

.bm-depth-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.bm-depth-bar {
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}

.bm-depth-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 50px;
    flex-shrink: 0;
}

.bm-depth-label {
    font-size: 0.6rem;
    color: #636e85;
}

/* ── Toggle Layers ── */
.bm-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    user-select: none;
}

.bm-toggle input[type="checkbox"] {
    accent-color: #74b9ff;
    width: 14px;
    height: 14px;
}

.bm-toggle-label {
    font-size: 0.75rem;
    color: #b2bec3;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .bm-sidebar {
        width: 280px;
        min-width: 280px;
    }
}

@media (max-width: 700px) {
    .bm-container {
        flex-direction: column;
    }
    .bm-sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid #1a2238;
    }

}

/* ── Research Root Button ── */
a.bm-research-root,
a.bm-research-root:visited,
a.bm-research-root:link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 9px 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(135deg, #0d9488, #0f766e);
    border: 1px solid rgba(94, 234, 212, 0.35);
    border-radius: 6px;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(13, 148, 136, 0.25), inset 0 1px 0 rgba(255,255,255,0.1);
    transition: all 0.2s ease;
    cursor: pointer;
}

a.bm-research-root:hover {
    color: #fff;
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    border-color: rgba(94, 234, 212, 0.6);
    box-shadow: 0 4px 18px rgba(13, 148, 136, 0.4), inset 0 1px 0 rgba(255,255,255,0.15);
    transform: translateY(-1px);
    text-decoration: none;
}

a.bm-research-root i {
    font-size: 0.85rem;
    color: #5eead4;
}
