/* Midwest and Southern States MicroSim Stylesheet */

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

body {
    font-family: Arial, Helvetica, sans-serif;
    background: aliceblue;
}

/* The whole MicroSim is a fixed-height column so it always fits its iframe.
   Keep this height equal to CANVAS_HEIGHT in central-states.js. */
main {
    height: 600px;
    display: flex;
    flex-direction: column;
    background: aliceblue;
    overflow: hidden;
}

h2 {
    text-align: center;
    margin: 8px 0 2px 0;
    font-size: 18px;
    color: darkslategray;
}

.subtitle {
    text-align: center;
    font-size: 13px;
    color: dimgray;
    margin-bottom: 6px;
}

/* Map on the left, comparison panel on the right */
.stage {
    flex: 1;
    min-height: 0;
    display: flex;
}

#map {
    flex: 1;
    min-width: 0;
    height: 100%;
    background: lightcyan;   /* water color: the map has no tile basemap */
}

.side-panel {
    width: 270px;
    padding: 6px 8px;
    background: white;
    border-left: 1px solid silver;
    overflow-y: auto;
}

.side-title {
    font-size: 14px;
    font-weight: bold;
    color: darkslategray;
    text-align: center;
    margin-bottom: 6px;
}

.state-card {
    border: 1px solid silver;
    border-left-width: 6px;
    border-radius: 4px;
    padding: 5px 7px;
    margin-bottom: 6px;
    font-size: 12px;
    line-height: 1.35;
    color: darkslategray;
    min-height: 44px;
}

.card-a { border-left-color: navy; }
.card-b { border-left-color: darkmagenta; }

.state-card .placeholder {
    color: gray;
    font-style: italic;
}

.state-card h4 {
    font-size: 14px;
    margin-bottom: 2px;
    color: black;
}

.region-chip {
    display: inline-block;
    font-size: 11px;
    font-weight: bold;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
    color: black;
    vertical-align: middle;
}

.stat { font-weight: bold; color: black; }

.compare-box {
    border: 1px dashed gray;
    border-radius: 4px;
    padding: 5px 7px;
    font-size: 12px;
    line-height: 1.4;
    color: darkslategray;
    background: ivory;
}

.compare-box h4 { font-size: 13px; margin-bottom: 2px; color: black; }
.compare-box .same { color: darkgreen; }
.compare-box .diff { color: firebrick; }

/* Controls */
.controls-container {
    background: white;
    padding: 7px 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid silver;
}

.control-label {
    font-size: 12px;
    font-weight: bold;
    color: darkslategray;
}

.control-divider {
    width: 1px;
    height: 22px;
    background: silver;
}

.control-btn {
    padding: 5px 12px;
    font-size: 12px;
    border: 2px solid darkgreen;
    background: white;
    color: darkgreen;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.control-btn:hover { background: honeydew; }

.control-btn.active {
    background: darkgreen;
    color: white;
}

/* Legend */
.legend-container {
    background: white;
    padding: 6px 10px;
    border-top: 1px solid gainsboro;
}

.legend-items {
    display: flex;
    justify-content: center;
    gap: 6px 12px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: darkslategray;
}

.legend-item i {
    width: 14px;
    height: 14px;
    margin-right: 4px;
    border-radius: 2px;
    border: 1px solid dimgray;
}

.legend-item i.line {
    height: 0;
    border: none;
    border-top: 4px solid royalblue;
    border-radius: 0;
}

.hover-instruction {
    text-align: center;
    font-size: 12px;
    color: dimgray;
    padding: 4px;
    font-style: italic;
    background: white;
}

/* Map labels */
.state-label,
.water-label {
    background: none;
    border: none;
}

.state-label div {
    font-size: 12px;
    font-weight: bold;
    color: black;
    text-align: center;
    text-shadow: 0 0 3px white, 0 0 3px white;
}

.water-label div {
    font-size: 12px;
    font-style: italic;
    font-weight: bold;
    color: navy;
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 0 3px white, 0 0 3px white, 0 0 3px white;
}

.water-label.small div { font-size: 11px; }

.load-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 14px 18px;
    border: 1px solid silver;
    border-radius: 8px;
    font-size: 13px;
    z-index: 1000;
}

/* Narrow screens: put the comparison panel under the map */
@media (max-width: 560px) {
    .stage { flex-direction: column; }
    #map { flex: 1; min-height: 0; width: 100%; }
    .side-panel {
        width: 100%;
        height: 190px;
        border-left: none;
        border-top: 1px solid silver;
    }
    .control-divider { display: none; }
}
