@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@500;600;700&family=Fira+Sans:wght@400;500;600;700&display=swap');

:root {
    --bg-1: #e2e8f0;
    --bg-2: #f8fafc;
    --surface: #ffffff;
    --surface-muted: #f1f5f9;
    --text: #0f172a;
    --text-muted: #475569;
    --border: #cbd5e1;
    --border-strong: #94a3b8;
    --brand: #0f172a;
    --brand-2: #1e293b;
    --accent: #22c55e;
    --accent-2: #16a34a;
    --danger: #b91c1c;
    --warning-bg: #fef9c3;
    --warning-text: #854d0e;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 16px 44px rgba(15, 23, 42, 0.12);
    --shadow-soft: 0 8px 18px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Fira Sans', 'Segoe UI', sans-serif;
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% 0%, rgba(30, 41, 59, 0.12), transparent 42%),
        linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 55%, #ffffff 100%);
}

.container {
    width: min(1200px, 100% - 2.5rem);
    margin: 0 auto;
}

header {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.9rem 0;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 10px 32px rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
}

h1 {
    margin: 0;
    font-family: 'Fira Code', monospace;
    font-size: clamp(1.1rem, 1.2vw + 0.9rem, 1.55rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #f8fafc;
    text-align: center;
    white-space: normal;
}

nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.55rem;
}

nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.52rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 600;
    text-align: center;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

nav a:hover,
nav a:focus-visible {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.55);
    color: #ffffff;
    outline: none;
}

nav a[aria-current="page"] {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.92), rgba(22, 163, 74, 0.92));
    border-color: rgba(34, 197, 94, 0.95);
    color: #f8fafc;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.18), 0 8px 16px rgba(22, 163, 74, 0.28);
}

.main-content {
    padding: 1.4rem 0 2rem;
}

.section-card,
.results,
.search-section {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-soft);
}

h2 {
    margin: 0 0 1rem;
    font-size: clamp(1.15rem, 0.9vw + 1rem, 1.55rem);
    color: var(--brand);
    letter-spacing: 0.01em;
}

h3,
.day-header {
    margin: 1.25rem 0 0.7rem;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: 0;
    color: var(--brand);
    font-size: 1rem;
    font-weight: 700;
}

.instructions {
    margin-bottom: 1rem;
    padding: 0.8rem 0.95rem;
    border-radius: var(--radius-sm);
    border: 1px solid #bae6fd;
    background: #f0f9ff;
    color: #0c4a6e;
    font-size: 0.94rem;
}

.table-scroll-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.9rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 600;
}

.table-scroll-hint .hint-icon {
    font-size: 0.92rem;
    color: #0f172a;
}

.table-scroll-hint .hint-note {
    display: inline-block;
    margin-top: 0.12rem;
}

.action-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: 0.9rem;
}

.action-row .btn-primary {
    flex: 0 0 auto;
}

.action-row .table-scroll-hint {
    flex: 1 1 auto;
    min-width: 0;
    margin-top: 0;
}

.weather-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    line-height: 1;
    animation: wxBadgeFloat 4.8s ease-in-out infinite;
}

.weather-icon-badge svg {
    width: 1.35rem;
    height: 1.35rem;
    display: block;
    transform-origin: center;
}

.weather-icon-badge .wx-rays {
    stroke: #f59e0b;
    stroke-width: 1.5;
    stroke-linecap: round;
    animation: wxSunRays 8s linear infinite;
    transform-origin: 12px 12px;
}

.weather-icon-badge .wx-sun-core {
    fill: #fbbf24;
    stroke: #f59e0b;
    stroke-width: 1.2;
}

.weather-icon-badge .wx-cloud {
    fill: #cbd5e1;
    stroke: #64748b;
    stroke-width: 1.2;
}

.weather-icon-badge .wx-cloud-light {
    fill: #dbe7f2;
    stroke: #7c8ea3;
    stroke-width: 1.1;
}

.weather-icon-badge .wx-cloud-dark {
    fill: #94a3b8;
    stroke: #475569;
    stroke-width: 1.2;
}

.weather-icon-badge .wx-drop {
    stroke: #0284c7;
    stroke-width: 1.55;
    stroke-linecap: round;
    animation: wxRainDrop 1.05s linear infinite;
}

.weather-icon-badge .wx-drop.d2 {
    animation-delay: 0.2s;
}

.weather-icon-badge .wx-drop.d3 {
    animation-delay: 0.4s;
}

.weather-icon-badge .wx-drop.d4 {
    animation-delay: 0.14s;
}

.weather-icon-badge .wx-drop.d5 {
    animation-delay: 0.33s;
}

.weather-icon-badge .wx-bolt {
    fill: #facc15;
    stroke: #ca8a04;
    stroke-width: 0.9;
    animation: wxBoltFlash 1.15s steps(2, end) infinite;
}

.weather-icon-badge .wx-hail circle,
.weather-icon-badge .wx-flake {
    fill: #dbeafe;
    stroke: #60a5fa;
    stroke-width: 0.8;
    animation: wxSnowDrift 1.9s ease-in-out infinite;
}

.weather-icon-badge .wx-flake.f2 {
    animation-delay: 0.3s;
}

.weather-icon-badge .wx-flake.f3 {
    animation-delay: 0.5s;
}

.weather-icon-badge .wx-flake.f4 {
    animation-delay: 0.7s;
}

.weather-icon-badge .wx-fog line {
    stroke: #94a3b8;
    stroke-width: 1.45;
    stroke-linecap: round;
    animation: wxFogMove 2.8s ease-in-out infinite;
}

.weather-icon-badge .wx-fog .f2 {
    animation-delay: 0.35s;
}

.weather-icon-badge .wx-freeze line {
    stroke: #38bdf8;
    stroke-width: 1.5;
    stroke-linecap: round;
    animation: wxFreezePulse 1.6s ease-in-out infinite;
}

.weather-icon-badge .wx-na {
    fill: #94a3b8;
}

.weather-icon-sunny,
.weather-icon-clear-sky,
.weather-icon-mainly-clear,
.weather-icon-partly-cloudy {
    border-color: #fcd34d;
    background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
}

.weather-icon-sunny,
.weather-icon-clear-sky {
    animation: wxBadgeFloat 4.8s ease-in-out infinite, wxSunGlow 3s ease-in-out infinite;
}

.weather-icon-cloudy,
.weather-icon-overcast,
.weather-icon-fog {
    border-color: #cbd5e1;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
}

.weather-icon-cloudy svg,
.weather-icon-overcast svg,
.weather-icon-fog svg,
.weather-icon-mainly-clear svg,
.weather-icon-partly-cloudy svg {
    animation: wxCloudDrift 5.2s ease-in-out infinite;
}

.weather-icon-drizzle,
.weather-icon-light-rain,
.weather-icon-moderate-rain,
.weather-icon-heavy-rain,
.weather-icon-showers,
.weather-icon-thunderstorm,
.weather-icon-thunder-hail,
.weather-icon-freezing,
.weather-icon-snow-light,
.weather-icon-snow-moderate,
.weather-icon-snow-heavy {
    border-color: #bfdbfe;
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
}

.weather-icon-heavy-rain .wx-drop,
.weather-icon-showers .wx-drop,
.weather-icon-thunderstorm .wx-drop,
.weather-icon-thunder-hail .wx-drop {
    animation-duration: 0.78s;
}

@keyframes wxBadgeFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-1.5px); }
}

@keyframes wxSunGlow {
    0%, 100% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 0 rgba(251, 191, 36, 0.18); }
    50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 4px rgba(251, 191, 36, 0.13); }
}

@keyframes wxSunRays {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes wxCloudDrift {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(1.2px); }
}

@keyframes wxRainDrop {
    0% { opacity: 0.2; transform: translateY(-0.3px); }
    40% { opacity: 1; }
    100% { opacity: 0.25; transform: translateY(2.5px); }
}

@keyframes wxBoltFlash {
    0%, 44% { opacity: 0.2; }
    45%, 48% { opacity: 1; }
    49%, 77% { opacity: 0.2; }
    78%, 81% { opacity: 1; }
    82%, 100% { opacity: 0.2; }
}

@keyframes wxSnowDrift {
    0%, 100% { transform: translateY(0); opacity: 0.85; }
    50% { transform: translateY(1.2px); opacity: 1; }
}

@keyframes wxFogMove {
    0%, 100% { transform: translateX(0); opacity: 0.75; }
    50% { transform: translateX(1.3px); opacity: 1; }
}

@keyframes wxFreezePulse {
    0%, 100% { opacity: 0.65; }
    50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .weather-icon-badge,
    .weather-icon-badge svg,
    .weather-icon-badge * {
        animation: none !important;
    }
}
    .weather-icon-badge,
    .weather-icon-badge svg,
    .weather-icon-sunny {
        animation: none !important;
    }
}

.search-container {
    margin-bottom: 1rem;
}

#location-search,
input[type="text"],
input[type="number"] {
    width: 100%;
    min-height: 44px;
    padding: 0.68rem 0.78rem;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font: inherit;
    color: var(--text);
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#location-search:focus,
input[type="text"]:focus,
input[type="number"]:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
    outline: none;
}

#map {
    width: 100%;
    height: clamp(250px, 42vw, 390px);
    margin-bottom: 1rem;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    overflow: hidden;
}

.coordinates-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

label {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-muted);
}

.btn-primary,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.7rem 1.1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.2s ease;
}

.btn-primary:hover,
button:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

.btn-primary:focus-visible,
button:focus-visible {
    outline: 3px solid rgba(34, 197, 94, 0.35);
    outline-offset: 2px;
}

.status-message {
    margin-top: 0.95rem;
    padding: 0.72rem 0.85rem;
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 700;
    display: none;
}

.status-updating {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-color: #fde68a;
    animation: status-blink 1s steps(2, start) infinite;
}

.status-completed {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: #86efac;
}

.status-unavailable {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

@keyframes status-blink {
    50% {
        opacity: 0.45;
    }
}

#weather-results,
#hourly-results {
    display: grid;
    gap: 1rem;
    overflow-x: visible;
}

#weather-results > *,
#hourly-results > * {
    min-width: 0;
}

table {
    width: 100%;
    min-width: 720px;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: visible;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

#weather-results,
#hourly-results,
.section-card {
    overflow-x: visible;
}

.table-scroll {
    position: relative;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.comparison-table {
    min-width: 980px;
}

.comparison-table th,
.comparison-table td {
    white-space: nowrap;
}

th,
td {
    padding: 0.68rem 0.72rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.88rem;
    vertical-align: top;
}

th {
    background: linear-gradient(180deg, var(--brand-2) 0%, var(--brand) 100%);
    color: #f8fafc;
    font-weight: 700;
}

tr:nth-child(even) {
    background: #f8fafc;
}

tr:hover {
    background: #eef2ff;
}

table tr > :first-child {
    position: sticky;
    left: 0;
    z-index: 3;
}

table td:first-child {
    background: #ffffff;
}

table th:first-child {
    background: linear-gradient(180deg, var(--brand-2) 0%, var(--brand) 100%);
    z-index: 4;
}

tr:nth-child(even) td:first-child {
    background: #f8fafc;
}

tr:hover td:first-child {
    background: #eef2ff;
}

.color-red {
    color: #dc2626;
    font-weight: 700;
}

.color-orange {
    color: #ea580c;
    font-weight: 700;
}

.color-light-green {
    color: #16a34a;
    font-weight: 700;
}

.color-green {
    color: #15803d;
    font-weight: 700;
}

.solar-row {
    background: #fefce8 !important;
    border-left: 4px solid #eab308;
}

.solar-row td {
    color: #713f12;
    font-weight: 700;
}

.collapse-btn {
    min-height: 28px;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    font-size: 0.8rem;
}

@media (max-width: 980px) {
    .container {
        width: min(1200px, 100% - 1.4rem);
    }

    nav a {
        flex: 1 1 calc(50% - 0.55rem);
    }
}

@media (max-width: 640px) {
    body {
        line-height: 1.45;
    }

    .main-content {
        padding-top: 1rem;
    }

    .section-card,
    .results,
    .search-section {
        padding: 1rem 0.85rem;
        border-radius: 12px;
    }

    .instructions {
        font-size: 0.88rem;
    }

    #map {
        height: 245px;
    }

    table {
        min-width: 640px;
    }

    th,
    td {
        font-size: 0.8rem;
        padding: 0.56rem 0.56rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
