body, html { 
    margin: 0; 
    padding: 0; 
    height: 100%; 
    font-family: Arial, sans-serif; 
    overflow: hidden; 
}

/* --- START OF NEW MODIFICATION: CHOROPLETH COLORS --- */
:root {
    --color-dark-green: #006d2c;
    --color-medium-green: #31a354;
    --color-yellow-green: #74c476;
    --color-yellow: #ffffcc; /* A light yellow for moderate yields */
    --color-orange: #fd8d3c;
    --color-reddish-orange: #f03b20;
    --color-red: #bd0026;
    --color-no-data: #e0e0e0; /* Neutral grey for states without data */
}
/* --- END OF NEW MODIFICATION --- */


#container { 
    display: flex; 
    height: 100vh; 
    width: 100vw; 
}

/* Landscape mode: Equal split (50/50) for map and details */
@media (orientation: landscape) {
    #map-container { 
        width: 50vw; 
        height: 100vh; 
        flex-shrink: 0; 
        position: relative;
    }
    #details { 
        width: 50vw; 
        height: 100vh; 
        padding: 20px; 
        background: #f8f8f8; 
        overflow-y: auto; 
    }
    #portrait-message { 
        display: none; 
    }
}

/* Portrait mode: Map on top, details below */
@media (orientation: portrait) {
    #container { 
        flex-direction: column; 
    }
    #map-container { 
        width: 100vw; 
        height: 60vh; 
        flex-shrink: 0; 
        position: relative;
    }
    #details { 
        width: 100vw; 
        height: 40vh; 
        padding: 15px; 
        background: #f8f8f8; 
        overflow-y: auto; 
        box-sizing: border-box; 
    }
    #portrait-message { 
        display: none; 
    }
}

/* --- START OF MODIFICATION: Game Mode Fullscreen --- */
#container.game-mode-active #map-container {
    display: none;
}

#container.game-mode-active #details {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}
/* --- END OF MODIFICATION --- */


/* --- START OF MODIFICATION: Map Controls & State Labels --- */
.map-controls-top-right {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    gap: 10px;
}

.map-control-button {
    padding: 8px 12px;
    border: 1px solid #ccc;
    background-color: white;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
    transition: all 0.15s ease;
}

.map-control-button:hover {
    background-color: #f4f4f4;
}

.map-control-button.active {
    background-color: #3388ff;
    color: white;
    border-color: #3388ff;
}

.state-label {
    color: black;
    text-align: center;
    text-shadow: 
        -1px -1px 0 #FFF,  
         1px -1px 0 #FFF,
        -1px  1px 0 #FFF,
         1px  1px 0 #FFF; /* White outline for readability */
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}

.state-label-large b { font-size: 14px; }
.state-label-medium b { font-size: 11px; }
.state-label-small b { font-size: 9px; }
/* --- END OF MODIFICATION --- */


/* --- START OF NEW MODIFICATION: Leaflet Attribution Control Styling --- */
/* Ensure the attribution control has proper spacing and styling */
.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.8) !important;
    padding: 3px 8px !important;
    border-radius: 4px;
    margin: 0 0 5px 10px !important; /* This ensures it's not flush with the edge */
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
}
/* --- END OF NEW MODIFICATION --- */


/* Content wrapper to ensure proper scrolling */
#details-content {
    min-height: calc(100% + 7em);
    padding-bottom: 7em;
}

/* START OF MODIFICATION: Game Button & Back Button Alignment */
#details h2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #333;
    border-bottom: 2px solid #3388ff;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

/* NEW: Style for the back button inside a heading */
.back-to-selection-btn {
    padding: 5px 12px;
    font-size: 14px;
    font-weight: 500;
    color: #3388ff;
    background-color: white;
    border: 1px solid #3388ff;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.back-to-selection-btn:hover {
    background-color: #e6f3ff;
    transform: translateY(-1px);
}

/* NEW: Style for the arrow inside the back button */
.back-arrow {
    font-size: 1.3em; /* Makes the arrow slightly larger */
    position: relative;
    top: 0px; /* Fine-tunes vertical alignment */
    margin-right: 2px;
}
/* END OF MODIFICATION */

.detail-section {
    margin-bottom: 20px;
}

.detail-section h3 {
    color: #333;
    border-bottom: 2px solid #3388ff;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

/* --- START OF NEW MODIFICATION: Subheader with Button --- */
.detail-section h3.subheader-with-button {
    display: flex;
    justify-content: flex-start; /* Aligns items to the left */
    align-items: center;
    gap: 15px; /* Adds space between the title and the button */
}
/* --- END OF NEW MODIFICATION --- */


.detail-row {
    display: flex;
    margin-bottom: 5px;
}

.detail-label {
    font-weight: bold;
    min-width: 150px;
    color: #555;
}

.detail-value {
    flex: 1;
    color: #333;
}

.list-value {
    color: #333;
}

.number-value {
    color: #2c7fb8;
    font-weight: 500;
}

/* Feature toggle buttons styles */
.features-section {
    margin-top: 20px;
}

.features-section h3 {
    color: #333;
    border-bottom: 2px solid #3388ff;
    padding-bottom: 5px;
    margin-bottom: 15px;
}

.feature-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.feature-toggle {
    padding: 8px 16px;
    border: 2px solid #3388ff;
    background-color: white;
    color: #3388ff;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
    white-space: nowrap;
    user-select: none;
}

.feature-toggle:hover {
    background-color: #e6f3ff;
    transform: translateY(-1px);
}

.feature-toggle:active {
    transform: translateY(0);
}

.feature-toggle.active {
    background-color: #3388ff;
    color: white;
    box-shadow: 0 2px 8px rgba(51, 136, 255, 0.3);
}

.feature-toggle.active:hover {
    background-color: #2968cc;
}

/* Points of Interest List Styling */
.poi-list {
    margin-top: 15px;
}

.poi-list h3 {
    color: #333;
    border-bottom: 2px solid #3388ff;
    padding-bottom: 5px;
    margin-bottom: 10px;
    font-size: 16px;
}

.poi-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.poi-items li {
    padding: 8px 12px;
    margin: 4px 0;
    background: #f0f7ff;
    border-left: 3px solid #3388ff;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
}

.poi-items li:nth-child(odd) {
    background: #f8fbff;
}

.poi-no-items {
    padding: 15px;
    text-align: center;
    color: #666;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 4px;
    margin-top: 10px;
}


/* --- START OF NEW MODIFICATION: CHOROPLETH LEGEND --- */
.choropleth-legend {
    margin-top: 20px;
}

.choropleth-legend h3 {
    color: #333;
    border-bottom: 2px solid #3388ff;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    font-size: 14px;
}

.legend-color-box {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 1px solid rgba(0,0,0,0.2);
}

/* Mapping color names from JSON to CSS variables */
.legend-color-box.dark_green { background-color: var(--color-dark-green); }
.legend-color-box.medium_green { background-color: var(--color-medium-green); }
.legend-color-box.yellow_green { background-color: var(--color-yellow-green); }
.legend-color-box.yellow { background-color: var(--color-yellow); }
.legend-color-box.orange { background-color: var(--color-orange); }
.legend-color-box.reddish_orange { background-color: var(--color-reddish-orange); }
.legend-color-box.red { background-color: var(--color-red); }
.legend-color-box.no_data { background-color: var(--color-no-data); }

.legend-label {
    color: #333;
}
/* --- END OF NEW MODIFICATION --- */


/* Responsive adjustments for smaller screens */
@media (orientation: portrait) and (max-width: 480px) {
    #details { 
        padding: 10px; 
        font-size: 14px; 
    }
    .detail-label { 
        min-width: 120px; 
        font-size: 13px; 
    }
    #details h2, .detail-section h3 { 
        font-size: 16px; 
    }
    .detail-section { 
        margin-bottom: 15px; 
    }
    .feature-toggle { 
        padding: 6px 12px; 
        font-size: 12px; 
    }
    
    .poi-items li {
        padding: 6px 10px;
        font-size: 13px;
    }
}