/**
 * Transhydro Weather - Clean Modern Design v8
 */

/* Container - Clean white design */
.thw-weather-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: #f5f7fa;
    border-radius: 16px;
    box-sizing: border-box;
}

.thw-weather-container *,
.thw-weather-container *::before,
.thw-weather-container *::after {
    box-sizing: border-box;
}

/* Header */
.thw-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.thw-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.thw-current-time {
    font-size: 0.9rem;
    color: #666;
}

/* Search Box - Fixed overflow */
.thw-search-box {
    margin-bottom: 25px;
    display: flex;
    gap: 10px;
    position: relative;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.thw-search-input {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    background: #f9f9f9;
}

.thw-search-input:focus {
    border-color: #2196F3;
    background: white;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.thw-search-btn {
    padding: 12px 20px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
    flex-shrink: 0;
}

.thw-search-btn:hover {
    background: #1976D2;
}

.thw-gps-btn {
    padding: 12px 16px;
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s;
    flex-shrink: 0;
}

.thw-gps-btn:hover {
    background: #e8e8e8;
    border-color: #2196F3;
}

.thw-search-results {
    position: absolute;
    top: calc(100% - 5px);
    left: 15px;
    right: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 100;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}

/* Weather Alerts */
.thw-alerts-container {
    margin-bottom: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.thw-alerts-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff3cd;
    border-bottom: 1px solid #ffc107;
}

.thw-alert-icon {
    font-size: 1.3rem;
}

.thw-alerts-title {
    font-weight: 600;
    color: #856404;
    font-size: 1rem;
}

.thw-alert {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.thw-alert:last-child {
    border-bottom: none;
}

.thw-alert-event {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.thw-alert-event strong {
    color: #333;
}

.thw-alert-location {
    color: #666;
    font-size: 0.9rem;
}

.thw-alert-severity {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.thw-alert-extreme .thw-alert-severity {
    background: #dc3545;
    color: white;
}

.thw-alert-severe .thw-alert-severity {
    background: #fd7e14;
    color: white;
}

.thw-alert-moderate .thw-alert-severity {
    background: #ffc107;
    color: #333;
}

.thw-alert-minor .thw-alert-severity {
    background: #17a2b8;
    color: white;
}

.thw-alert-headline {
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.thw-alert-time {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: #888;
}

.thw-alert-time span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.thw-search-results.active {
    display: block;
}

.thw-search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
    color: #333;
}

.thw-search-result-item:hover {
    background: #f5f5f5;
}

.thw-search-result-item:last-child {
    border-bottom: none;
}

/* Section */
.thw-section {
    margin-bottom: 30px;
}

.thw-section-title {
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    padding: 10px 15px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.thw-section-icon {
    font-size: 1.3rem;
}

/* Cards Grid */
.thw-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 20px;
}

/* Card */
.thw-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.thw-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

/* Card Header */
.thw-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 18px;
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
}

.thw-card[data-location-type="resort"] .thw-card-header {
    background: linear-gradient(135deg, #00BCD4 0%, #0097A7 100%);
}

.thw-card[data-location-type="peak"] .thw-card-header {
    background: linear-gradient(135deg, #607D8B 0%, #455A64 100%);
}

.thw-card-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.thw-location-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.thw-elevation {
    font-size: 0.8rem;
    opacity: 0.85;
}

.thw-current-weather {
    display: flex;
    align-items: center;
    gap: 8px;
}

.thw-current-icon {
    font-size: 2rem;
}

.thw-current-temp {
    font-size: 1.6rem;
    font-weight: 700;
}

.thw-feelslike {
    font-size: 0.9rem;
    color: #888;
    font-weight: 400;
    margin-left: 4px;
}

/* Precipitation probability colors */
.thw-precipprob {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    margin-top: 2px;
}
.thw-prob-low { color: #4caf50; }
.thw-prob-medium { color: #ff9800; }
.thw-prob-high { color: #f44336; }

/* Visibility indicator for peaks */
.thw-visibility-cell {
    font-size: 0.85rem;
}
.thw-vis-low { color: #f44336; font-weight: 600; }
.thw-vis-moderate { color: #ff9800; }

/* Wave height indicators */
.thw-wave-cell { font-size: 0.85rem; }
.thw-wave-high { color: #f44336; font-weight: 600; }
.thw-wave-moderate { color: #ff9800; }

/* Comfort index */
.thw-comfort {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 500;
}
.thw-comfort-excellent { background: #4caf50; color: white; }
.thw-comfort-good { background: #8bc34a; color: white; }
.thw-comfort-moderate { background: #ffc107; color: #333; }
.thw-comfort-uncomfortable { background: #ff9800; color: white; }
.thw-comfort-poor { background: #f44336; color: white; }

.thw-sea-temp {
    font-size: 0.9rem;
    background: rgba(255,255,255,0.2);
    padding: 3px 8px;
    border-radius: 12px;
}

/* Card Table */
.thw-card-table-wrapper {
    overflow-x: auto;
}

.thw-card-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.thw-card-table th,
.thw-card-table td {
    padding: 7px 5px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.thw-card-table thead th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.thw-day-header {
    background: #e3f2fd !important;
    color: #1565C0 !important;
    font-size: 0.85rem;
    font-weight: 700 !important;
}

.thw-period-col {
    font-size: 0.7rem;
    min-width: 48px;
    line-height: 1.2;
}

/* Hide past period columns */
.thw-past-period {
    display: none !important;
}

.thw-period-col small {
    display: block;
    font-size: 0.6rem;
    color: #888;
    font-weight: normal;
}

.thw-param-label {
    text-align: left !important;
    font-weight: 600;
    padding-left: 10px !important;
    width: 32px;
    background: #fafafa;
    font-size: 1rem;
}

.thw-param-col {
    width: 32px;
}

/* Data cells */
.thw-data-cell {
    font-weight: 500;
    color: #333;
    font-size: 0.8rem;
}

.thw-temp-row .thw-data-cell {
    background: #fffde7;
}

.thw-cell-icon {
    display: block;
    font-size: 1rem;
    line-height: 1;
    margin-bottom: 2px;
}

.thw-cell-temp {
    font-weight: 700;
    color: #e65100;
    font-size: 0.9rem;
}

.thw-has-precip {
    background: #e3f2fd !important;
    color: #1565C0;
    font-weight: 600;
}

.thw-strong-wind {
    background: #ffebee !important;
    color: #c62828;
    font-weight: 600;
}

.thw-sea-cell {
    background: #e0f7fa !important;
    color: #00838f;
}

.thw-snow-cell {
    background: #e8eaf6 !important;
    color: #3949ab;
}

.thw-no-data {
    color: #bbb;
}

.thw-past-period {
    opacity: 0.4;
    background: #f5f5f5 !important;
}

/* Wind direction arrow */
.thw-wind-arrow {
    font-size: 1.1rem;
    display: inline-block;
}

/* Footer */
.thw-footer {
    margin-top: 25px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.thw-footer-note {
    margin: 0 0 10px 0;
    font-size: 0.95rem;
    color: #333;
}

.thw-footer-legend {
    margin: 0;
    font-size: 0.75rem;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

/* Modal */
.thw-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.thw-modal.active {
    display: flex;
}

.thw-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.thw-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 95%;
    width: 650px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.thw-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: #2196F3;
    color: white;
}

.thw-modal-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.thw-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.thw-modal-close:hover {
    opacity: 1;
}

.thw-modal-body {
    padding: 15px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.thw-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1rem;
}

.thw-error {
    text-align: center;
    padding: 20px;
    color: #c62828;
    background: #ffebee;
    border-radius: 8px;
    margin: 10px 0;
}

/* 14-day forecast table - Improved mobile layout */
.thw-forecast-14 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.thw-forecast-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 420px;
}

.thw-forecast-table th,
.thw-forecast-table td {
    padding: 8px 4px;
    text-align: center;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.thw-forecast-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #555;
    font-size: 0.75rem;
    position: sticky;
    top: 0;
}

.thw-forecast-table th:first-child,
.thw-forecast-table td:first-child {
    text-align: left;
    padding-left: 8px;
}

.thw-forecast-table tbody tr:hover {
    background: #f0f7ff;
}

.thw-forecast-table tbody tr:nth-child(even) {
    background: #fafafa;
}

/* Date cell */
.thw-date-cell {
    white-space: nowrap;
    min-width: 50px;
}

.thw-date-num {
    font-weight: 600;
    color: #333;
    display: block;
    font-size: 0.85rem;
}

.thw-date-day {
    font-size: 0.65rem;
    color: #888;
    font-weight: normal;
}

/* Icon cell */
.thw-icon-cell {
    font-size: 1.1rem;
    width: 30px;
}

/* Temperature cell */
.thw-temp-cell {
    white-space: nowrap;
    min-width: 55px;
}

.thw-temp-min {
    color: #1976D2;
    font-weight: 600;
}

.thw-temp-sep {
    color: #999;
    margin: 0 1px;
}

.thw-temp-max {
    color: #e65100;
    font-weight: 600;
}

/* Precipitation cell */
.thw-precip-cell {
    min-width: 35px;
}

/* Wind cell */
.thw-wind-cell {
    white-space: nowrap;
    min-width: 40px;
}

.thw-wind-speed {
    font-weight: 500;
}

.thw-forecast-wind-arrow {
    font-size: 1rem;
    display: block;
    margin-top: 2px;
}

/* Gust cell */
.thw-gust-cell {
    min-width: 30px;
}

/* Snow cell */
.thw-snow-cell-15 {
    min-width: 35px;
    color: #3949ab;
}

/* Snow cell for 14‑day forecast (renamed from -15) */
.thw-snow-cell-14 {
    min-width: 35px;
    color: #3949ab;
}

/* PV cell */
.thw-forecast-table .thw-pv-cell {
    font-weight: 600;
    color: #f57c00;
    min-width: 40px;
}

/* Forecast note */
.thw-forecast-note {
    margin-top: 12px;
    text-align: center;
    color: #666;
    font-size: 0.8rem;
}

/* -------------------------------------------------------------------- */
/* Customisations for v2.9.1: warning colours and square corners        */
/* Remove rounded corners on cards, tables, alerts and modal */
.thw-card,
.thw-card-table,
.thw-forecast-table,
.thw-alert,
.thw-search-box,
.thw-search-box input,
.thw-modal-content {
    border-radius: 0 !important;
}

/* Warning row colours in 14‑day forecast */
.thw-forecast-table tbody tr.thw-warning-red {
    background-color: #ffebee !important;
}

.thw-forecast-table tbody tr.thw-warning-orange {
    background-color: #fff3e0 !important;
}

.thw-forecast-table tbody tr.thw-warning-yellow {
    background-color: #fffde7 !important;
}

/* Warning cell colours in long forecast */
.thw-warning-cell-red {
    background-color: #ffcdd2;
    color: #c62828;
    font-weight: 600;
}

.thw-warning-cell-orange {
    background-color: #ffe0b2;
    color: #e65100;
    font-weight: 600;
}

.thw-warning-cell-yellow {
    background-color: #fff9c4;
    color: #f57f17;
    font-weight: 600;
}

/* -------------------------------------------------------------------- */
/* Customisations for v2.9.2: coloured borders instead of solid fills    */
/* These classes implement the new visual scheme where warnings are
   indicated with coloured borders rather than heavy background fills.
   Cards with active warnings receive a thick border in the appropriate
   colour.  Elements within the two‑day table that exceed warning
   thresholds are marked with a coloured border on the cell.  A
   calendar of warning days uses lightly filled boxes with coloured
   borders to summarise the 14‑day forecast. */

/* Card border colours based on highest warning level */
.thw-card-border-red {
    border: 3px solid #b71c1c !important;
}
.thw-card-border-orange {
    border: 3px solid #e65100 !important;
}
.thw-card-border-yellow {
    border: 3px solid #f57f17 !important;
}

/* Warning summary text colours */
.thw-warning-summary {
    padding: 8px 16px;
    background: #fafafa;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}
.thw-warning-summary > div {
    margin: 2px 0;
}
.thw-warning-text-red {
    color: #b71c1c;
    font-weight: 600;
}
.thw-warning-text-orange {
    color: #e65100;
    font-weight: 600;
}
.thw-warning-text-yellow {
    color: #f57f17;
    font-weight: 600;
}

/* Table warning row styles
   Warnings for today and tomorrow are displayed in the two‑day table
   as a dedicated row below the header.  The messages use a smaller font
   and a subtle background colour keyed to the warning level. */
.thw-warning-row td {
    font-size: 0.8rem;
    line-height: 1.2;
    padding: 6px;
    white-space: normal;
}
.thw-warning-label {
    font-weight: 600;
    margin-right: 4px;
}
.thw-warning-message {
    font-weight: 500;
}

/* Make warning cells in the two‑day table more compact with a smaller font */
.thw-warning-row .thw-warning-cell {
    font-size: 0.75rem;
    padding: 4px 6px;
    line-height: 1.2;
    border-radius: 4px;
}
.thw-warning-bg-red {
    background: #ffcdd2;
    color: #b71c1c;
}
.thw-warning-bg-orange {
    background: #ffe0b2;
    color: #e65100;
}
.thw-warning-bg-yellow {
    background: #fff9c4;
    color: #f57f17;
}
.thw-warning-bg-none {
    background: #f5f5f5;
    color: #555;
}

/* Cell border classes for two‑day table warnings */
.thw-cell-border-red {
    border: 2px solid #b71c1c;
    border-radius: 4px;
}
.thw-cell-border-orange {
    border: 2px solid #e65100;
    border-radius: 4px;
}
.thw-cell-border-yellow {
    border: 2px solid #f57f17;
    border-radius: 4px;
}

/* Warning calendar and summary styles */
/* The calendar is displayed as a grid with seven columns (Mon–Sun).
   Individual day boxes are positioned via grid-column and grid-row
   properties in the markup. */
.thw-warning-calendar-container {
    margin-bottom: 10px;
}
.thw-warning-calendar {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(7, minmax(32px, 1fr));
    grid-auto-rows: auto;
    gap: 4px;
    justify-items: center;
}
.thw-cal-header {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    text-align: center;
    min-width: 32px;
}

.thw-cal-day {
    display: inline-block;
    padding: 4px 6px;
    font-size: 0.75rem;
    line-height: 1;
    min-width: 32px;
    text-align: center;
    border: 1px solid transparent;
    border-radius: 4px;
}
.thw-cal-red {
    background-color: #ffcdd2;
    border-color: #b71c1c;
    color: #b71c1c;
}
.thw-cal-orange {
    background-color: #ffe0b2;
    border-color: #e65100;
    color: #e65100;
}
.thw-cal-yellow {
    background-color: #fff9c4;
    border-color: #f57f17;
    color: #f57f17;
}
.thw-cal-none {
    background-color: #f5f5f5;
    border-color: #ddd;
    color: #666;
}

/* Enhanced calendar with temperature colors, icons, and precipitation */
.thw-enhanced-calendar-container {
    margin-bottom: 15px;
}

.thw-enhanced-calendar {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
}

.thw-cal-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 6px;
}

.thw-cal-header-row .thw-cal-header {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    padding: 4px;
}

.thw-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(55px, auto);
    gap: 4px;
}

.thw-cal-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 4px 2px 22px 2px;
    border-radius: 6px;
    min-height: 60px;
    transition: transform 0.15s ease;
    cursor: default;
    background: white;
    border: 1px solid #eee;
}

.thw-cal-cell:hover {
    transform: scale(1.05);
    z-index: 2;
}

.thw-cal-date {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 2px;
    padding: 2px 6px;
    border-radius: 4px;
}

.thw-cal-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Temperature-based colors (-10 to 45 scale with smooth gradients) */
.thw-temp-extreme-cold { /* < -10 */
    background: #1a237e;
    color: #fff;
}
.thw-temp-very-cold { /* -10 to -5 */
    background: #283593;
    color: #fff;
}
.thw-temp-freezing { /* -5 to 0 */
    background: #5c6bc0;
    color: #fff;
}
.thw-temp-cold { /* 0 to 5 */
    background: #7986cb;
    color: #fff;
}
.thw-temp-chilly { /* 5 to 10 */
    background: #90caf9;
    color: #1565c0;
}
.thw-temp-cool { /* 10 to 15 */
    background: #b3e5fc;
    color: #0277bd;
}
.thw-temp-mild { /* 15 to 20 */
    background: #c8e6c9;
    color: #2e7d32;
}
.thw-temp-pleasant { /* 20 to 25 */
    background: #dcedc8;
    color: #33691e;
}
.thw-temp-warm { /* 25 to 30 */
    background: #fff9c4;
    color: #f57f17;
}
.thw-temp-hot { /* 30 to 35 */
    background: #ffcc80;
    color: #e65100;
}
.thw-temp-very-hot { /* 35 to 40 */
    background: #ff8a65;
    color: #bf360c;
}
.thw-temp-extreme-hot { /* > 40 */
    background: #e53935;
    color: #fff;
}

/* Warning indicator */
.thw-cal-warning {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.65rem;
    line-height: 1;
}

.thw-warn-yellow { color: #f9a825; }
.thw-warn-orange { color: #ef6c00; }
.thw-warn-red { color: #c62828; }

/* Bar container for precipitation and PV histograms */
.thw-cal-bars {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 18px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 2px;
}

/* Precipitation bar (histogram) */
.thw-cal-precip-bar {
    width: 45%;
    background: linear-gradient(to top, #2196f3, #64b5f6);
    border-radius: 2px 2px 0 0;
    min-height: 2px;
    max-height: 16px;
    opacity: 0.85;
}

/* PV energy bar (histogram) */
.thw-cal-pv-bar {
    width: 45%;
    background: linear-gradient(to top, #ff9800, #ffc107);
    border-radius: 2px 2px 0 0;
    min-height: 2px;
    max-height: 16px;
    opacity: 0.85;
}

/* Legend */
.thw-cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
    padding: 8px;
    background: white;
    border-radius: 6px;
    font-size: 0.7rem;
    color: #666;
}

.thw-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.thw-legend-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.1);
}

.thw-legend-color.thw-temp-freezing { background: #bbdefb; }
.thw-legend-color.thw-temp-cold { background: #b3e5fc; }
.thw-legend-color.thw-temp-moderate { background: #c8e6c9; }
.thw-legend-color.thw-temp-warm { background: #ffe0b2; }
.thw-legend-color.thw-temp-hot { background: #ffccbc; }

.thw-legend-bar {
    display: inline-block;
    width: 6px;
    height: 14px;
    border-radius: 2px;
}

.thw-legend-bar-precip {
    background: linear-gradient(to top, #2196f3, #64b5f6);
}

.thw-legend-bar-pv {
    background: linear-gradient(to top, #ff9800, #ffc107);
}

/* Day summaries (today/tomorrow) at the top of the modal */
.thw-day-summaries {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 6px;
    font-size: 0.8rem;
    flex-wrap: wrap;
}
.thw-day-summary {
    font-weight: 500;
}

/* Warning boxes for today/tomorrow */
.thw-warning-box {
    padding: 8px 12px;
    margin-bottom: 8px;
    font-weight: 600;
    border-left: 4px solid;
}
.thw-warning-red {
    background-color: #ffcdd2;
    color: #b71c1c;
    border-color: #b71c1c;
}
.thw-warning-orange {
    background-color: #ffe0b2;
    color: #e65100;
    border-color: #e65100;
}
.thw-warning-yellow {
    background-color: #fff9c4;
    color: #f57f17;
    border-color: #f57f17;
}

/* Nearest location container */
.thw-nearest-container {
    margin-bottom: 20px;
}

.thw-nearest-info {
    padding: 15px 20px;
    background: white;
    border-radius: 8px;
    font-size: 1rem;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 15px;
}

.thw-nearest-icon {
    font-size: 1.2rem;
}

.thw-loading-gps {
    padding: 30px;
    text-align: center;
    color: #666;
    background: white;
    border-radius: 8px;
}

/* Responsive */
@media (max-width: 900px) {
    .thw-cards-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .thw-weather-container {
        padding: 10px;
        border-radius: 0;
    }
    
    .thw-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 12px 15px;
    }
    
    .thw-title {
        font-size: 1.2rem;
    }
    
    .thw-search-box {
        flex-wrap: wrap;
        padding: 12px;
    }
    
    .thw-search-input {
        flex: 1 1 100%;
        min-width: 0;
        margin-bottom: 8px;
    }
    
    .thw-search-btn {
        flex: 1;
    }
    
    .thw-gps-btn {
        flex: 0 0 auto;
    }
    
    .thw-card-table {
        font-size: 0.65rem;
    }
    
    .thw-card-table th,
    .thw-card-table td {
        padding: 4px 2px;
    }
    
    .thw-period-col {
        min-width: 35px;
        font-size: 0.55rem;
    }
    
    .thw-period-col small {
        font-size: 0.5rem;
    }
    
    .thw-param-label {
        font-size: 0.8rem;
        padding-left: 5px !important;
    }
    
    .thw-modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .thw-modal-body {
        max-height: calc(100vh - 70px);
        padding: 10px;
    }
    
    /* 15-day forecast mobile */
    .thw-forecast-table {
        font-size: 0.75rem;
        min-width: 380px;
    }
    
    .thw-forecast-table th,
    .thw-forecast-table td {
        padding: 6px 3px;
    }
    
    .thw-forecast-table th {
        font-size: 0.7rem;
    }
    
    .thw-date-num {
        font-size: 0.8rem;
    }
    
    .thw-date-day {
        font-size: 0.6rem;
    }
    
    .thw-icon-cell {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .thw-search-box {
        flex-direction: column;
        gap: 8px;
    }
    
    .thw-search-input {
        width: 100%;
        margin-bottom: 0;
    }
    
    .thw-search-btn,
    .thw-gps-btn {
        width: 100%;
    }
    
    /* 15-day forecast very small screens */
    .thw-forecast-table {
        font-size: 0.7rem;
        min-width: 350px;
    }
    
    .thw-forecast-table th,
    .thw-forecast-table td {
        padding: 5px 2px;
    }
    
    .thw-date-cell {
        min-width: 42px;
    }
    
    .thw-temp-cell {
        min-width: 48px;
    }
}
