/* Major US Cities 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 major-cities.js. */
main {
    height: 674px;
    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, ranked list of cities 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 */
}

.rank-panel {
    width: 236px;
    background: white;
    border-left: 1px solid silver;
    padding: 4px 6px;
    overflow-y: auto;
}

.rank-title {
    font-size: 13px;
    font-weight: bold;
    color: darkslategray;
    text-align: center;
    margin-bottom: 2px;
}

.rank-row {
    display: flex;
    align-items: center;
    width: 100%;
    height: 17px;
    padding: 0 2px;
    border: none;
    border-radius: 3px;
    background: none;
    font-family: inherit;
    font-size: 12px;
    color: black;
    text-align: left;
    cursor: pointer;
}

.rank-row:hover { background: gainsboro; }
.rank-row.selected { background: khaki; font-weight: bold; }

.rank-num {
    width: 20px;
    text-align: right;
    margin-right: 5px;
    color: dimgray;
}

.rank-name {
    width: 92px;
    white-space: nowrap;
    overflow: hidden;
}

.rank-bar-track {
    flex: 1;
    height: 9px;
}

.rank-bar {
    height: 100%;
    min-width: 2px;
    border-radius: 2px;
    border: 1px solid dimgray;
}

/* ---------- City facts ---------- */
.info-area {
    background: white;
    border-top: 1px solid silver;
    padding: 6px 10px;
    height: 150px;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.4;
    color: darkslategray;
}

.info-area .placeholder {
    color: dimgray;
    font-style: italic;
    text-align: center;
    padding-top: 40px;
}

.card-row {
    display: flex;
    gap: 8px;
}

.city-card {
    flex: 1;
    min-width: 0;
    border: 1px solid silver;
    border-left-width: 6px;
    border-radius: 4px;
    padding: 4px 8px;
    min-height: 78px;
}

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

.city-card h4 {
    display: inline;
    font-size: 15px;
    color: black;
}

.city-card .empty {
    color: dimgray;
    font-style: italic;
    padding-top: 26px;
    text-align: center;
}

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

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

.compare-line {
    margin-top: 4px;
    padding: 2px 8px;
    border: 1px dashed gray;
    border-radius: 4px;
    background: ivory;
    font-size: 13px;
    color: black;
    text-align: center;
}

/* In compare mode the cards are narrower, so the text is a little smaller */
.info-area.comparing { font-size: 12px; line-height: 1.3; }

/* ---------- Controls ---------- */
.controls-container {
    background: white;
    padding: 6px 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid 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: 5px 10px;
    border-top: 1px solid gainsboro;
}

.legend-items {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px 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: 50%;
    border: 1px solid dimgray;
}

.legend-item i.small-dot { width: 8px; height: 8px; background: silver; margin-right: 2px; }
.legend-item i.big-dot { width: 16px; height: 16px; background: silver; }

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

/* ---------- Map markers ---------- */
.rank-label {
    background: none;
    border: none;
}

.rank-label div {
    font-size: 12px;
    font-weight: bold;
    line-height: 16px;
    color: black;
    text-align: center;
    text-shadow: 0 0 2px white, 0 0 2px white, 0 0 2px white;
}

.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: hide the ranked list so the map keeps its room */
@media (max-width: 600px) {
    .rank-panel { display: none; }
    .card-row { gap: 4px; }
    .compare-line { white-space: normal; }
}
