/* Ensure the map takes full width and height dynamically */
#hotspot-map {
    width: 100%;
    height: 600px;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Hotspot marker styles */
.hotspot-marker div {
    width: 6px !important;
    height: 6px !important;
    border-radius: 50%;
}

.hotspot-marker div {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.wind-arrow {
    background: transparent !important;
    border: none !important;
}

.wind-control {
    background: white;
    padding: 5px;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
}

.wind-toggle {
    border: none;
    background: #f8f9fa;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.wind-toggle.active {
    background: #007bff;
    color: white;
}

.wind-toggle:hover {
    background: #e2e6ea;
}

.wind-toggle.active:hover {
    background: #0069d9;
}

.wind-icon {
    font-size: 16px;
}

/* Hotspot stats container */
.hotspot-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.hotspot-metadata {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-width: 200px;
    color: var(--text-color);
    border: 1px solid var(--secondary-color);
}

.hotspot-region-stats {
    flex: 2;
    min-width: 300px;
    overflow-x: auto;
}

.region-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-color);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    color: var(--text-color);
}

.region-table th,
.region-table td {
    padding: 8px 12px;
    border: 1px solid var(--secondary-color);
    text-align: left;
}

.region-table th {
    background-color: var(--secondary-color);
}

/* Confidence-colored headers */
.region-table th:nth-child(2) {
    /* Low column */
    background-color: #0f0;
    color: #000;
}
.region-table th:nth-child(3) {
    /* Medium column */
    background-color: #ff0;
    color: #000;
}
.region-table th:nth-child(4) {
    /* High column */
    background-color: #f00;
    color: #fff;
}

.region-table tbody tr:nth-child(even) {
    background-color: rgba(var(--text-color-rgb), 0.05);
}

.logo-container {
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    max-width: 280px;
}

.logo-container.shrunk {
    max-width: 50px;
    padding: 5px;
    background: rgba(255, 255, 255, 0.95); /* More opaque when shrunk */
}

.logo-container.shrunk .logo-metadata > *:not(.logo-row) {
    display: none;
}

.logo-metadata {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.logo-row {
    display: flex;
    align-items: center;
}

.logo-image {
    height: 40px;
    transition: all 0.3s ease;
}

.logo-container.shrunk .logo-image {
    height: 30px;
}

.text-rows {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    font-weight: bold;
    line-height: 1.2;
}

.time-range {
    font-size: 11px;
    color: #555;
    margin-top: 5px;
}

.leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 6px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.15);
    max-width: min(300px, 90vw) !important;
    transition: background 0.3s ease;
}

.leaflet-popup-content {
    margin: 13px 19px;
    line-height: 1.4;
    font-size: clamp(12px, 2vw, 14px);
}

.leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.95);
    transition: background 0.3s ease;
}

.popup-content {
    max-width: min(300px, 90vw);
    font-size: 14px;
}

.popup-table {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(12px, 2vw, 14px);
}

.popup-table td {
    padding: 4px 6px;
    vertical-align: top;
}

.popup-table tr td:first-child {
    white-space: nowrap;
    font-weight: bold;
}

/* Dark mode adjustments */
[data-theme="dark"] {

    .leaflet-popup-content-wrapper,
    .leaflet-popup-tip {
        background: rgba(40, 40, 40, 0.95);
        color: #fff;
    }

    .leaflet-popup-content a {
        color: #7db8ff;
    }

    .leaflet-popup-close-button {
        color: #fff;
    }

    .logo-container {
        background: rgba(40, 40, 40, 0.95);
    }

    .text-rows {
        color: #fff;
    }

    .time-range {
        color: #ccc;
    }

    .logo-container.shrunk {
        background: rgba(40, 40, 40, 0.95);
}

    /* Adjust confidence colors for dark mode */
    .region-table th:nth-child(2) {
        /* Low */
        background-color: #0a0;
    }
    .region-table th:nth-child(3) {
        /* Medium */
        background-color: #aa0;
    }
    .region-table th:nth-child(4) {
        /* High */
        background-color: #a00;
    }
}

/* Responsive styles */
@media (max-width: 768px) {
    #hotspot-map {
        height: 400px;
    }

    .hotspot-stats {
        flex-direction: column;
    }
    .logo-container {
        max-width: 60%;
        padding: 8px;
        font-size: 0.9em;
    }

    .leaflet-popup-content-wrapper {
        max-width: min(250px, 85vw) !important;
    }
    .leaflet-popup-content {
        font-size: clamp(11px, 2.5vw, 13px);
        margin: 10px 15px;
    }

    .popup-content {
        max-width: min(250px, 85vw);
    }

    .logo-container.shrunk {
        max-width: 40px;
    }

    .hotspot-metadata,
    .hotspot-region-stats {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    #hotspot-map {
        height: 300px;
    }
    .logo-container {
        max-width: 70%;
        padding: 6px;
        font-size: 0.9em;
    }

    .logo-container.shrunk {
        max-width: 35px;
    }

    .logo-row {
        display: none !important;
    }

    .logo-container.shrunk .logo-row {
        display: flex !important;
    }

    .text-rows {
        font-size: 11px;
    }

    .time-range {
        font-size: 10px;
    }
    .region-table {
        font-size: 0.8rem;
    }

    .hotspot-metadata {
        min-width: auto;
        padding: 8px 10px;
    }

    .leaflet-popup-content-wrapper {
        max-width: min(200px, 80vw) !important;
    }
    .leaflet-popup-content {
        font-size: clamp(10px, 3vw, 12px);
        margin: 8px 12px;
    }

    .popup-content {
        max-width: min(200px, 80vw);
    }

    .popup-table {
        font-size: clamp(10px, 3vw, 12px);
    }

    .popup-table td {
        padding: 2px 4px;
    }

    .logo-container.shrunk .logo-image {
        height: 25px;
    }
}
