
:root {
    --app-height: 100vh;
}
* {
    box-sizing: border-box;
}
body { 
    font-family: sans-serif; 
    margin: 0; 
    background: #f5f5ff; 
}
#app-title {
    font-family: 'Concert One', sans-serif;
    font-size: 24px;
    margin: 0;
    color: #444;
}
h4 { 
    margin-top: 0; 
    margin-bottom: 12px; 
    font-size: 12px;
    color: #444;
}
button { 
    background: #007aff; 
    color: white; 
    border: none; 
    padding: 10px 20px; 
    border-radius: 6px; 
    cursor: pointer; 
    transition: background-color 0.2s; 
}
button:hover { 
    background: #0056b3; 
}
button:disabled { 
    background: #ccc; 
    cursor: not-allowed; 
}
.spacer {
    flex-grow: 1;
}
@keyframes spin { 
    100% { transform: rotate(360deg); } 
}

.controls { 
    background: white; 
    padding: 11px 25px 10px 25px; 
    height: 55px; 
    border-bottom: 1px solid #ddd; 
}
.control-row { 
    display: flex; 
    gap: 15px; 
    align-items: center; 
    flex-wrap: wrap; 
}
#map { 
    height: calc(var(--app-height) - 55px); 
    width: 100%; 
    background-color: rgba(236, 236, 236, 1);
}

.map-tooltip-container {
    position: absolute;
    display: none; /* Hidden by default */
    padding: 6px 10px;
    background-color: rgba(0, 0, 0, 0.4);
    color: rgb(255, 255, 255);
    border-radius: 4px;
    font-size: 14px;
    z-index: 10000; /* Ensures it's on top of everything */
    pointer-events: none; /* Prevents the tooltip from blocking map events */
    white-space: nowrap;
    transform: translate(15px, 15px); /* Offset from the cursor */
}

.place-label {
  width: max-content;     
  max-width: 50px;       
  white-space: normal;
  text-align: center;
  line-height: 1.2;
  transform: translate(-50%, -50%);
  text-shadow: 0 0 2px #ffffff;
  font-family: Arial, sans-serif;
  color: #161616;
  pointer-events: none;
}

.country-label {
  font-size: 14px;
  font-weight: bold;
  color: #000;
}

.city-label {
  font-size: 12px;
  font-weight: bold;
}

.town-label {
  font-size: 10px;
  font-weight:600;
}

.village-label, .hamlet-label {
  font-size: 8px;
  font-weight: normal;
}

.natural-label {
  width: max-content;     
  max-width: 50px;       
  white-space: normal;
  text-align: center;
  line-height: 1.2;
  transform: translate(-50%, -50%);
  text-shadow: 0 0 2px #ffffff;
  font-family: Arial, sans-serif;
  color: #252a27;
  pointer-events: none;
  font-size: 10px;
  font-style: italic;
}

#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    display: none; 
}
#loading-spinner {
    border: 6px solid #f3f3f3;
    border-top: 6px solid #007aff;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}
.title-loader {
    display: inline-block;
    vertical-align: -0.2em;
    border: 2px solid #ccc;
    border-top: 2px solid #007aff;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    animation: spin 0.8s linear infinite;
    margin-right: 6px;
}

.info-panel { 
    position: absolute; 
    top: 20px; 
    right: 20px; 
    width: 320px; 
    height: 420px; 
    background: rgba(255, 255, 255, 0.9); 
    padding: 15px; 
    border-radius: 8px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.15); 
    z-index: 1000; 
    font-size: 14px; 
    user-select: none; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column;
}
.info-panel h4 { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}
#pointInfo { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    min-height: 0; 
}
#rainHistoryTableContainer { 
    flex-grow: 1; 
    min-height: 50px; 
    overflow-y: auto; 
    border: 1px solid #ddd; 
    border-radius: 4px;
}
#rainHistoryTableContainer table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 12px; 
}
#rainHistoryTableContainer th, 
#rainHistoryTableContainer td { 
    border-bottom: 1px solid #ddd; 
    padding: 6px 8px; 
    text-align: left; 
}
#rainHistoryTableContainer th { 
    background-color: #f2f2f2; 
    position: sticky; 
    top: 0; 
}
#rainHistoryBtn {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
}
#rainHistoryBtn:hover {
    background-color: #e0e0e0;
}
.panel-loading-content {
    opacity: 0.5;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
}
.minimize-btn { 
    background: #eee; 
    color: #333; 
    border: 1px solid #ccc; 
    border-radius: 4px; 
    cursor: pointer; 
    font-weight: bold; 
    line-height: 1; 
    padding: 2px 8px; 
}
.minimize-btn:hover { 
    background: #ddd; 
}
.minimize-btn.has-new-data {
    background-color: #007aff;
    color: white;
}
.info-panel.panel-minimized { 
    height: auto; 
    width: auto; 
    min-width: 320px; 
    padding: 8px 12px; 
}
.info-panel.panel-minimized h4 { 
    margin-bottom: 0; 
}
.info-panel.panel-minimized #pointInfo, 
.info-panel.panel-minimized .resize-handle { 
    display: none; 
}
.resize-handle { 
    position: absolute; 
    bottom: 0; 
    left: 0; 
    width: 15px; 
    height: 15px; 
    cursor: nwse-resize; 
    background: repeating-linear-gradient(135deg, rgba(0,0,0,0.2), rgba(0,0,0,0.2) 1px, transparent 1px, transparent 4px); 
}

.legend { 
    position: absolute; 
    bottom: 20px; 
    left: 20px; 
    width: 180px;
    background: rgba(255, 255, 255, 0.9); 
    padding: 10px; 
    border-radius: 8px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.15); 
    z-index: 1000;
}
#legend-selector {
    width: 100%;
    padding: 4px;
    margin-bottom: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    font-family: sans-serif;
    font-size: 13px;
    color: #444;
}
.legend-container {
    position: relative;
}
.legend-gradient { 
    height: 20px;
    border: 1px solid #ddd; 
    border-radius: 4px; 
    opacity: 0.8;
}
.legend-labels { 
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: 0 8px;
    font-size: 11px; 
}

#info-btn {
    background: none;
    color: #333;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
}
#info-btn:hover {
    background: #e0e0e0;
}
#info-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: flex-start; 
    padding-top: 100px;      
    padding-bottom: 100px;      
    z-index: 2000;
}

#info-modal-content {
    background: white;
    position: relative;
    padding: 0;
    border-radius: 8px;
    max-width: 650px;
    width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: left;
    max-height: calc(var(--app-height) - 200px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-inner-content {
    flex: 1;
    min-height: 0; 
    overflow-y: auto;
    padding: 20px 30px;
    scrollbar-gutter: stable;
}


.modal-close-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 18px;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    line-height: 1; 
    padding: 5px;
}

.modal-close-icon:hover {
    color: #000;
}
#modal-close-btn:hover {
    background: none;
}

#info-modal-overlay.modal-hidden {
    display: none;
}

.collapsible-section {
    margin-top: 15px;
    border-bottom: 1px solid #eee; 
}

hr {
    border: 0.5px solid #eee;
}

.collapsible-section:last-of-type {
    border-bottom: none;
}

.collapsible-section summary {
    padding: 8px 0;
    font-weight: bold;
    font-size: 0.8em; 
    cursor: pointer;
    list-style: none; 
    outline: none;
}

.collapsible-section summary::before {
    content: ''; 
    display: inline-block;
    margin-right: 10px;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 7px solid #555;
    transition: transform 0.2s;
    transform-origin: 50% 50%; 
}

.collapsible-section summary::-webkit-details-marker {
    display: none;
}

details[open] > summary::before {
    transform: rotate(90deg);
}

.collapsible-section .collapsible-content {
    padding: 10px 0 20px 0; 
}

.collapsible-content {
    font-size: 14px;
}

.leaflet-control-attribution {
    position: fixed;
    bottom: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 10px;
    font-size: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}   

@media (max-width: 500px) {
    .leaflet-control-zoom {
        display: none;
    }
    .info-panel, 
    .legend {
        position: absolute;
        left: 10px;
        right: 10px;
        width: auto;
    }
    .info-panel {
        top: 10px;
        bottom: auto;
    }
    .legend {
        bottom: 20px;
        top: auto;
        width: auto;
    }
    .resize-handle {
        display: none;
    }
    .leaflet-control-attribution {
        text-align: left; 
        left: 0;
        right: auto;
        padding-left: 10px;
    }
    #info-modal-overlay {
        padding-top: 20px;     
        padding-bottom: 20px;     
    }
    #info-modal-content {
       max-height: calc(var(--app-height) - 40px); 
    }
    .map-tooltip-container {
    display: none !important;
    }
}