@import url('https://fonts.googleapis.com/css2?family=Comic+Relief:wght@400;700&family=Fredoka:wght@300..700&family=Nunito:ital,wght@0,200..1000;1,200..1000&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');

:root {
    --bg-deep:        #080e1a;
    --bg-card:        #061A2B;
    --bg-search:      #0A2C45;
    --bg-glass:       rgba(255,255,255,0.05);
    --border:         rgba(255,255,255,0.08);
    --accent:         rgb(0, 187, 255);
    --accent-soft:    rgba(56,189,248,0.15);
    --accent-glow:    rgba(56,189,248,0.35);
    --accent-glow-lg: rgba(56,189,248,0.18);
    --text-primary:   #f0f6ff;
    --text-secondary: #CCCCCC;
    --text-muted:     #B3B3B3;
    --radius-lg:      22px;
    --radius-md:      14px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── B ── */
body {
    font-family: "Roboto", sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    padding: 40px 16px 56px;
    display: grid;
    place-items: center;
}

/* ── Container ── */
.container {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ── Weather Card ── */
.weather-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 56px 56px 48px;
    display: flex;
    flex-direction: column;
    gap: 36px;
    position: relative;
    overflow: hidden;
}

/* Subtle top-edge glow line */
.weather-card::before {
    content: '';
    position: absolute;
    top: 0; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
    border-radius: 50%;
}

/* ── Header Row ── */
.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

h1 {
    font-size: 2.6rem;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    white-space: nowrap;
    text-align: center;
}

/* ── Search Bar ── */
.search-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-search);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 8px 8px 8px 22px;
    gap: 10px;
    flex: 1;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.search-bar:focus-within {
    border-color: var(--accent);
    background: rgba(56,189,248,0.06);
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    width: 100%;
}

.search-bar input::placeholder { color: var(--text-muted); }

#search-btn {
    background: var(--accent);
    border: none;
    border-radius: 50px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}

#search-btn:disabled {
  opacity: 1;
  color: #fff;
  -webkit-text-fill-color: #fff; /* helps in Chromium/Safari */
}

/* ── Location Info ── */
.location-info { text-align: center; }

.city-name {
    font-size: 3.15rem;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.date {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 300;
    letter-spacing: 1px;
}

/* ── Main Weather ── */
.main-weather {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    background: linear-gradient(135deg, rgba(56,189,248,0.07) 0%, var(--bg-glass) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 44px 60px;
    position: relative;
    overflow: hidden;
}

.main-weather::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.temperature-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.temperature {
    font-size: 7.5rem;
    line-height: 1;
    color: var(--text-primary);
    letter-spacing: -6px;
}

.unit-toggle {
    display: flex;
    gap: 18px;
}

.unit-toggle label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
}

.unit-toggle input[type="radio"] { accent-color: var(--accent); cursor: pointer; }

.weather-description {
    font-size: 1.5rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* ── Weather Icon ── */
.weather-icon-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.weather-icon {
    font-size: 10rem;
    line-height: 1;
}

.feels-like {
    font-size: 1.75rem;
    color: var(--text-secondary);
}

/* ── Divider ── */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

/* ── Shared Card Item (Sun + Detail) ── */
.sun-info,
.extra-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.sun-item,
.detail-item {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;        /* stretch to fill grid cell */
    max-width: none;    /* remove the old 220px cap */
}

.sun-item > span,
.detail-item > span {
    font-size: 4rem;
}

.sun-item > p:first-of-type,
.detail-item > p:first-of-type {
    font-size: 1.5rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
    font-weight: 500;
}

.sun-time,
.detail-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ── Forecast Section ── */
.forecast-section {
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 36px 36px 32px;
    background: linear-gradient(135deg, rgba(56,189,248,0.07) 0%, var(--bg-glass) 100%);
    position: relative;
    overflow: hidden;
    animation: fadeUp 0.55s 0.1s ease both;
}

.forecast-section::before {
    content: '';
    position: absolute;
    top: 0; left: 10%; right: 10%;
    height: 1px;
}

.forecast-section h3 {
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 1.5rem;
    letter-spacing: 1.2px;
}

/* ── Forecast Card Grid ── */
.forecast-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
}

.fc-card {
    background: var(--bg-glass);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 16px;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: default;
}

.fc-card .fc-day {
    font-size: 1.3rem;
    font-weight: 600;
    color: rgb(118, 221, 255);
    letter-spacing: 0.8px;
}

.fc-card .fc-icon {
    font-size: 2.8rem;
    line-height: 1;
}

.fc-card .fc-temp {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.fc-card .fc-label {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 99px; }

/* ══════════════════════════════════════
   RESPONSIVE — Tablet  (≤ 900px)
══════════════════════════════════════ */
@media (max-width: 900px) {
    .container    { max-width: 680px; }
    .weather-card { padding: 40px 36px; gap: 28px; }
    .main-weather { padding: 32px 40px; }
    .temperature  { font-size: 6rem; letter-spacing: -4px; }
    .weather-icon { font-size: 6rem; }
    .sun-item,
    .detail-item  { padding: 22px 32px; max-width: 240px; }
    .forecast-section { padding: 28px 24px; }
    .forecast-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ══════════════════════════════════════
   RESPONSIVE — Mobile  (≤ 600px)
══════════════════════════════════════ */
@media (max-width: 600px) {
    body { padding: 16px 12px 40px; }

    .container { gap: 14px; }

    /* Card */
    .weather-card {
        padding: 24px 18px;
        gap: 22px;
        border-radius: 20px;
    }

    /* Title */
    h1 { font-size: 1.6rem; white-space: normal; }

    /* Search */
    .search-bar { max-width: 100%; }

    /* City / Date */
    .city-name { font-size: 1.8rem; }
    .date      { font-size: 0.8rem; }

    /* Main weather — icon on top, temp below */
    .main-weather {
        flex-direction: column-reverse;
        align-items: center;
        text-align: center;
        padding: 24px 18px;
        gap: 18px;
    }

    .temperature-block { align-items: center; }

    .temperature  { font-size: 5rem; letter-spacing: -3px; }
    .weather-icon { font-size: 5rem; }

    /* Sun & Detail tiles — full width */
    .sun-info,
    .extra-details { gap: 10px; }

    .sun-item,
    .detail-item {
        padding: 18px 12px;
        max-width: none;
        border-radius: 12px;
    }

    .sun-time,
    .detail-value { font-size: 1.1rem; }

    /* Forecast grid — 2 columns on mobile */
    .forecast-section { padding: 22px 16px 18px; border-radius: 20px; }
    .forecast-grid    { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .fc-card          { padding: 16px 8px; }
    .fc-card .fc-day  { font-size: 1.1rem; }
    .fc-card .fc-icon { font-size: 2.2rem; }
    .fc-card .fc-temp { font-size: 1.1rem; }
    .fc-card .fc-label{ font-size: 0.88rem; }
}

/* ══════════════════════════════════════
   RESPONSIVE — Small Mobile  (≤ 380px)
══════════════════════════════════════ */
@media (max-width: 380px) {
    h1            { font-size: 1.3rem; }
    .city-name    { font-size: 1.5rem; }
    .temperature  { font-size: 4.2rem; letter-spacing: -2px; }
    .weather-icon { font-size: 4.2rem; }

    .sun-item,
    .detail-item  { padding: 14px 8px; }

    .sun-time,
    .detail-value { font-size: 1rem; }

    .forecast-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}
