/* ==================== CSS VARIABLES ==================== */
:root {
    --glass-bg: rgba(0, 0, 0, 0.25);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-hover: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.85);
    --text-muted: rgba(255, 255, 255, 0.6);
    --accent-gold: #f4c430;
    --accent-blue: #60a5fa;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* ==================== DYNAMIC BACKGROUND ==================== */
.bg-image {
    position: fixed;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -2;
    transition: opacity 0.8s ease-in-out;
}

.bg-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.35) 30%,
        rgba(0, 0, 0, 0.55) 60%,
        rgba(0, 0, 0, 0.8) 100%
    );
    z-index: -1;
}

/* ==================== UTILITY ==================== */
.hidden {
    display: none !important;
}

/* ==================== SPLASH SCREEN ==================== */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.splash-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 30%, #2d1b4e 60%, #1a1a3e 100%);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    z-index: -1;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.splash-content {
    text-align: center;
    animation: float 3s ease-in-out infinite;
    padding: 0 20px;
    max-width: 400px;
    width: 100%;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.splash-icon-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 24px;
}

.splash-icon-wrap::before {
    content: '';
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle, rgba(244,196,48,0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 1; }
}

.splash-icon-img {
    width: 130px;
    height: 130px;
    filter: drop-shadow(0 10px 30px rgba(0,0,0,0.4));
    position: relative;
    z-index: 1;
}

.splash-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
    margin-bottom: 10px;
    text-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.splash-subtitle {
    font-size: 1.05rem;
    font-weight: 400;
    color: rgba(255,255,255,0.5);
    margin-bottom: 45px;
    letter-spacing: 0.5px;
}

.get-start-btn {
    background: var(--accent-gold);
    color: #1a1a2e;
    border: none;
    padding: 16px 36px;
    font-size: 1.05rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 25px rgba(244, 196, 48, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.get-start-btn i {
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.get-start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 35px rgba(244, 196, 48, 0.5);
}

.get-start-btn:hover i {
    transform: translateX(4px);
}

.get-start-btn:active {
    transform: translateY(-1px);
}

.splash-footer {
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    text-align: center;
}

.copyright {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.3);
    font-weight: 400;
    letter-spacing: 0.3px;
}

/* ==================== MAIN APP ==================== */
.main-app {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
}

/* ==================== SEARCH OVERLAY ==================== */
.search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 30, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 500;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
    animation: fadeIn 0.3s ease;
}

.search-box {
    background: rgba(25, 25, 45, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    padding: 32px;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    position: relative;
    animation: slideUp 0.4s ease;
}

.close-search {
    position: absolute;
    top: 22px;
    right: 24px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-search:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.12);
}

.search-box h3 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    padding: 5px 5px 5px 18px;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

.search-input-wrapper:focus-within {
    border-color: var(--accent-gold);
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 0 0 4px rgba(244, 196, 48, 0.1);
}

.search-input-wrapper i {
    color: rgba(255, 255, 255, 0.4);
    margin-right: 12px;
    font-size: 1rem;
}

.search-input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    outline: none;
    padding: 14px 0;
}

.search-input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.search-input-wrapper button {
    background: var(--accent-gold);
    border: none;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    color: #1a1a2e;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.search-input-wrapper button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(244, 196, 48, 0.3);
}

.search-input-wrapper button:active {
    transform: scale(0.95);
}

.search-error {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 14px 18px;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: 14px;
    color: #f87171;
    font-size: 0.9rem;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    color: var(--text-muted);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.recent-searches {
    margin-top: 28px;
}

.recent-searches h4 {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 14px;
    font-weight: 600;
}

.recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.recent-tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 10px 20px;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

.recent-tag:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* ==================== LOADING & ERROR SCREENS ==================== */
.loading-screen, .error-screen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 400;
}

.loading-content, .error-content {
    text-align: center;
    padding: 0 20px;
}

.loading-weather-icon, .error-weather-icon {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
    filter: drop-shadow(0 10px 30px rgba(0,0,0,0.3));
}

.loading-content p {
    color: var(--text-muted);
    font-size: 1rem;
}

.error-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.error-content p {
    color: var(--text-muted);
    margin-bottom: 25px;
}

.retry-btn {
    background: var(--accent-gold);
    color: #1a1a2e;
    border: none;
    padding: 14px 40px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(244, 196, 48, 0.3);
}

/* ==================== WEATHER CONTENT ==================== */
.weather-content {
    position: relative;
    z-index: 1;
    height: 100vh;
    display: grid;
    grid-template-columns: 1fr 280px;
    grid-template-rows: auto 1fr auto auto auto;
    grid-template-areas:
        "topbar topbar"
        "maininfo sidedetails"
        "feelslike feelslike"
        "hourly hourly"
        "footer footer";
    padding: 30px 40px 15px;
    gap: 0;
    overflow-y: auto;
    scrollbar-width: none;
}

.weather-content::-webkit-scrollbar {
    display: none;
}

/* ==================== TOP BAR ==================== */
.top-bar {
    grid-area: topbar;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    width: 44px;
    height: 44px;
    border-radius: 14px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

#current-day-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-shadow: 0 2px 12px rgba(0,0,0,0.7), 0 1px 3px rgba(0,0,0,0.5);
    letter-spacing: 0.5px;
}

/* ==================== MAIN INFO (LEFT) ==================== */
.main-info {
    grid-area: maininfo;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 20px;
}

.weather-condition {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.weather-condition img {
    width: 50px;
    height: 50px;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
}

#condition-text {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text-primary);
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.location-name {
    margin-bottom: 15px;
}

#city-name {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.main-temp {
    display: flex;
    align-items: flex-start;
    line-height: 1;
    margin-bottom: 15px;
}

#current-temp {
    font-size: 5.5rem;
    font-weight: 700;
    letter-spacing: -3px;
    text-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.degree {
    font-size: 2rem;
    font-weight: 300;
    margin-top: 8px;
    color: var(--text-secondary);
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.change-location-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    padding: 10px 18px;
    border-radius: 24px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    backdrop-filter: blur(10px);
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.change-location-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* ==================== SIDE DETAILS (RIGHT) ==================== */
.side-details {
    grid-area: sidedetails;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 22px;
    padding-left: 20px;
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.detail-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.detail-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ==================== FEELS LIKE ==================== */
.feels-like {
    grid-area: feelslike;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* ==================== HOURLY FORECAST BAR ==================== */
.hourly-bar {
    grid-area: hourly;
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 12px 8px;
    margin-top: auto;
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.hourly-scroll {
    display: flex;
    gap: 0;
    overflow-x: auto;
    flex: 1;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 4px;
}

.hourly-scroll::-webkit-scrollbar {
    display: none;
}

.hourly-item {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 72px;
    padding: 10px 12px;
    scroll-snap-align: start;
    transition: var(--transition);
    cursor: pointer;
    border-radius: 14px;
}

.hourly-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.hourly-item.active {
    background: rgba(255, 255, 255, 0.12);
}

.hourly-item .hour-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.hourly-item .hour-temp {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.hourly-item .hour-temp .degree-small {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* ==================== FOOTER ==================== */
.app-footer {
    grid-area: footer;
    text-align: center;
    padding: 12px 0 5px;
}

.app-footer p {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 400;
    letter-spacing: 0.3px;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.weather-update {
    animation: fadeIn 0.6s ease;
}

/* ==================== TABLET RESPONSIVE (768px - 1024px) ==================== */
@media (max-width: 1024px) {
    .weather-content {
        padding: 25px 30px 15px;
    }

    .side-details {
        padding-left: 15px;
        gap: 18px;
    }

    #current-temp {
        font-size: 4.5rem;
    }
}

/* ==================== MOBILE RESPONSIVE (< 768px) ==================== */
@media (max-width: 768px) {
    .splash-title {
        font-size: 2.4rem;
    }

    .splash-subtitle {
        font-size: 0.95rem;
    }

    .splash-icon-img {
        width: 110px;
        height: 110px;
    }

    .get-start-btn {
        padding: 14px 32px;
        font-size: 1rem;
    }

    .weather-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto 1fr auto auto;
        grid-template-areas:
            "topbar"
            "maininfo"
            "feelslike"
            "sidedetails"
            "hourly"
            "footer";
        padding: 20px 20px 10px;
        overflow-y: auto;
    }

    .main-info {
        padding-bottom: 10px;
        align-items: flex-start;
    }

    .side-details {
        flex-direction: row;
        flex-wrap: wrap;
        padding-left: 0;
        gap: 12px;
        margin: 15px 0;
        justify-content: flex-start;
    }

    .detail-row {
        flex: 1;
        min-width: 140px;
        max-width: 48%;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 16px;
        padding: 14px 16px;
        border: 1px solid rgba(255, 255, 255, 0.06);
    }

    .detail-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .detail-value {
        font-size: 1rem;
    }

    #current-temp {
        font-size: 4rem;
    }

    .degree {
        font-size: 1.6rem;
    }

    .hourly-bar {
        padding: 10px 6px;
        border-radius: 16px;
    }

    .hourly-item {
        min-width: 65px;
        padding: 8px 10px;
    }

    .hourly-item .hour-temp {
        font-size: 1.1rem;
    }

    .search-box {
        padding: 24px;
        border-radius: 24px;
    }

    .search-overlay {
        padding-top: 60px;
    }
}

/* ==================== SMALL MOBILE (< 480px) ==================== */
@media (max-width: 480px) {
    .splash-title {
        font-size: 2rem;
    }

    .splash-subtitle {
        font-size: 0.9rem;
        margin-bottom: 35px;
    }

    .splash-icon-img {
        width: 100px;
        height: 100px;
    }

    .get-start-btn {
        padding: 14px 28px;
        font-size: 0.95rem;
    }

    .copyright {
        font-size: 0.7rem;
    }

    .weather-content {
        padding: 15px 15px 8px;
    }

    .top-bar {
        margin-bottom: 15px;
    }

    .icon-btn {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    #current-day-name {
        font-size: 0.9rem;
    }

    .weather-condition img {
        width: 42px;
        height: 42px;
    }

    #condition-text {
        font-size: 1.2rem;
    }

    #city-name {
        font-size: 0.9rem;
    }

    #current-temp {
        font-size: 3.2rem;
        letter-spacing: -2px;
    }

    .degree {
        font-size: 1.4rem;
        margin-top: 5px;
    }

    .change-location-btn {
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    .side-details {
        gap: 8px;
        margin: 10px 0;
    }

    .detail-row {
        min-width: 100px;
        padding: 12px 14px;
        border-radius: 14px;
    }

    .detail-icon {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .detail-label {
        font-size: 0.72rem;
    }

    .detail-value {
        font-size: 0.95rem;
    }

    .feels-like {
        font-size: 0.82rem;
    }

    .hourly-bar {
        border-radius: 14px;
        padding: 8px 4px;
    }

    .hourly-item {
        min-width: 58px;
        padding: 6px 8px;
        border-radius: 12px;
    }

    .hourly-item .hour-time {
        font-size: 0.65rem;
    }

    .hourly-item .hour-temp {
        font-size: 1rem;
    }

    .app-footer p {
        font-size: 0.68rem;
    }

    .search-box {
        padding: 20px;
        border-radius: 22px;
        width: 92%;
    }

    .search-box h3 {
        font-size: 1.25rem;
        margin-bottom: 18px;
    }

    .search-input-wrapper {
        padding: 4px 4px 4px 14px;
    }

    .search-input-wrapper input {
        font-size: 0.95rem;
        padding: 12px 0;
    }

    .search-input-wrapper button {
        width: 42px;
        height: 42px;
        border-radius: 12px;
    }

    .recent-tag {
        padding: 8px 16px;
        font-size: 0.88rem;
    }
}

/* ==================== LANDSCAPE MOBILE ==================== */
@media (max-height: 500px) and (orientation: landscape) {
    .splash-content {
        animation: none;
        transform: scale(0.85);
    }

    .splash-footer {
        position: relative;
        margin-top: 20px;
    }

    .weather-content {
        grid-template-columns: 1fr 200px;
        grid-template-rows: auto 1fr auto auto auto;
        grid-template-areas:
            "topbar topbar"
            "maininfo sidedetails"
            "feelslike feelslike"
            "hourly hourly"
            "footer footer";
        padding: 15px 25px 10px;
    }

    .main-info {
        padding-bottom: 10px;
    }

    #current-temp {
        font-size: 3.5rem;
    }

    .side-details {
        gap: 12px;
        padding-left: 15px;
    }

    .detail-row {
        padding: 8px 12px;
    }

    .hourly-bar {
        padding: 8px;
    }
}

/* ==================== LARGE SCREENS (> 1400px) ==================== */
@media (min-width: 1400px) {
    .weather-content {
        max-width: 1400px;
        margin: 0 auto;
        padding: 40px 60px 20px;
    }

    #current-temp {
        font-size: 6.5rem;
    }

    .side-details {
        gap: 28px;
        padding-left: 40px;
    }

    .detail-value {
        font-size: 1.2rem;
    }
}