/* Coverage Applications Map Stylesheet
 * =====================================
 * Layout: Title, map with side panel, controls, legend
 * Designed for 450px iframe embedding
 */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: aliceblue;
}

.container {
    max-width: 100%;
    padding: 4px;
}

/* Title & Subtitle */
h2 {
    text-align: center;
    margin: 4px 0 2px 0;
    font-size: 16px;
    color: #333;
}

.subtitle {
    text-align: center;
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
}

/* Main content area with map and side panel */
.main-content {
    display: flex;
    gap: 8px;
    height: 300px;
}

/* Map Container */
#map {
    flex: 1;
    min-width: 0;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Info Panel (right side) */
.info-panel {
    width: 220px;
    background: white;
    border-radius: 4px;
    border: 1px solid #ddd;
    padding: 10px;
    overflow-y: auto;
    font-size: 12px;
}

.info-panel h3 {
    font-size: 14px;
    color: #333;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 2px solid #3b82f6;
}

.info-panel .instruction {
    font-style: italic;
    color: #888;
    font-size: 11px;
    margin-bottom: 8px;
}

.info-panel p {
    color: #555;
    line-height: 1.4;
    margin-bottom: 6px;
}

/* Region-specific styling in info panel */
.region-name {
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    color: white;
}

.region-name.us { background: #3b82f6; }
.region-name.eu { background: #22c55e; }
.region-name.uk { background: #a855f7; }
.region-name.asia { background: #f97316; }
.region-name.latam { background: #14b8a6; }
.region-name.global { background: #6b7280; }

.coverage-list {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}

.coverage-list li {
    padding: 4px 0;
    border-bottom: 1px solid #eee;
    font-size: 11px;
    color: #444;
}

.coverage-list li:last-child {
    border-bottom: none;
}

.coverage-list li::before {
    content: "•";
    color: #3b82f6;
    font-weight: bold;
    margin-right: 6px;
}

.example-microsims {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #ccc;
}

.example-microsims h4 {
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
}

.example-microsims ul {
    list-style: none;
    padding: 0;
    font-size: 10px;
}

.example-microsims li {
    padding: 2px 0;
    color: #555;
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 6px 0;
    flex-wrap: wrap;
}

.controls button {
    padding: 5px 12px;
    font-size: 11px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
}

.controls button:hover {
    background: #f0f0f0;
    border-color: #bbb;
}

.controls button.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* Legend */
.legend-container {
    background: white;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.legend-title {
    font-size: 11px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
    text-align: center;
}

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

.legend-item {
    display: flex;
    align-items: center;
    font-size: 10px;
    color: #555;
}

.legend-item i {
    width: 14px;
    height: 10px;
    margin-right: 4px;
    display: inline-block;
    border-radius: 2px;
}

/* Temporal view styles */
.temporal-info {
    margin-top: 8px;
}

.temporal-info h4 {
    font-size: 12px;
    color: #333;
    margin-bottom: 4px;
}

.era-item {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 11px;
    border-bottom: 1px solid #eee;
}

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

.era-name {
    color: #333;
}

.era-years {
    color: #888;
    font-size: 10px;
}

/* Leaflet popup customization */
.leaflet-popup-content-wrapper {
    border-radius: 6px;
}

.leaflet-popup-content {
    margin: 8px 10px;
    font-size: 12px;
}

/* Region polygons hover state (added via JS) */
.region-highlight {
    cursor: pointer;
}

/* Responsive */
@media (max-width: 600px) {
    .main-content {
        flex-direction: column;
        height: auto;
    }

    #map {
        height: 220px;
    }

    .info-panel {
        width: 100%;
        max-height: 150px;
    }

    h2 {
        font-size: 14px;
    }

    .subtitle {
        font-size: 10px;
    }

    .controls button {
        padding: 4px 8px;
        font-size: 10px;
    }
}
