/* Map Click Query Popup Styles */

.map-query-popup .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 0;
}

.map-query-popup .leaflet-popup-content {
    margin: 0;
    min-width: 260px;
}

.map-query-popup .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.98);
}

.map-query-popup .leaflet-popup-close-button {
    display: none;
}

/* Results Container */
.map-query-results {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding: 16px;
}

/* Header */
.query-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 12px;
}

.query-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.query-header .query-subtitle {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

.query-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #94a3b8;
    padding: 0;
    margin: -4px -4px 0 0;
    transition: color 0.2s;
}

.query-close-btn:hover {
    color: #1e293b;
}

/* Content Area */
.query-content {
    max-height: 350px;
    overflow-y: auto;
}

/* Section */
.query-section {
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.query-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.query-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Values */
.query-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.query-value-unit {
    font-size: 14px;
    font-weight: 400;
    color: #64748b;
    margin-left: 4px;
}

.query-value-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.query-value-label {
    font-size: 13px;
    color: #64748b;
}

.query-value-data {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

/* Snow/Precip specific styles */
.query-snow-summary {
    display: flex;
    justify-content: space-around;
    text-align: center;
    margin: 12px 0;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
}

.query-snow-item {
    flex: 1;
}

.query-snow-value {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.query-snow-label {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.query-snow-item.expected .query-snow-value {
    color: #2563eb;
}

/* Exceedance probabilities table */
.query-exceedance {
    margin-top: 12px;
}

.query-exceedance-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 500;
}

.query-exceedance-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}

.query-exceedance-row:last-child {
    border-bottom: none;
}

.query-exceedance-threshold {
    color: #475569;
}

.query-exceedance-prob {
    font-weight: 600;
    color: #1e293b;
}

/* Detail text */
.query-detail {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

/* Alerts */
.query-alert-item {
    background: #fef2f2;
    border-left: 3px solid #ef4444;
    padding: 10px 12px;
    margin: 6px 0;
    border-radius: 0 6px 6px 0;
}

.query-alert-event {
    font-weight: 600;
    color: #dc2626;
    font-size: 13px;
}

.query-alert-severity {
    font-size: 11px;
    color: #ef4444;
    margin-top: 2px;
}

/* Warning/Caution styles */
.query-alert-item.warning {
    background: #fefce8;
    border-left-color: #eab308;
}

.query-alert-item.warning .query-alert-event {
    color: #ca8a04;
}

.query-alert-item.watch {
    background: #fff7ed;
    border-left-color: #f97316;
}

.query-alert-item.watch .query-alert-event {
    color: #ea580c;
}

/* Loading state */
.map-query-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    color: #64748b;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* No data state */
.query-no-data {
    text-align: center;
    padding: 24px 16px;
    color: #64748b;
}

.query-no-data-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* SPC Risk Level Colors */
.risk-high {
    color: #dc2626 !important;
    font-weight: 700;
}

.risk-moderate {
    color: #ea580c !important;
    font-weight: 700;
}

.risk-enhanced {
    color: #d97706 !important;
    font-weight: 600;
}

.risk-slight {
    color: #ca8a04 !important;
    font-weight: 600;
}

.risk-marginal {
    color: #16a34a !important;
    font-weight: 500;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .map-query-popup .leaflet-popup-content-wrapper {
        background: rgba(30, 41, 59, 0.98);
    }

    .map-query-popup .leaflet-popup-tip {
        background: rgba(30, 41, 59, 0.98);
    }

    .query-header h3,
    .query-value,
    .query-value-data {
        color: #f1f5f9;
    }

    .query-section {
        border-bottom-color: #334155;
    }

    .query-section-title,
    .query-detail,
    .query-value-label {
        color: #94a3b8;
    }

    .query-snow-summary {
        background: #1e293b;
    }

    .query-exceedance-row {
        border-bottom-color: #334155;
    }
}
