:root {
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --matte-bg: rgba(20, 20, 35, 0.85);
    /* Deep solid matte */
    --matte-border: rgba(255, 255, 255, 0.08);
    --matte-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    --font-head: 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Poppins', sans-serif;
    --accent-color: #ff9a9e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background: #0f0f1a;
    /* Darker base */
}

/* Background Mesh - Kept but made more subtle for 'Fresh' look */
.background-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, #1a1a2e 0%, #000000 100%);
    transition: background 1s ease;
}

.background-mesh::before,
.background-mesh::after {
    content: '';
    position: absolute;
    width: 70vw;
    height: 70vw;
    border-radius: 50%;
    filter: blur(100px);
    /* Softer blur */
    opacity: 0.4;
    /* Reduced intensity */
    animation: drift 25s infinite alternate;
}

.background-mesh::before {
    background: #4facfe;
    top: -20%;
    left: -20%;
}

.background-mesh::after {
    background: #00f2fe;
    bottom: -20%;
    right: -20%;
    animation-delay: -5s;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(30px, 20px) rotate(5deg);
    }
}

/* Specific Weather Themes for Background */
body.theme-sunny .background-mesh {
    background: linear-gradient(135deg, #FF9A9E 0%, #FECFEF 100%);
    opacity: 0.8;
}

body.theme-sunny .background-mesh::before {
    background: #fee140;
    opacity: 0.6;
}

body.theme-sunny .background-mesh::after {
    background: #fa709a;
    opacity: 0.6;
}

body.theme-cloudy .background-mesh {
    background: linear-gradient(to right, #243949 0%, #517fa4 100%);
}

body.theme-rainy .background-mesh {
    background: linear-gradient(to top, #209cff 0%, #68e0cf 100%);
    opacity: 0.2;
}

/* Darker rain feel */

/* Layout */
.main-wrapper {
    display: flex;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    gap: 30px;
}

/* Sidebar */
.sidebar {
    width: 350px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 30px;
    height: calc(100vh - 40px);
    position: sticky;
    top: 20px;
    border-radius: 30px;
    /* Independent background for sidebar if needed, but glass-panel class handles it */
}

/* REPLACED GLASS PANEL WITH MATTE STYLE */
.glass-panel {
    background: var(--matte-bg);
    /* No backdrop-filter blur for pure matte, but a tiny bit helps blend if opacity < 1 */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--matte-border);
    box-shadow: var(--matte-shadow);
    border-radius: 24px;
    /* Slightly rounder */
}

/* Header / Search */
header {
    margin-bottom: 20px;
}

.logo {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.6rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.5px;
    color: #fff;
}

.search-box {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    /* Darker input bg */
    border-radius: 14px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s;
}

.search-box:focus-within {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

#city-search {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 10px 12px;
    outline: none;
    font-family: var(--font-body);
    font-weight: 500;
}

#city-search::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#search-btn,
#location-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: white;
    width: 44px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    margin-left: 5px;
    /* Spacing between buttons */
}

#search-btn:hover,
#location-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Hero Weather */
.current-weather-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 15px;
}

.hero-icon {
    font-size: 9rem;
    /* Soft glow instead of hard shadow */
    filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.15));
    margin-bottom: 10px;
}

.hero-temp h1 {
    font-family: var(--font-head);
    font-size: 6.5rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -3px;
    background: linear-gradient(to bottom, #fff, #ccc);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#weather-desc {
    font-size: 1.3rem;
    text-transform: capitalize;
    color: var(--text-secondary);
    font-weight: 500;
}

.location-badge {
    margin-top: 25px;
    background: rgba(255, 255, 255, 0.05);
    /* Very subtle */
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.meta-info {
    margin-top: auto;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
}

/* Main Content Area */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
    /* Ensure content is scrollable and visible */
    overflow-y: auto;
    /* Show scrollbar subtly so users know they can scroll */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    max-height: calc(100vh - 40px);
    /* Constrain height to viewport to match sidebar */
    padding-right: 10px;
    /* Space for scrollbar */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    /* Mobile smooth scroll */
}

/* Background Mesh - Fix for "black shade" below screen */
.background-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    /* changed to 100vh to ensure full viewport coverage */
    z-index: -1;
    /* Ensure fallback background matches theme to avoid jarring black bars */
    background: radial-gradient(circle at 50% 50%, #1a1a2e 0%, #000000 100%);
    transition: background 1s ease;
    /* Prevent overscroll showing background on mobile */
    overscroll-behavior: none;
}

.section-title h2 {
    font-family: var(--font-head);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 5px;
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.detail-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 170px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s, background 0.3s, box-shadow 0.3s;
    background: rgba(30, 30, 45, 0.6);
    /* Slightly lighter than sidebar */
}

.detail-card:hover {
    transform: translateY(-5px);
    background: rgba(40, 40, 60, 0.8);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.4);
}

.detail-head {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.detail-value {
    font-family: var(--font-head);
    font-size: 2.2rem;
    font-weight: 600;
    margin-top: auto;
}

.detail-value small {
    font-size: 1.1rem;
    font-weight: 400;
    opacity: 0.6;
}

.detail-icon {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 1.8rem;
    opacity: 0.2;
    /* More subtle icon */
    transition: opacity 0.3s;
}

.detail-card:hover .detail-icon {
    opacity: 0.8;
}

/* Forecast Split */
.forecast-split {
    display: flex;
    flex-direction: column;
    /* Stack vertically on PC as requested */
    gap: 30px;
    min-height: auto;
    /* Let content dictate height */
}

.forecast-col {
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.forecast-col h3 {
    margin-bottom: 25px;
    font-family: var(--font-head);
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 600;
}

/* Hourly Scroll */
.hourly-scroll {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.hourly-item {
    min-width: 90px;
    background: rgba(255, 255, 255, 0.03);
    /* Extremely subtle fill */
    border-radius: 18px;
    padding: 18px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.02);
    transition: all 0.2s;
}

.hourly-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.hourly-time {
    font-size: 0.85rem;
    opacity: 0.6;
}

.hourly-icon {
    font-size: 1.6rem;
    margin: 5px 0;
}

.hourly-temp {
    font-weight: 700;
    font-size: 1.1rem;
}

/* Daily List */
.daily-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.daily-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-radius: 14px;
    transition: background 0.2s;
    background: rgba(255, 255, 255, 0.02);
}

.daily-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.daily-day {
    flex: 1;
    font-weight: 500;
}

.daily-icon-wrapper {
    flex: 0 0 50px;
    text-align: center;
    opacity: 0.9;
}

.daily-temps {
    flex: 1;
    text-align: right;
    font-weight: 500;
}

.min-temp {
    opacity: 0.6;
    margin-left: 8px;
    font-weight: 400;
}

/* Responsive */
@media (max-width: 900px) {
    .main-wrapper {
        flex-direction: column;
        padding: 10px;
        gap: 20px;
        /* Mobile: Let content flow naturally, don't constrain height */
        height: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        padding: 20px;
    }

    .current-weather-hero {
        margin: 20px 0;
    }

    /* .forecast-split is already column by default now */

    .content-area {
        max-height: none;
        /* Disable height validation on mobile */
        overflow-y: visible;
        /* Let whole page scroll */
    }
}

footer {
    text-align: center;
    font-size: 0.7rem;
    opacity: 0.4;
    margin-top: 10px;
}

/* Search Suggestions */
.search-box {
    position: relative;
    /* For absolute positioning of dropdown */
    z-index: 100;
}

.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #1e1e2d;
    /* Solid matte bg */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-top: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: none;
    transform-origin: top;
    animation: slideDown 0.2s ease;
    z-index: 200;
}

.suggestions-dropdown.active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.suggestion-item i {
    color: var(--accent-color);
    opacity: 0.7;
}

.suggestion-flag {
    margin-left: auto;
    font-size: 0.8rem;
    opacity: 0.5;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.hourly-item {
    min-width: 90px;
    background: rgba(255, 255, 255, 0.03);
    /* Extremely subtle fill */
    border-radius: 18px;
    padding: 18px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.02);
    transition: all 0.2s;
}

.hourly-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.hourly-time {
    font-size: 0.85rem;
    opacity: 0.6;
}

.hourly-icon {
    font-size: 1.6rem;
    margin: 5px 0;
}

.hourly-temp {
    font-weight: 700;
    font-size: 1.1rem;
}

/* Daily List */
.daily-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.daily-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-radius: 14px;
    transition: background 0.2s;
    background: rgba(255, 255, 255, 0.02);
}

.daily-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.daily-day {
    flex: 1;
    font-weight: 500;
}

.daily-icon-wrapper {
    flex: 0 0 50px;
    text-align: center;
    opacity: 0.9;
}

.daily-temps {
    flex: 1;
    text-align: right;
    font-weight: 500;
}

.min-temp {
    opacity: 0.6;
    margin-left: 8px;
    font-weight: 400;
}

/* Responsive */
@media (max-width: 900px) {

    /* Main Layout */
    .main-wrapper {
        flex-direction: column;
        padding: 15px;
        gap: 20px;
        height: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        padding: 20px;
    }

    /* Branding */
    .brand-container {
        justify-content: center;
        margin-bottom: 15px;
    }

    .brand-icon {
        font-size: 1.6rem;
    }

    .brand-title {
        font-size: 1.4rem;
    }

    /* Search Box - Fixed Button Alignment */
    .search-box {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        width: 100%;
    }

    #city-search {
        flex: 1;
        min-width: 0;
        font-size: 0.9rem;
        padding: 12px 15px;
    }

    #search-btn,
    #location-btn {
        flex-shrink: 0;
        width: 42px;
        height: 42px;
        margin-left: 6px;
    }

    /* Hero Weather */
    .current-weather-hero {
        margin: 15px 0;
        padding: 20px 0;
    }

    .hero-temp h1 {
        font-size: 4.5rem;
    }

    .hero-icon {
        font-size: 6rem;
    }

    .location-name {
        font-size: 1rem;
    }

    .weather-desc {
        font-size: 0.95rem;
    }

    /* Content Area */
    .content-area {
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
    }

    /* Highlights Panel - Centered and Optimized */
    .highlights-panel {
        padding: 20px;
        margin: 0 auto 20px auto;
        width: 100%;
    }

    .highlights-panel h2 {
        text-align: center;
        font-size: 1.4rem;
        margin-bottom: 15px;
    }

    .details-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .detail-card {
        padding: 18px;
        height: 140px;
    }

    .detail-head {
        font-size: 0.75rem;
    }

    .detail-value {
        font-size: 1.6rem;
    }

    .detail-icon {
        font-size: 1.4rem;
        top: 16px;
        right: 16px;
    }

    /* Forecasts - Centered */
    .forecast-split {
        gap: 20px;
    }

    .forecast-col {
        margin: 0 auto;
        width: 100%;
    }

    .forecast-col h3 {
        text-align: center;
        font-size: 1.7rem;
        margin-bottom: 25px;
    }

    /* Hourly Forecast */
    .hourly-scroll {
        gap: 10px;
        padding-bottom: 5px;
    }

    .hourly-item {
        min-width: 65px;
        padding: 15px 10px;
    }

    .hourly-time {
        font-size: 0.75rem;
    }

    .hourly-temp {
        font-size: 1.1rem;
    }

    /* Daily Forecast */
    .daily-item {
        padding: 15px;
        gap: 12px;
    }

    .day-name {
        font-size: 0.9rem;
        min-width: 70px;
    }

    .day-temp-range {
        font-size: 0.9rem;
    }

    /* Glass Panels - Better Mobile Appearance */
    .glass-panel {
        padding: 20px;
        margin-bottom: 15px;
    }

    /* Suggestions Dropdown */
    .suggestions-dropdown {
        font-size: 0.85rem;
    }

    .suggestion-item {
        padding: 14px;
        min-height: 48px;
        /* Better touch target */
    }
}

footer {
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.6;
    margin-top: 2px;
}

/* Search Suggestions */
.search-box {
    position: relative;
    /* For absolute positioning of dropdown */
    z-index: 100;
}

.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #1e1e2d;
    /* Solid matte bg */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-top: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: none;
    transform-origin: top;
    animation: slideDown 0.2s ease;
    z-index: 200;
}

.suggestions-dropdown.active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.suggestion-item i {
    color: var(--accent-color);
    opacity: 0.7;
}

.suggestion-flag {
    margin-left: auto;
    font-size: 0.8rem;
    opacity: 0.5;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Branding */
.brand-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.brand-icon {
    font-size: 1.8rem;
    color: #fff;
    /* Optical alignment */
    padding-bottom: 5px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center subtitle relative to title */
}

.brand-title {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 1;
    color: #fff;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    margin-top: 2px;
    /* Subtitle is now centered by brand-text align-items: center */
}

.author-link {
    text-decoration: none;
    font-weight: 600;
    color: #ffcc00;
    /* Single Gold Color */
    transition: opacity 0.3s ease;
}

.author-link:hover {
    opacity: 0.8;
}

/* Highlights Panel */
.highlights-panel {
    padding: 30px;
    display: flex;
    flex-direction: column;
}

/* Update detail-card to look good nested */
.detail-card {
    /* No glass-panel props here since parent has it */
    background: rgba(255, 255, 255, 0.03);
    border-radius: 18px;
    padding: 24px;
    height: 160px;
    border: 1px solid rgba(255, 255, 255, 0.02);
    box-shadow: none;
    /* Remove previous shadow */
}

/* Hover slightly lighter */
.detail-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
    box-shadow: none;
    /* Keep clean flat look inside panel */
}