/* ============================================
   🌤️ Modern Weather App - Stylesheet
   ============================================
   Features:
   - Animated gradient background
   - Glassmorphism card design
   - Smooth animations & transitions
   - Fully responsive layout
   ============================================ */

/* ─── CSS Variables (Easy Theming) ─────────── */
:root {
    --primary: #6C63FF;
    --primary-dark: #5A52D5;
    --accent: #FF6B6B;
    --accent-warm: #FFA502;
    --bg-gradient-1: #0F2027;
    --bg-gradient-2: #203A43;
    --bg-gradient-3: #2C5364;
    --card-bg: rgba(255, 255, 255, 0.08);
    --card-border: rgba(255, 255, 255, 0.15);
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --detail-card-bg: rgba(255, 255, 255, 0.06);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --font-main: 'Poppins', 'Segoe UI', sans-serif;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

/* ─── Base Reset ───────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

/* ─── Body & Background ───────────────────── */
body {
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--bg-gradient-1), var(--bg-gradient-2), var(--bg-gradient-3));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    overflow-x: hidden;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ─── Floating Background Particles ────────── */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    z-index: -1;
    animation: floatBlob 20s ease-in-out infinite;
}

body::before {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    right: -100px;
}

body::after {
    width: 350px;
    height: 350px;
    background: var(--accent);
    bottom: -80px;
    left: -80px;
    animation-delay: -7s;
}

@keyframes floatBlob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ─── Main Container ──────────────────────── */
.weather-container {
    width: 100%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* ─── Glassmorphism Card ──────────────────── */
.weather-card {
    width: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 36px 28px;
    box-shadow:
        0 8px 32px var(--shadow-color),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.4s ease;
    animation: cardEntrance 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.weather-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ─── App Header ──────────────────────────── */
.app-header {
    text-align: center;
    margin-bottom: 28px;
}

.header-icon {
    font-size: 2.2rem;
    background: linear-gradient(135deg, var(--accent-warm), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    display: inline-block;
    animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.app-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.app-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 300;
    margin-top: 4px;
}

/* ─── Search Section ──────────────────────── */
.search-section {
    margin-bottom: 24px;
}

.search-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 4px 4px 4px 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2);
}

.search-icon {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-right: 10px;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-main);
    padding: 12px 0;
    min-width: 0;
}

.search-input::placeholder {
    color: var(--text-muted);
    font-weight: 300;
}

.search-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.3s ease, opacity 0.3s ease;
}

.search-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.4);
}

.search-btn:active {
    transform: scale(0.95);
}

/* ─── Shake Animation (Empty Input) ───────── */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

.shake {
    animation: shake 0.5s ease;
}

/* ─── UI States ───────────────────────────── */
.state-message {
    text-align: center;
    padding: 30px 20px;
    border-radius: var(--radius-md);
    animation: fadeIn 0.4s ease;
}

.state-message p {
    font-size: 0.95rem;
    font-weight: 400;
}

/* Initial State */
.initial-state {
    color: var(--text-muted);
}

.initial-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
    color: var(--text-muted);
    animation: bounce 2s ease-in-out infinite;
}

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

/* Loading State */
.loading-state {
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Error State */
.error-state {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.2);
    border-radius: var(--radius-md);
    color: #FF6B6B;
}

.error-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
    animation: shake 0.6s ease;
}

/* ─── Weather Info Display ────────────────── */
.weather-info {
    animation: fadeInUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Main Weather Section */
.weather-main {
    text-align: center;
    margin-bottom: 28px;
}

.weather-icon {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 4px 15px rgba(255, 255, 255, 0.15));
    animation: iconFloat 3s ease-in-out infinite;
}

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

.temperature {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin: 4px 0 8px;
    letter-spacing: -2px;
    background: linear-gradient(135deg, #FFFFFF, rgba(255, 255, 255, 0.8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.city-name {
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.weather-condition {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 300;
}

/* ─── Weather Details Grid ────────────────── */
.weather-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.detail-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--detail-card-bg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    padding: 14px;
    transition: background 0.3s ease, transform 0.3s ease;
}

.detail-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.detail-icon {
    font-size: 1.3rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
}

/* Individual icon colors */
.detail-card:nth-child(1) .detail-icon {
    background: rgba(255, 165, 2, 0.15);
    color: var(--accent-warm);
}

.detail-card:nth-child(2) .detail-icon {
    background: rgba(54, 162, 235, 0.15);
    color: #36A2EB;
}

.detail-card:nth-child(3) .detail-icon {
    background: rgba(108, 99, 255, 0.15);
    color: var(--primary);
}

.detail-card:nth-child(4) .detail-icon {
    background: rgba(75, 192, 192, 0.15);
    color: #4BC0C0;
}

.detail-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.detail-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.detail-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── Footer ──────────────────────────────── */
.app-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 300;
}

.app-footer .fa-heart {
    color: var(--accent);
    font-size: 0.7rem;
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ─── Utility Classes ─────────────────────── */
.hidden {
    display: none !important;
}

/* ─── Animations ──────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ─── Responsive Design ──────────────────── */
@media (max-width: 480px) {
    body {
        padding: 12px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .weather-card {
        padding: 28px 20px;
        border-radius: 20px;
    }

    .app-title {
        font-size: 1.5rem;
    }

    .temperature {
        font-size: 3.2rem;
    }

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

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

    .detail-card {
        padding: 10px;
        gap: 8px;
    }

    .detail-icon {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }

    .detail-value {
        font-size: 0.9rem;
    }

    .detail-label {
        font-size: 0.65rem;
    }
}
/* ─── Min/Max Temperature Badge ───────────── */
.temp-range {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50px;
    display: inline-flex;
}

.temp-high {
    color: #FF6B6B;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.temp-high i {
    font-size: 0.7rem;
}

.temp-low {
    color: #36A2EB;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.temp-low i {
    font-size: 0.7rem;
}

.temp-separator {
    color: var(--text-muted);
    font-weight: 300;
}

/* ─── Sunrise & Sunset Timeline ───────────── */
.sun-timeline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
}

.sun-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sun-rise-icon {
    font-size: 1.5rem;
    color: #FFA502;
    filter: drop-shadow(0 0 6px rgba(255, 165, 2, 0.4));
}

.sun-set-icon {
    font-size: 1.5rem;
    color: #A29BFE;
    filter: drop-shadow(0 0 6px rgba(162, 155, 254, 0.4));
}

.sun-info {
    display: flex;
    flex-direction: column;
}

.sun-time {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sun-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sun-divider {
    flex: 1;
    padding: 0 16px;
}

.sun-path {
    height: 2px;
    background: linear-gradient(90deg, #FFA502, #A29BFE);
    border-radius: 2px;
    position: relative;
}

.sun-dot {
    width: 8px;
    height: 8px;
    background: #FFFFFF;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
    animation: dotGlow 2s ease-in-out infinite;
}

@keyframes dotGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 255, 255, 0.4); }
    50% { box-shadow: 0 0 16px rgba(255, 255, 255, 0.8); }
}

/* ─── Extra Details Row ───────────────────── */
.extra-details {
    display: flex;
    justify-content: space-around;
    margin-top: 16px;
    padding: 18px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
}

.extra-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}

.extra-icon {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2px;
    transition: color 0.3s ease, transform 0.3s ease;
}

.extra-item:hover .extra-icon {
    color: var(--primary);
    transform: scale(1.15);
}

.extra-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.extra-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


@media (max-width: 340px) {
    .weather-details {
        grid-template-columns: 1fr;
    }
        .sun-timeline {
        padding: 14px;
    }

    .sun-rise-icon,
    .sun-set-icon {
        font-size: 1.2rem;
    }

    .sun-time {
        font-size: 0.9rem;
    }

    .extra-details {
        padding: 14px 6px;
    }

    .extra-value {
        font-size: 0.85rem;
    }

    .extra-label {
        font-size: 0.6rem;
    }

}
