@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --bg-start: #86a8ff;
    --bg-mid: #bfd8ff;
    --bg-end: #f7b267;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.35), transparent 34%),
        radial-gradient(circle at bottom right, rgba(255, 210, 118, 0.25), transparent 28%),
        linear-gradient(135deg, var(--bg-start) 0%, var(--bg-mid) 52%, var(--bg-end) 100%);
    background-size: 140% 140%;
    animation: skyShift 18s ease-in-out infinite alternate;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
    color: #2c3e50;
    transition: color 0.4s ease;
}

body::before,
body::after {
    content: '';
    position: fixed;
    inset: auto;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(10px);
    opacity: 0.6;
    animation: floatGlow 20s ease-in-out infinite;
}

body::before {
    width: 280px;
    height: 280px;
    top: 7%;
    left: 5%;
    background: rgba(255, 255, 255, 0.22);
}

body::after {
    width: 360px;
    height: 360px;
    right: 4%;
    bottom: 6%;
    background: rgba(255, 185, 113, 0.22);
    animation-delay: -8s;
}

body.theme-clear-day {
    --bg-start: #74a9ff;
    --bg-mid: #d8ecff;
    --bg-end: #ffd37a;
}

body.theme-clear-night {
    --bg-start: #081b3a;
    --bg-mid: #163667;
    --bg-end: #324d88;
}

body.theme-clouds {
    --bg-start: #93a4c2;
    --bg-mid: #d9e2ef;
    --bg-end: #b2c2d9;
}

body.theme-rain,
body.theme-drizzle {
    --bg-start: #426b92;
    --bg-mid: #7ea0bf;
    --bg-end: #b7cadb;
}

body.theme-thunderstorm {
    --bg-start: #1f2745;
    --bg-mid: #40527d;
    --bg-end: #7f8bb1;
}

body.theme-snow {
    --bg-start: #bbd3e8;
    --bg-mid: #eef7ff;
    --bg-end: #d6e5f2;
}

body.theme-mist,
body.theme-fog,
body.theme-haze {
    --bg-start: #9aa7b5;
    --bg-mid: #dde5eb;
    --bg-end: #c8d0d8;
}

.container {
    width: 100vw;
    max-width: 1240px;
    position: relative;
    z-index: 1;
}

.weather-app {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 28px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    animation: slideUp 0.6s ease-out;
    transition: background 0.4s ease, box-shadow 0.4s ease;
}

/* ===== HEADER SECTION ===== */
header {
    text-align: left;
    margin-bottom: 28px;
    animation: fadeIn 0.8s ease-out;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
        "title theme units"
        "search search search";
    column-gap: 14px;
    row-gap: 18px;
    align-items: center;
}
header h1 {
    grid-area: title;
}

h1 {
    font-size: 36px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.search-container {
    grid-area: search;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    margin-left: 0;
}

.theme-toggle {
    grid-area: theme;
}

.unit-toggle {
    grid-area: units;
}

.search-box {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: none;
    position: relative;
    flex-shrink: 0;
}

.search-input-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
}

#city-input {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 40px 14px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

#city-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
    background: white;
    transform: translateY(-2px);
}

#city-input::placeholder {
    color: #cbd5e0;
}

.clear-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #64748b;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background 0.2s ease;
}

.clear-btn:hover {
    color: #475569;
    background: rgba(100, 116, 139, 0.12);
}

.clear-btn:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

#search-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 14px;
    padding: 14px 20px;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

#search-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

#search-btn:active {
    transform: translateY(-1px);
}

/* Autocomplete Suggestions */
.suggestions-container {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 14px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    animation: slideDown 0.3s ease-out;
    transition: background 0.4s ease;
}

.suggestion-item {
    padding: 14px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
    font-size: 15px;
    color: #2d3748;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding-left: 24px;
}

.suggestion-item:first-child {
    border-radius: 14px 14px 0 0;
}

.suggestion-item:last-child {
    border-radius: 0 0 14px 14px;
}

/* ===== MAIN WEATHER SECTION ===== */
#weather-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
    animation: fadeIn 0.8s ease-out 0.2s both;
}

/* Left Column */
.weather-main {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 18px;
    height: 100%;
}

.location-info {
    animation: slideInLeft 0.6s ease-out;
    order: 0;
    width: 100%;
    text-align: left;
}

#city-name {
    font-size: 26px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 3px;
    letter-spacing: -0.5px;
    transition: color 0.4s ease;
}

#date {
    font-size: 13px;
    color: #718096;
    font-weight: 500;
    transition: color 0.4s ease;
}


/* Temperature Section */
.temperature-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 28px 26px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 24px;
    animation: slideInLeft 0.6s ease-out 0.2s both;
    border: 1px solid rgba(226, 232, 240, 0.5);
    order: 1;
    position: relative;
    transition: background 0.4s ease, border-color 0.4s ease;
}

.weather-icon {
    width: 100px;
    height: 100px;
    animation: bounce 2s ease-in-out infinite;
}

.weather-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.1));
}

.temperature {
    display: flex;
    align-items: flex-start;
    gap: 5px;
}

#temp {
    font-size: 64px;
    font-weight: 300;
    line-height: 1;
    color: #2d3748;
    letter-spacing: -2px;
    transition: color 0.4s ease;
}

.unit {
    font-size: 24px;
    font-weight: 400;
    color: #718096;
    margin-top: 8px;
    transition: color 0.4s ease;
}

#weather-desc {
    font-size: 16px;
    color: #718096;
    text-transform: capitalize;
    font-weight: 500;
    transition: color 0.4s ease;
}

.sun-panel {
    margin-bottom: 0;
    order: 2;
}

/* ===== RIGHT- WEATHER DETAILS SECTION ===== */
/* Sun Position Card */
.sun-position-card {
    background: linear-gradient(135deg, #fff7dd 0%, #fff2c5 100%);
    border: 2px solid rgba(217, 119, 6, 0.2);
    border-radius: 20px;
    padding: 18px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(217, 119, 6, 0.1);
    animation: slideInLeft 0.6s ease-out 0.1s both;
    grid-column: 1 / -1;
}

.sun-position-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(217, 119, 6, 0.15);
}

.sun-position-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.sun-position-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: #7c4a03;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#sun-phase {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #b45309;
    background: rgba(180, 83, 9, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
}

.sun-track {
    position: relative;
    height: 50px;
    margin-bottom: 15px;
}

.sun-track-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #f59e0b 0%, #facc15 50%, #f97316 100%);
    opacity: 0.4;
}

.sun-track-marker {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 30%, #fff9c4 0%, #fbbf24 55%, #f59e0b 100%);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4), inset -2px -2px 5px rgba(0, 0, 0, 0.1);
    animation: float 3s ease-in-out infinite;
}

.sun-icon {
    font-size: 20px;
    line-height: 1;
}

.sun-position-meta {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    font-size: 12px;
    color: #8a5a13;
    font-weight: 500;
}

.weather-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 0;
    animation: slideInLeft 0.6s ease-out 0.3s both;
}

.detail-card {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 16px;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    border: 1px solid rgba(226, 232, 240, 0.5);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.detail-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(102, 126, 234, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.detail-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.detail-card:hover::before {
    opacity: 1;
}

.detail-icon {
    color: #667eea;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.detail-label {
    font-size: 11px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    transition: color 0.4s ease;
}

.detail-value {
    font-size: 16px;
    font-weight: 700;
    color: #2d3748;
    transition: color 0.4s ease;
}

/* ===== LEFT COLUMN - FORECAST SECTION ===== */
.forecast-section {
    animation: slideInRight 0.6s ease-out 0.2s both;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.forecast-title {
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
    letter-spacing: -0.5px;
    transition: color 0.4s ease;
}

.forecast-subtitle {
    font-size: 13px;
    line-height: 1.6;
    color: #718096;
    transition: color 0.4s ease;
}

.forecast-graph-card {
    background: linear-gradient(180deg, #eef4ff 0%, #f8fbff 100%);
    border: 2px solid rgba(102, 126, 234, 0.15);
    border-radius: 20px;
    padding: 22px;
    transition: all 0.3s ease;
}

.forecast-graph-card:hover {
    border-color: #667eea;
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.1);
}

.graph-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #667eea;
}

.graph-wrapper {
    width: 100%;
    height: 240px;
}

#forecast-graph {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.graph-grid-line {
    stroke: rgba(102, 126, 234, 0.15);
    stroke-width: 1;
    stroke-dasharray: 5 5;
}

.graph-area {
    fill: rgba(102, 126, 234, 0.12);
    animation: fillArea 0.8s ease-out forwards;
}

.graph-line {
    fill: none;
    stroke: #667eea;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    animation: drawLine 1s ease-out forwards;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.graph-point {
    fill: #ffffff;
    stroke: #667eea;
    stroke-width: 3;
    animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
}

.graph-point-label {
    fill: #2d3748;
    font-size: 12px;
    font-weight: 700;
}

.graph-axis-label {
    fill: #718096;
    font-size: 11px;
    font-weight: 600;
}

.forecast-container {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

.forecast-card {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 16px;
    padding: 18px 14px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(226, 232, 240, 0.5);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.forecast-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(102, 126, 234, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.forecast-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.forecast-card:hover::before {
    opacity: 1;
}

.forecast-day {
    font-size: 13px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.forecast-icon {
    width: 45px;
    height: 45px;
    margin: 0 auto 10px;
    transition: transform 0.3s ease;
}

.forecast-card:hover .forecast-icon {
    transform: scale(1.1) rotate(5deg);
}

.forecast-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.forecast-temp {
    font-size: 16px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 4px;
    transition: color 0.4s ease;
}

.forecast-desc {
    font-size: 12px;
    color: #718096;
    text-transform: capitalize;
    transition: color 0.4s ease;
}

/* ===== WEATHER TRENDS SECTION ===== */
.weather-trends-section {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: slideUp 0.6s ease-out 0.25s both;
}

.trends-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
}

.trend-controls {
    display: inline-flex;
    gap: 6px;
    padding: 5px;
    background: #edf2f7;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 14px;
    flex-shrink: 0;
}

.trend-toggle {
    border: none;
    border-radius: 10px;
    padding: 9px 14px;
    background: transparent;
    color: #718096;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s ease;
}

.trend-toggle:hover {
    color: #4c51bf;
    background: rgba(255, 255, 255, 0.72);
}

.trend-toggle.active {
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.25);
}

.trends-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
    gap: 18px;
    align-items: stretch;
}

.trend-chart-card {
    background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
    border: 2px solid rgba(102, 126, 234, 0.15);
    border-radius: 20px;
    padding: 22px;
    transition: all 0.3s ease;
}

.trend-chart-card:hover {
    border-color: #667eea;
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.1);
}

.trend-chart-wrapper {
    height: 280px;
    width: 100%;
}

#trend-chart {
    --trend-color: #667eea;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.trend-bar {
    fill: rgba(102, 126, 234, 0.18);
    fill: color-mix(in srgb, var(--trend-color) 22%, white);
    stroke: rgba(102, 126, 234, 0.45);
    stroke: color-mix(in srgb, var(--trend-color) 60%, white);
    stroke-width: 1;
    transition: all 0.25s ease;
}

.trend-bar-group:hover .trend-bar {
    fill: rgba(102, 126, 234, 0.28);
    fill: color-mix(in srgb, var(--trend-color) 34%, white);
}

.trend-range-line {
    stroke: rgba(45, 55, 72, 0.22);
    stroke-width: 3;
    stroke-linecap: round;
}

.trend-high-dot {
    fill: #f97316;
    stroke: white;
    stroke-width: 2;
    opacity: 0.9;
}

.trend-low-dot {
    fill: #0ea5e9;
    stroke: white;
    stroke-width: 2;
    opacity: 0.9;
}

.trend-line {
    fill: none;
    stroke: var(--trend-color);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    animation: drawLine 1s ease-out forwards;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.trend-line-point {
    fill: white;
    stroke: var(--trend-color);
    stroke-width: 3;
    animation: popIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.trend-value-label {
    paint-order: stroke;
    stroke: #f8fbff;
    stroke-width: 5px;
    stroke-linejoin: round;
}

.trend-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.trend-stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border: 1px solid rgba(226, 232, 240, 0.72);
    transition: all 0.25s ease;
}

.trend-stat-card:hover {
    transform: translateY(-3px);
    border-color: #667eea;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
}

.trend-stat-date {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 58px;
}

.trend-stat-date span {
    color: #667eea;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.trend-stat-date small {
    color: #718096;
    font-size: 12px;
    font-weight: 600;
}

.trend-stat-values {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 12px;
    font-size: 12px;
    color: #718096;
}

.trend-stat-values strong {
    color: #2d3748;
}

/* ===== ANIMATIONS ===== */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}

@keyframes float {
    0%, 100% { transform: translate(-50%, -50%) translateY(0); }
    50%       { transform: translate(-50%, -50%) translateY(-8px); }
}

@keyframes popIn {
    0%   { opacity: 0; transform: scale(0); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}

@keyframes fillArea {
    to { opacity: 1; }
}

@keyframes skyShift {
    0%   { background-position: 0% 35%; }
    100% { background-position: 100% 65%; }
}

@keyframes floatGlow {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    50%  { transform: translate3d(18px, -14px, 0) scale(1.06); }
    100% { transform: translate3d(-10px, 12px, 0) scale(0.96); }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 60px 40px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: #718096;
    font-size: 16px;
    font-weight: 500;
}

/* Error State */
.error {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, #fed7d7 0%, #fecaca 100%);
    border: 2px solid #fc8181;
    border-radius: 14px;
    margin-top: 20px;
    animation: slideUp 0.4s ease-out;
}

.error p {
    color: #c53030;
    font-size: 15px;
    font-weight: 500;
}

/* Hidden State */
.hidden {
    display: none !important;
}

/* ===== RESPONSIVE DESIGN ===== */
@media screen and (max-width: 1024px) {
    .weather-app {
        padding: 28px;
    }

    #weather-container {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .forecast-section {
        margin-top: 0;
    }

    .forecast-container {
        grid-template-columns: repeat(5, 1fr);
    }

    .trends-layout {
        grid-template-columns: 1fr;
    }

    .trend-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .weather-app {
        padding: 22px;
    }

    h1 {
        font-size: 28px;
    }

    .search-container {
        max-width: 100%;
    }

    .search-box {
        max-width: 100%;
    }

    header {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "theme"
            "units"
            "search";
        align-items: stretch;
    }

    .theme-toggle,
    .unit-toggle {
        width: fit-content;
    }

    #city-name {
        font-size: 26px;
    }

    #temp {
        font-size: 52px;
    }

    .weather-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .detail-card {
        padding: 15px;
    }

    .forecast-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .forecast-card {
        padding: 14px 12px;
    }

    .graph-wrapper {
        height: 180px;
    }

    .trends-header {
        flex-direction: column;
        align-items: stretch;
    }

    .trend-controls {
        align-self: flex-start;
    }

    .trend-chart-wrapper {
        height: 220px;
    }
}

@media screen and (max-width: 600px) {
    .weather-app {
        padding: 18px;
        border-radius: 20px;
        max-height: calc(100vh - 20px);
    }

    header {
        margin-bottom: 18px;
    }

    h1 {
        font-size: 24px;
        line-height: 1.1;
    }

    .search-box {
        flex-direction: column;
        gap: 10px;
    }

    .search-input-wrap {
        width: 100%;
    }

    #city-input,
    #search-btn {
        width: 100%;
        padding: 12px;
        font-size: 15px;
    }

    #city-input {
        padding-right: 40px;
    }

    #weather-container {
        gap: 18px;
    }

    .weather-main {
        gap: 16px;
    }

    #city-name {
        font-size: 22px;
    }

    #temp {
        font-size: 48px;
    }

    .weather-icon {
        width: 80px;
        height: 80px;
    }

    .temperature-section {
        padding: 22px 18px;
    }

    .weather-details {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .detail-card {
        padding: 12px;
    }

    .detail-label {
        font-size: 10px;
    }

    .detail-value {
        font-size: 14px;
    }

    .forecast-title {
        font-size: 20px;
    }

    .forecast-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .forecast-card {
        padding: 12px;
    }

    .graph-wrapper {
        height: 150px;
    }

    .trend-stats {
        grid-template-columns: 1fr;
    }

    .trend-stat-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .trend-stat-values {
        justify-content: flex-start;
    }

    .trend-chart-wrapper {
        height: 190px;
    }

    .sun-position-card {
        padding: 16px;
    }

    .sun-track {
        height: 40px;
    }

    .sun-position-meta {
        flex-direction: column;
        gap: 8px;
    }
}

@media screen and (max-width: 450px) {
    .container {
        max-width: 100%;
    }

    .weather-app {
        padding: 16px;
        border-radius: 18px;
    }

    .search-container {
        margin-left: 0;
    }

    h1 {
        font-size: 22px;
    }

    #city-name {
        font-size: 20px;
    }

    #temp {
        font-size: 44px;
    }

    .weather-details {
        grid-template-columns: 1fr;
    }

    .forecast-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .weather-main {
        gap: 15px;
    }

    .forecast-title {
        font-size: 18px;
    }

    .trend-controls {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        width: 100%;
    }

    .trend-toggle {
        padding: 9px 8px;
    }

    .detail-card {
        flex-direction: row;
        align-items: center;
    }

    .detail-info {
        align-items: flex-start;
        text-align: left;
    }
}

/* Unit Toggle */
.unit-toggle {
    display: flex;
    border: 1.5px solid rgba(102, 126, 234, 0.3);
    border-radius: 50px;
    overflow: hidden;
    flex-shrink: 0;
}

.unit-btn {
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: #718096;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.unit-btn:not(:last-child) {
    border-right: 1.5px solid rgba(102, 126, 234, 0.2);
}

.unit-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.unit-btn:not(.active):hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

body.dark-mode .unit-toggle {
    border-color: rgba(100, 116, 139, 0.4);
}

body.dark-mode .unit-btn {
    color: #94a3b8;
}

body.dark-mode .unit-btn:not(:last-child) {
    border-right-color: rgba(100, 116, 139, 0.3);
}

body.dark-mode .unit-btn:not(.active):hover {
    background: rgba(102, 126, 234, 0.15);
    color: #a5b4fc;
}

@media screen and (max-width: 600px) {
    .unit-btn {
        padding: 8px 10px;
        font-size: 12px;
    }
}

#uv-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}


/* ============================================================
   ✅ ADDED: Dark Mode — Issue #14
   ============================================================ */

/* -- Toggle Button -- */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1.5px solid rgba(102, 126, 234, 0.3);
    border-radius: 50px;
    background: rgba(102, 126, 234, 0.08);
    color: #2d3748;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.3s ease, border-color 0.3s ease,
                color 0.3s ease, transform 0.15s ease, box-shadow 0.3s ease;
    user-select: none;
}

.theme-toggle:hover {
    background: rgba(102, 126, 234, 0.15);
    border-color: #667eea;
    transform: translateY(-1px);
}

.theme-toggle:active {
    transform: translateY(0);
}

.toggle-icon {
    font-style: normal;
    font-size: 16px;
    transition: transform 0.4s ease;
    line-height: 1;
}

body.dark-mode .toggle-icon {
    transform: rotate(20deg);
}

body.dark-mode .theme-toggle {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

body.dark-mode .theme-toggle:hover {
    background: rgba(251, 191, 36, 0.15);
    border-color: #fbbf24;
}

/* Responsive: icon-only on small screens */
@media screen and (max-width: 600px) {
    .toggle-label {
        display: none;
    }

    .theme-toggle {
        padding: 8px 10px;
    }
}

/* -- Dark theme overrides -- */
body.dark-mode {
    color: #e2e8f0;
}

body.dark-mode .weather-app {
    background: rgba(15, 23, 42, 0.92);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

body.dark-mode #city-input {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(100, 116, 139, 0.4);
    color: #e2e8f0;
}

body.dark-mode #city-input::placeholder {
    color: #64748b;
}

body.dark-mode #city-input:focus {
    background: rgba(30, 41, 59, 1);
    border-color: #667eea;
}

body.dark-mode .clear-btn {
    color: #94a3b8;
}

body.dark-mode .clear-btn:hover {
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.15);
}

body.dark-mode .suggestions-container {
    background: #1e293b;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
}

body.dark-mode .suggestion-item {
    color: #cbd5e0;
    border-bottom-color: rgba(100, 116, 139, 0.2);
}

body.dark-mode .suggestion-item:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

body.dark-mode .temperature-section {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: rgba(100, 116, 139, 0.2);
}

body.dark-mode #city-name,
body.dark-mode #temp,
body.dark-mode .forecast-title {
    color: #f1f5f9;
}

body.dark-mode #date,
body.dark-mode #weather-desc,
body.dark-mode .unit,
body.dark-mode .forecast-subtitle,
body.dark-mode .detail-label {
    color: #94a3b8;
}

body.dark-mode .detail-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: rgba(100, 116, 139, 0.2);
}

body.dark-mode .detail-card:hover {
    border-color: #667eea;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
}

body.dark-mode .detail-value {
    color: #f1f5f9;
}

body.dark-mode .forecast-graph-card {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-color: rgba(102, 126, 234, 0.2);
}

body.dark-mode .forecast-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: rgba(100, 116, 139, 0.2);
}

body.dark-mode .forecast-card:hover {
    border-color: #667eea;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
}

body.dark-mode .forecast-temp {
    color: #f1f5f9;
}

body.dark-mode .forecast-desc {
    color: #94a3b8;
}

body.dark-mode .graph-point-label {
    fill: #f1f5f9;
}

body.dark-mode .graph-axis-label {
    fill: #94a3b8;
}

body.dark-mode .graph-point {
    fill: #1e293b;
}

body.dark-mode .sun-position-card {
    background: linear-gradient(135deg, #2a1f0a 0%, #1f1506 100%);
    border-color: rgba(217, 119, 6, 0.3);
}

body.dark-mode .sun-position-header h3 {
    color: #fbbf24;
}

body.dark-mode #sun-phase {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
}

body.dark-mode .sun-position-meta {
    color: #d97706;
}

body.dark-mode .theme-toggle {
    background: rgba(15, 23, 42, 0.7);
    border-color: rgba(100, 116, 139, 0.4);
    color: #fbbf24;
}

body.dark-mode .theme-toggle:hover {
    background: rgba(30, 41, 59, 0.9);
}

body.dark-mode .spinner {
    border-color: rgba(100, 116, 139, 0.3);
    border-top-color: #667eea;
}

body.dark-mode .loading p {
    color: #94a3b8;
}

/* Responsive: shrink toggle on small screens */
@media screen and (max-width: 600px) {
    .theme-toggle {
        top: 0.65rem;
        right: 0.65rem;
        padding: 6px 12px;
        font-size: 13px;
    }

    .toggle-label {
        display: none; /* icon-only on mobile */
    }
}

/* Utility classes for error messages */
.text-red-500 {
    color: #ef4444 !important;
}

.text-sm {
    font-size: 0.875rem !important;
}

.mt-2 {
    margin-top: 0.5rem !important;
    margin-left: 0.5rem !important;
}

/* Disabled Search Button */
#search-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background: #cbd5e0;
}

.loading {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255,255,255,0.2);
    border-top: 5px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.feels-like-main {
    font-size: 14px;
    color: #94a3b8;
    font-weight: 500;
    transition: color 0.4s ease;
}

body.dark-mode .feels-like-main {
    color: #94a3b8;
}

