:root {
    --primary-color: #0090A8;
    --secondary-color: #00b3d4;
    --background-color: #f5f7fa;
    --card-background: #ffffff;
    --text-color: #2c3e50;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --main-font: 'Quicksand', sans-serif;
    --shadow-dark: 0 4px 6px rgba(0, 0, 0, 0.2);
    --details-background: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] {
    --background-color: #1a1a1a;
    --card-background: #2d2d2d;
    --text-color: #e0e0e0;
    --shadow: var(--shadow-dark);
    --details-background: rgba(45, 45, 45, 0.8);
}

body {
    font-family: var(--main-font);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease;
}

#weather-dashboard {
    max-width: 1200px;  /* Increased from 600px to accommodate both cards */
    margin: 0 auto;
    padding: 20px 20px 40px 20px; /* Add bottom padding to account for content */
    flex: 1;
}

h1 {
    color: var(--text-color);
    text-align: center;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    animation: fadeInUp 0.6s ease-out;
}

.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.search-wrapper {
    flex: 1;
    min-width: 200px;
    max-width: 400px; /* Add max-width to prevent over-stretching */
    position: relative;
    display: flex;
    align-items: center;
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 8px 16px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.search-wrapper .material-icons-round {
    color: #9e9e9e;
    margin-right: 8px;
}

.search-wrapper .material-symbols-rounded {
    color: #9e9e9e;
    margin-right: 8px;
}

#location {
    border: none;
    outline: none;
    width: 100%;
    font-size: 16px;
    font-family: var(--main-font);
    background: transparent;
    color: var(--text-color);
    transition: background-color 5000s ease-in-out 0s, color 0.3s ease;
}

/* Override Chrome's autofill styles */
#location:-webkit-autofill,
#location:-webkit-autofill:hover,
#location:-webkit-autofill:focus,
#location:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--card-background) inset !important;
    -webkit-text-fill-color: var(--text-color) !important;
}

.btn {
    flex: 0 0 auto; /* Prevent buttons from stretching */
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-family: var(--main-font);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.btn.secondary {
    background-color: var(--card-background);
    color: var(--text-color);
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.weather-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
}

.weather-card {
    width: 100%;
    min-width: 500px;
    min-height: 400px;
    height: 400px;
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--shadow);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.weather-card h2 {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-color);
    font-weight: 600;
    font-size: 1.5rem;
}

.weather-summary {
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    transition: opacity 0.3s ease;
    /* padding: 20px 0; */
    flex-shrink: 0; /* Prevent summary from shrinking */
}

/* Update the selector to be more specific */
.material-symbols-rounded.weather-summary-icon {
    font-size: 60px;
    color: var(--primary-color);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    background: var(--details-background);
    padding: 24px;
    border-radius: var(--border-radius);
    min-height: 180px; /* Add minimum height for weather details */
    transition: opacity 0.3s ease;
    overflow-y: auto;
    margin: 0 -32px; /* Compensate for parent padding */
    padding: 24px 32px;
}

.weather-details .material-symbols-rounded {
    font-size: 28px;
    padding: 8px;
    background: rgba(0, 144, 168, 0.1); /* Updated to match new primary color */
    border-radius: 50%;
    color: var(--primary-color);
    justify-self: center;
}

.location-text {
    font-weight: 500;
    color: var (--text-color);
    opacity: 0.9;
}

.weather-details p {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 16px;
    font-family: var (--main-font);
    font-weight: 500;
    min-width: 0; /* Allows text to wrap properly in grid */
}

.weather-details span {
    font-weight: 400;
    font-size: large;
}

.temperature {
    font-size: 2em;
    color: #ff4500;
}

.rain, .cloudiness {
    font-size: 1.2em;
    color: #555;
}

.material-icons-round {
    color: var(--primary-color);
}

.material-symbols-rounded {
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 24;
    color: var(--primary-color);
}

.footer {
    text-align: center;
    margin-top: auto;
    font-size: 0.9em;
    color: #777;
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    background-color: var(--card-background);
    box-sizing: border-box;
    position: relative;
    width: 100%;
    left: 0;
    right: 0;
    bottom: 0;
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

.footer .material-symbols-rounded {
    font-size: 24px;
    vertical-align: middle;
    margin-right: 0px; 
    margin-bottom: 4px;
}

.footer-logo {
    height: 24px;
    width: auto;
    vertical-align: middle;
    margin-right: 8px;
    filter: brightness(0.5);
    transition: filter 0.3s ease;
}

[data-theme="dark"] .footer-logo {
    filter: brightness(1);
}

.error {
    background-color: #ff5252;
    color: white;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeInUp 0.3s ease-out;
}

@media (max-width: 600px) {
    .search-container {
        flex-direction: column;
        max-width: 100%; /* Allow full width on mobile */
    }
    
    .search-wrapper {
        width: 100%;
        max-width: none; /* Remove max-width constraint on mobile */
    }
    
    .btn {
        width: 100%; /* Full width buttons only on mobile */
        justify-content: center;
    }

    .weather-details {
        grid-template-columns: 1fr; /* Single column on small screens */
    }
}

#weather-info {
    text-align: center;
    margin-top: 20px;
}

.content-wrapper {
    display: grid;
    grid-template-columns: repeat(2, minmax(500px, 1fr));
    gap: 30px; /* Increased gap between cards */
    margin-top: 20px;
    justify-content: center;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    height: 0;
    overflow: hidden;
    margin-bottom: 0; /* Remove bottom margin */
}

.content-wrapper.visible {
    opacity: 1;
    visibility: visible;
    height: auto;
    overflow: visible;
    animation: fadeInUp 0.6s ease-out;
}
#fetch-weather span {
    color: white;
}

.weather-card, .map-card {
    margin-top: auto;
    width: 100%;
    min-width: 500px;
    min-height: 400px;
    height: 400px; /* Fixed height instead of min-height */
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden; /* Ensure contents don't overflow */
    box-sizing: border-box; /* Include padding in width/height calculations */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.map-card {
    flex: 1;
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    padding: 0; /* Remove padding for map container */
    position: relative;
    z-index: 0;
}

#map {
    width: 100%;
    height: 100%;
    min-height: 400px;
}

/* Windy map styles - consolidated and cleaned */
.weather-map-container {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: var(--border-radius);
    overflow: hidden;
}

#windy {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Single source of truth for Windy z-index hierarchy */
#windy .leaflet-control-container { z-index: 1100 !important; }
#windy .leaflet-top { z-index: 1100 !important; }
#windy .leaflet-bottom { z-index: 1100 !important; }
#windy #map-container { z-index: 0 !important; }
#windy .leaflet-pane { z-index: 400 !important; }
#windy .leaflet-overlay-pane { z-index: 500 !important; }
#windy #bottom { z-index: 1000 !important; }
#windy #logo { z-index: 1000 !important; }
#windy .graph-container { z-index: 1100 !important; }
#windy .menu-container { z-index: 1100 !important; }

/* Remove unused controls */
.windy-controls { display: none; }

@media (max-width: 768px) {
    .content-wrapper {
        grid-template-columns: 1fr;  /* Stack cards on mobile */
    }
    
    .map-card {
        min-height: 300px;
    }

    .forecast-card {
        display: none;  /* Hide forecast on mobile */
    }
}

/* Add new breakpoint for very small screens */
@media (max-height: 800px) {
    .forecast-card {
        display: none;  /* Hide forecast on short screens */
    }
}

/* Add new breakpoint for narrow screens */
@media (max-width: 500px) {
    .forecast-card {
        display: none;  /* Hide forecast on narrow screens */
    }
}

@media (max-width: 1100px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .weather-card, .map-card {
        min-width: 280px;
        width: 100%;
    }
}

.social-links {
    margin-bottom: 1rem;
}

.social-links a {
    color: #333;
    font-size: 1.5rem;
    margin: 0 1rem;
    text-decoration: none;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: #007bff;
}

.social-links a.weather-service {
    font-size: 1.3rem;
    color: #0066b3;
}

.social-links a.weather-service:hover {
    color: #0099ff;
}

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

.weather-summary, .weather-details, #location-name {
    transition: opacity 0.3s ease;
}

.fade-out {
    opacity: 0;
}

.fade-in {
    opacity: 1;
}

.theme-toggle {
    position: absolute;
    top: 45px;
    right: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle .material-symbols-rounded {
    font-size: 24px;
    color: var(--text-color);
}

.logo {
    height: 40px;
    width: auto;
    margin-right: 12px;
    filter: brightness(0.8);
    transition: filter 0.3s ease;
}

[data-theme="dark"] .logo {
    filter: brightness(1);
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.weather-details::-webkit-scrollbar {
    width: 8px;
}

.weather-details::-webkit-scrollbar-track {
    background: transparent;
}

.weather-details::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: content-box;
}

/* For Firefox */
.weather-details {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.forecast {
    margin-top: 20px;
    flex-shrink: 0;
}

.forecast h3 {
    margin: 0 0 10px 0;
    color: var(--text-color);
    font-size: 1rem;
}

.forecast-scroll {
    overflow-x: auto;
    padding-bottom: 10px;
}

.forecast-container {
    display: flex;
    gap: 15px;
    padding: 0 5px;
}

.forecast-item {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px;
    border-radius: var(--border-radius);
    background: var(--details-background);
    min-width: 60px;
}

.forecast-item .time {
    font-size: 0.8rem;
    color: var(--text-color);
}

.forecast-item .temp {
    font-weight: 600;
    color: var (--text-color);
}

/* Customized scrollbar for forecast */
.forecast-scroll::-webkit-scrollbar {
    height: 6px;
}

.forecast-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.forecast-scroll::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}

.forecast-card {
    width: 100%;
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-top: 30px;
    box-sizing: border-box;
    animation: fadeInUp 0.6s ease-out 0.2s both;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.forecast-card.visible {
    opacity: 1;
    visibility: visible;
    animation: fadeInUp 0.6s ease-out;
}

.forecast-card h3 {
    margin: 0 0 16px 0;
    color: var(--text-color);
    font-size: 1.2rem;
    font-weight: 600;
}

.forecast-scroll {
    overflow-x: auto;
    padding-bottom: 10px;
}

.forecast-container {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(100px, 1fr); /* Increased from 80px */
    gap: 20px; /* Increased from 15px */
}

.forecast-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 16px; /* Increased padding */
    border-radius: var(--border-radius);
    background: var(--details-background);
    text-align: center;
}

.forecast-item .time {
    font-size: 1.1rem; /* Increased from 0.9rem */
    color: var(--text-color);
    font-weight: 500;
}

.forecast-item .temp {
    font-size: 1.2rem; /* Added font size */
    font-weight: 600;
    color: var(--text-color);
}

.forecast-item .material-symbols-rounded {
    font-size: 32px; /* Increased from 24px */
    color: var(--primary-color);
}

/* Customized scrollbar for forecast */
.forecast-scroll::-webkit-scrollbar {
    height: 6px;
}

.forecast-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.forecast-scroll::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}

.lang-toggle {
    position: absolute;
    top: 49px;
    right: 80px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--main-font);
    color: var(--text-color);
    font-weight: 600;
}

.lang-toggle:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .lang-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
    .forecast-container {
        grid-auto-columns: minmax(90px, 1fr); /* Increased from 70px */
    }
}

/* Global scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--background-color);
    border-radius: 10px;
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--background-color) transparent;
}