* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'NetworkSans', sans-serif;
    background: #4a9ac4;
    color: #231f20;
    -webkit-font-smoothing: antialiased;
    transition: color 0.5s ease;
}

    body.night-mode {
        color: #ffffff;
    }

/* ===== WEATHER ALERT BANNERS ===== */
.weather-alert-banner {
    background: #FFC107;
    color: #000;
    cursor: pointer;
    border-bottom: 2px solid rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transition: background 0.3s ease, color 0.3s ease;
    -webkit-overflow-scrolling: touch;
}

    .weather-alert-banner.expanded {
        background: #fff;
        color: #1a1a1a;
    }

/* Collapsed state */
.alert-collapsed-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    max-height: 60px;
    overflow: hidden;
    opacity: 1;
    transition: max-height 0.25s ease, opacity 0.15s ease, padding 0.25s ease;
}

.weather-alert-banner.expanded .alert-collapsed-content {
    max-height: 0;
    opacity: 0;
    padding: 0 16px;
}

.alert-event {
    font-size: 15px;
    font-weight: 700;
    flex: 1;
    line-height: 1.7;
}

/* Expanded state */
.alert-expanded-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    will-change: max-height, opacity;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.weather-alert-banner.expanded .alert-expanded-content {
    max-height: 5000px;
    opacity: 1;
}

.alert-expanded-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 12px;
}

.alert-details-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 4px;
}

.alert-details-issued {
    font-size: 12px;
    color: #666;
}

/* Arrow */
.alert-inner {
    position: relative;
}

.alert-tap-hint {
    position: absolute;
    top: 10px;
    right: 16px;
    font-family: 'NetworkDings', sans-serif;
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
    display: inline-block;
    transition: transform 0.25s ease;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.weather-alert-banner.expanded .alert-tap-hint {
    transform: rotate(180deg);
}

.alert-collapsed-content {
    padding-right: 40px;
}

.alert-expanded-top {
    padding-right: 40px;
}

/* Body content */
.alert-details-body {
    padding: 0 16px;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    overflow: hidden;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

    .alert-details-body * {
        max-width: 100%;
    }

    .alert-details-body h1,
    .alert-details-body h2,
    .alert-details-body h3,
    .alert-details-body h4 {
        font-size: 16px;
        font-weight: 700;
        margin-top: 1em;
        margin-bottom: 0.3em;
        color: #1a1a1a;
    }

    .alert-details-body p {
        margin-top: 0;
        margin-bottom: 0.5rem;
    }

    .alert-details-body ul,
    .alert-details-body ol {
        padding-left: 20px;
        margin-bottom: 0.8em;
    }

    .alert-details-body li {
        margin-bottom: 0.3em;
    }

    .alert-details-body strong,
    .alert-details-body b {
        font-weight: 600;
        font-size: inherit;
    }

    .alert-details-body img {
        max-width: 100%;
        height: auto;
        margin: 8px 0;
        border-radius: 4px;
    }

    .alert-details-body table {
        width: 100%;
        border-collapse: collapse;
        font-size: 12px;
        margin-bottom: 0.8em;
    }

    .alert-details-body td,
    .alert-details-body th {
        padding: 4px 8px;
        border: 1px solid #ddd;
        text-align: left;
    }

    .alert-details-body a {
        color: #2461e5;
        word-break: break-all;
    }

/* Footer */
.alert-details-footer {
    margin: 12px 16px 0;
    padding: 10px 0;
    border-top: 1px solid #e0e0e0;
    font-size: 11px;
    color: #999;
}
/* ===== SPLASH SCREEN - Initial loading ===== */

html.night-mode-init {
    background: #000;
}

    html.night-mode-init body {
        background: #000;
        color: #ffffff;
    }

    html.night-mode-init .page-container,
    html.night-mode-init .weather-display {
        background: #003c80;
        color: #ffffff;
    }

    html.night-mode-init #splashScreen {
        background: #003c80 !important;
        color: #ffffff !important;
    }

        html.night-mode-init #splashScreen div {
            color: #ffffff !important;
        }

/* ===== PAGE CONTAINER ===== */

.page-container {
    min-height: 100vh;
    background: #a8d8f0;
    max-width: 100%;
    transition: background-color 0.5s ease;
}

body.night-mode .page-container {
    background: #003c80;
}

/* ===== HEADER ===== */

.header-bar {
    background: #4a9ac4;
    padding: 6px 16px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    transition: background-color 0.5s ease, border-bottom 0.5s ease;
}

body.night-mode .header-bar {
    background: transparent;
    border-bottom: 1px solid #ffffff;
}

.last-updated {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    color: #231f20;
}

body.night-mode .last-updated {
    color: #ffffff;
}

.last-updated-label {
    font-size: 11px;
}

.last-updated-time {
    font-size: 14px;
    font-weight: 600;
}

/* ===== STATION INFO ===== */

.station-info {
    padding: 20px 16px;
}

.station-name {
    font-size: 28px;
    font-weight: 700;
    color: #231f20;
    line-height: 1.2;
}

body.night-mode .station-name {
    color: #ffffff;
}

.station-location {
    font-size: 14px;
    opacity: 0.7;
    font-weight: 400;
}

/* ===== MAIN CONTENT SECTIONS ===== */

.weather-content {
    padding: 0 16px 20px 16px;
}

.mobile-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    opacity: 0.9;
}

/* ===== CURRENT CONDITIONS ===== */

.current-conditions {
    display: flex;
    align-items: center;
    gap: 30px;
}

.current-icon {
    width: 100px;
    height: 100px;
    min-width: 100px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .current-icon img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

.current-temp-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.current-temp {
    font-size: 56px;
    font-weight: 400;
    line-height: 1;
}

.feels-like {
    font-size: 16px;
    font-weight: 400;
    opacity: 0.9;
}

/* ===== WIND SECTION ===== */

.wind-section-mobile {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.wind-arrow {
    width: 35px;
    height: 35px;
    color: #231f20;
    transform-origin: center center;
    transition: transform 0.3s ease;
}

    .wind-arrow path {
        stroke: currentColor;
        stroke-width: 500;
        fill: none;
    }

body.night-mode .wind-arrow {
    color: #ffffff;
}

.wind-info-mobile {
    display: flex;
    justify-content: center;
    align-items: center;
}

.wind-display {
    display: flex;
    align-items: center;
    gap: 16px;
}

.wind-compass {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wind-calm {
    width: 35px;
    height: 35px;
    color: #231f20;
}

    .wind-calm circle {
        stroke: currentColor;
        stroke-width: 500;
        fill: none;
    }

body.night-mode .wind-calm {
    color: #ffffff;
}

.wind-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.wind-direction {
    font-size: 18px;
    margin: 0;
    line-height: 1.2;
}

.wind-speed {
    font-size: 18px;
    font-weight: 600;
    opacity: 0.9;
}

.gust-info-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.summary-label {
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 4px;
}

.summary-value {
    font-size: 18px;
    font-weight: 600;
}

/* ===== RAIN & PRESSURE ===== */

.rain-pressure-mobile {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.rain-pressure-info {
    text-align: center;
}

.rain-pressure-label {
    font-size: 12px;
    margin-bottom: 4px;
    opacity: 0.8;
}

.rain-pressure-value {
    font-size: 18px;
    font-weight: 600;
}

/* ===== DIVIDER ===== */

.divider {
    width: 100%;
    height: 1.5px;
    background: #231f20;
    margin: 24px 0;
}

/* ===== MAIN SECTION ===== */

.main-section::before {
    content: '';
    display: block;
    width: calc(100% + 32px);
    height: 2px;
    background: #231f20;
    margin: -24px -16px 24px -16px;
}

body.night-mode .main-section::before {
    display: none;
}

.main-section {
    background: #a8d8f0;
    padding: 24px 16px 20px 16px;
    margin: 0 -16px;
}

    /* Primary text in main section */
    .main-section .section-title,
    .main-section .detail-value,
    .main-section .summary-group-value {
        color: #333434;
    }

    /* Secondary text in main section */
    .main-section .detail-label,
    .main-section .summary-group-label,
    .main-section .summary-group-time {
        color: #333434;
    }

    /* Dividers in main section */
    .main-section .divider {
        background: rgba(0, 0, 0, 1);
    }

    /* Cards in main section */
    .main-section .hour-forecast,
    .main-section .summary-column {
        background: rgba(255, 255, 255, 0.3);
        color: #333434;
    }

    /* Rain indicators in main section */
    .main-section .hour-rain,
    .main-section .day-rain {
        color: #003C80;
    }

/* ===== DETAILS GRID ===== */

.details-mobile {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 13px;
    margin-bottom: 4px;
    opacity: 0.8;
}

.detail-value {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.trend-arrow {
    font-size: 16px;
    font-family: NetworkDings;
}

/* ===== 7-HOUR FORECAST ===== */

.forecast-7hour {
    display: flex;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    overscroll-behavior-x: contain;
}

    .forecast-7hour::-webkit-scrollbar {
        display: none;
    }

.hour-forecast {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    gap: 8px;
    min-width: 90px;
}

    /* Dividers between hours */
    .hour-forecast.day-to-day {
        border-right: 2px solid rgba(0, 0, 0, 0.2);
    }

    .hour-forecast.night-to-night {
        border-right: 2px solid rgba(168, 216, 240, 0.3);
    }

/* Remove border from last hour of each day group for continuity */
.hour-group > .hour-forecast:last-child {
    border-right: none !important;
}

.hour-forecast:last-child,
.hour-group .hour-forecast:last-child {
    border-right: none !important;
}

.hour-forecast:last-child {
    border-bottom-right-radius: 8px;
    border-top-right-radius: 8px;
}

.hour-forecast:first-child {
    border-bottom-left-radius: 8px;
    border-top-left-radius: 8px;
}

/* Day/night styling for hourly forecast tiles */
.hour-forecast.day,
.main-section .hour-forecast.day {
    background: #a8d8f0;
    color: #231f20;
}

    .hour-forecast.day .hour-time,
    .hour-forecast.day .hour-temp,
    .hour-forecast.day .hour-wind,
    .main-section .hour-forecast.day .hour-time,
    .main-section .hour-forecast.day .hour-temp,
    .main-section .hour-forecast.day .hour-wind {
        color: #333434;
    }

    .hour-forecast.day .hour-rain,
    .main-section .hour-forecast.day .hour-rain {
        color: #003C80;
    }

.hour-forecast.night,
.main-section .hour-forecast.night {
    background: #003c80;
    color: #ffffff;
}

    .hour-forecast.night .hour-time,
    .hour-forecast.night .hour-temp,
    .hour-forecast.night .hour-wind,
    .main-section .hour-forecast.night .hour-time,
    .main-section .hour-forecast.night .hour-temp,
    .main-section .hour-forecast.night .hour-wind {
        color: #ffffff;
    }

    .hour-forecast.night .hour-rain,
    .main-section .hour-forecast.night .hour-rain {
        color: #4A9EFF;
    }

.hour-time {
    font-size: 13px;
    font-weight: 500;
}

.hour-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .hour-icon img {
        max-width: 90%;
        max-height: 90%;
        width: auto;
        height: auto;
        object-fit: contain;
    }

.hour-temp {
    font-size: 18px;
    font-weight: 600;
}

.hour-wind {
    font-size: 12px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.hour-wind-arrow {
    width: 12px;
    height: 12px;
    color: currentColor;
    flex-shrink: 0;
}

    .hour-wind-arrow path {
        stroke: currentColor;
    }

.hour-rain {
    font-size: 12px;
    font-weight: 500;
}

/* ===== 7-DAY FORECAST - Vertical Grid ===== */

.forecast-7day {
    display: flex;
    flex-direction: column;
}

.day-forecast {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1.25fr;
    gap: 12px;
    align-items: center;
    text-align: center;
    padding: 7.5px;
    color: #333434;
    border-bottom: 2px solid rgba(0, 0, 0, 0.2);
    justify-items: center;
}

    .day-forecast:last-child {
        border-bottom: none !important;
    }

.day-name {
    font-size: 16px;
    font-weight: 600;
    text-align: left;
    min-width: 95px;
    text-align: left;
    flex-direction: column;
}

.day-date {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.6;
}

.day-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .day-icon img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

.day-temp-range {
    display: flex;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    min-width: 50px;
    justify-content: center;
    text-align: center;
}

.day-temp-low {
    opacity: 0.6;
}

.day-temp-high {
    color: inherit;
}

.day-rain {
    font-size: 14px;
    font-weight: 500;
    color: #003C80;
    min-width: 70px;
    justify-content: center;
}

/* ===== WIND & RAIN SUMMARY ===== */

.wind-rain-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    align-items: stretch;
}

.wind-rain-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 8px 12px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    justify-content: space-evenly;
}

.wind-rain-summary .summary-group {
    min-height: unset;
}

.wind-summary-group {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center;
    gap: 10px;
}

    .wind-summary-group .wind-compass {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    .wind-summary-group .wind-arrow,
    .wind-summary-group .wind-calm {
        width: 36px;
        height: 36px;
    }

.wind-summary-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

    .wind-summary-text .summary-group-label {
        opacity: 1;
        font-size: 16px;
        font-weight: 400;
        margin-bottom: 2px;
    }

#windDirection {
    font-size: 16px;
    font-weight: 400;
    opacity: 1;
}

.wind-summary-text .summary-group-value {
    font-size: 16px;
}

/* ===== TODAY'S SUMMARY ===== */

.todays-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.summary-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    justify-content: center;
}

.summary-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 51px;
    text-align: center;
}

.summary-group-label {
    font-size: 13px;
    opacity: 0.7;
    margin-bottom: 4px;
    line-height: 1.2;
}

.summary-group-value {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
    line-height: 1.1;
}

.summary-group-time {
    font-size: 12px;
    opacity: 0.7;
}

.summary-group.temp-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 51px;
    justify-content: flex-start;
}

.summary-column:has(.summary-group[style*="display: none"]) {
    justify-content: center;
}

/* ===== TABLET BREAKPOINT ===== */

@media (min-width: 768px) {
    .wind-info-mobile {
        gap: 16px;
    }

    .wind-compass {
        width: 50px;
        height: 50px;
    }

    .wind-arrow {
        width: 50px;
        height: 50px;
    }

        .wind-arrow::before {
            border-left-width: 13px;
            border-right-width: 13px;
            border-bottom-width: 35px;
        }

        .wind-arrow::after {
            border-left-width: 10px;
            border-right-width: 10px;
            border-bottom-width: 28px;
        }

    .wind-direction {
        font-size: 22px;
    }

    .wind-speed {
        font-size: 16px;
    }

    .summary-label {
        font-size: 13px;
    }

    .summary-value {
        font-size: 20px;
    }

    .todays-summary {
        gap: 16px;
    }

    .summary-column {
        padding: 20px 16px;
        gap: 20px;
    }

    .summary-group-label {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .summary-group-value {
        font-size: 26px;
        margin-bottom: 4px;
    }

    .summary-group-time {
        font-size: 12px;
    }

    .summary-group-spacer {
        height: 12px;
    }

    /* Tablet - 7-day forecast larger */
    .day-forecast {
        padding: 16px 20px;
        gap: 16px;
    }

    .day-name {
        font-size: 18px;
    }

    .day-icon {
        width: 48px;
        height: 48px;
    }

    .day-temp-range {
        font-size: 18px;
        min-width: 90px;
    }

    .day-rain {
        font-size: 15px;
        min-width: 80px;
    }
}

/* ===== DESKTOP BREAKPOINT ===== */

@media (min-width: 1200px) {
    .todays-summary {
        gap: 24px;
    }

    .summary-column {
        padding: 24px 20px;
        gap: 24px;
    }

    .summary-group-label {
        font-size: 14px;
    }

    .summary-group-value {
        font-size: 28px;
    }

    .summary-group-time {
        font-size: 13px;
    }

    .summary-group-spacer {
        height: 13px;
    }
}

/* ===== PWA MODE ===== */

@media all and (display-mode: standalone) {
    *::-webkit-scrollbar {
        display: none;
    }

    * {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    body {
        overscroll-behavior: none;
        overscroll-behavior-y: none;
    }
}

/* ===== iOS SPECIFIC ===== */

@supports (-webkit-touch-callout: none) {
    body {
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    .header-bar {
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .page-container {
        padding-bottom: env(safe-area-inset-bottom);
    }
}


/* ===== SMALL PHONE FORECAST AREA ===== */
@media (max-width: 370px) {
    .day-forecast {
        grid-template-columns: auto;
        grid-template-rows: auto auto;
        gap: 8px;
    }

    .day-name {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .day-icon,
    .day-temp-range,
    .day-rain {
        grid-row: 2;
    }

    .day-icon {
        grid-column: 1;
        justify-self: start;
        margin-left: 20px;
    }

    .day-temp-range {
        grid-column: 2;
    }

    .day-rain {
        grid-column: 3;
        justify-self: end;
        margin-right: 20px;
    }
}

/* Disable selection in PWA mode */
@media (display-mode: standalone) {
    * {
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        -webkit-touch-callout: none;
    }

    img {
        pointer-events: none;
    }
}
