/* Weather page — site layout styles */

/* ── Global width constraints ──
   Prevent any weather block from forcing the page wider than the viewport. */
#wx-content,
#wx-content > .grid,
#wx-content .lg\:col-span-2,
#wx-content .bg-white,
#wx-content .space-y-4,
#wx-content .space-y-6,
#wx-hourly-wrap,
.wx-hourly-strip {
    max-width: 100%;
    min-width: 0;
}

#wx-content .bg-white {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Hourly scroll strip */
.wx-hourly-strip {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.wx-hourly-strip::-webkit-scrollbar {
    display: none;
}

.wx-hour-card {
    flex: 0 0 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 1rem;
    padding: 0.75rem 0.5rem;
    scroll-snap-align: start;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: transform 150ms ease, border-color 150ms ease;
}

.wx-hour-card.spray-ok {
    border-color: rgba(34, 197, 94, 0.4);
}

.wx-hour-card:hover {
    transform: translateY(-2px);
}

/* Forecast day cards */
.wx-day-card {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 1rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: transform 200ms ease, box-shadow 200ms ease;
}

.wx-day-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.wx-day-card.no-spray {
    border-left: 3px solid #ef4444;
}

/* ── Orchard activity recommendation cards ── */
.wx-activity-card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-left: 4px solid #94a3b8;
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.wx-activity-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.wx-activity-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.wx-activity-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    white-space: nowrap;
}

/* Status variants */
.wx-activity-good {
    border-left-color: #16a34a;
}

.wx-activity-good .wx-activity-icon {
    background: #dcfce7;
    color: #16a34a;
}

.wx-activity-good .wx-activity-badge {
    background: #dcfce7;
    color: #166534;
}

.wx-activity-caution {
    border-left-color: #ca8a04;
}

.wx-activity-caution .wx-activity-icon {
    background: #fef9c3;
    color: #ca8a04;
}

.wx-activity-caution .wx-activity-badge {
    background: #fef9c3;
    color: #854d0e;
}

.wx-activity-avoid {
    border-left-color: #dc2626;
}

.wx-activity-avoid .wx-activity-icon {
    background: #fee2e2;
    color: #dc2626;
}

.wx-activity-avoid .wx-activity-badge {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Mobile-first responsive fixes ──
   The project's Tailwind build treats sm: responsive prefixes as base
   classes, so we override the weather layout explicitly here. */

@media (max-width: 639px) {
    /* Location prompt: stack inputs */
    #wx-location-prompt .flex.items-end.gap-2 {
        flex-direction: column;
        align-items: stretch;
    }

    #wx-location-prompt .flex.items-end.gap-2 > div,
    #wx-location-prompt .flex.items-end.gap-2 > button {
        width: 100%;
    }

    #wx-manual-btn {
        height: auto;
        padding: 0.75rem;
    }

    /* Quick stats: keep 2 columns but shrink padding */
    #wx-stats-row {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    #wx-stats-row > div {
        padding: 0.75rem 0.5rem;
    }

    #wx-stats-row i {
        font-size: 1rem;
    }

    #wx-stats-row p:first-of-type {
        font-size: 1.125rem;
    }

    #wx-stats-row p:last-of-type {
        font-size: 0.6rem;
    }

    /* Current conditions */
    #wx-temp {
        font-size: 2.5rem;
        line-height: 1;
    }

    #wx-condition {
        font-size: 1rem;
    }

    #wx-hero-icon {
        width: 4rem;
        height: 4rem;
        font-size: 2rem;
    }

    /* Details row: sm:grid-cols-6 is applied at all sizes by the broken
       Tailwind build, so force 2 columns on small screens. */
    #wx-details-row {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.75rem !important;
    }

    #wx-details-row > div {
        min-width: 0;
    }

    #wx-details-row i {
        font-size: 0.75rem;
    }

    #wx-details-row p.text-sm {
        font-size: 0.75rem;
    }

    #wx-details-row p.text-\[10px\] {
        font-size: 0.65rem;
    }

    /* Hourly strip: slightly smaller cards */
    .wx-hour-card {
        flex: 0 0 60px;
        padding: 0.625rem 0.375rem;
    }

    .wx-hour-card i {
        font-size: 1rem;
    }

    .wx-hour-card p.text-sm {
        font-size: 0.75rem;
    }

    /* Spray card */
    #wx-spray-card {
        padding: 1rem;
    }

    #wx-spray-title {
        font-size: 0.9375rem;
    }

    #wx-spray-text {
        font-size: 0.8125rem;
    }

    /* Activity cards: single column on small screens */
    #wx-activities {
        grid-template-columns: 1fr !important;
    }

    .wx-activity-card {
        padding: 0.875rem;
    }

    /* 7-day forecast: stacked card layout */
    .wx-day-card {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.875rem;
    }

    .wx-day-icon,
    .wx-day-left,
    .wx-day-center,
    .wx-day-temps {
        grid-column: auto;
        grid-row: auto;
        width: 100%;
        text-align: left;
    }

    .wx-day-icon {
        display: none;
    }

    .wx-day-card > .wx-day-left,
    .wx-day-card > .wx-day-temps {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }

    .wx-day-card > .wx-day-left p:last-child,
    .wx-day-card > .wx-day-temps p:last-child {
        text-align: right;
    }

    .wx-day-temps {
        display: flex;
        flex-direction: row;
        align-items: baseline;
        gap: 0.5rem;
    }

    .wx-day-temps p {
        margin: 0;
    }

    .wx-day-temps p:first-child {
        font-size: 1.25rem;
    }

    .wx-day-center .flex.flex-wrap.gap-2 {
        gap: 0.375rem;
    }

    .wx-day-center span {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }

    .wx-day-center > p.font-semibold {
        margin-bottom: 0.5rem;
        font-size: 0.9375rem;
    }

    /* Section title spacing */
    #weather-heading {
        font-size: 1.5rem;
    }

    /* Disclaimer + refresh button */
    #wx-content > .mt-8.flex.gap-3 {
        flex-direction: column;
        gap: 0.75rem;
        font-size: 0.8125rem;
    }
}

@media (min-width: 640px) and (max-width: 1023px) {
    /* Details row: 3 columns on tablets */
    #wx-details-row {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 0.75rem !important;
    }

    /* Forecast cards: keep grid but smaller gaps */
    .wx-day-card {
        gap: 0.875rem;
        padding: 1rem;
    }
}

@media (min-width: 1024px) {
    /* Desktop: allow the 6-column details row */
    #wx-details-row {
        grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
        gap: 0.75rem !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .wx-hour-card,
    .wx-day-card,
    .wx-activity-card {
        transition: none;
    }
}
