html, body {
    height: 100vh;
    font-family: Arial, sans-serif;
    background-image: url('weather.back.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    margin: 0;
    padding: 0;
}

.container {
    display: flex;
    flex-direction: row; /* Side by side */
    justify-content: space-between;
    align-items: stretch;
    height: 100%;
    padding: 15px;
    gap: 15px;
    box-sizing: border-box;
}

#weather {
    width: 35%;
    min-width: 300px; /* Minimum width to prevent shrinking too much */
    max-width: 450px; /* Adjusted max width */
    background-color: rgba(255, 255, 255, 0.9); /* Transparent white for readability */
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

#calendar {
    width: 90%;
    min-width: 500px; /* Minimum width to ensure calendar is not too small */
    max-width: 7000px; /* Increased max width for better scaling */
    background-color: rgba(255, 255, 255, 0.9); /* Transparent white */
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    box-sizing: border-box;
}

h1, h2 {
    text-align: center;
}

#forecast {
    margin-top: 0;
    flex-grow: 1;
}

#today-weather {
    background-color: #e6ecef;
    border: 1px solid #d1d8db;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: center;
}

#today-weather h3 {
    font-size: calc(1vw + 10px); /* Reduced from 1.2vw */
    margin: 0 0 10px 0;
}

.temp-display {
    font-size: calc(1.5vw + 12px); /* Reduced from 2vw + 15px to prevent oversizing */
    margin: 10px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.weather-details {
    font-size: calc(0.7vw + 6px); /* Slightly reduced for better scaling */
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: left;
}

.sun-times {
    font-size: calc(0.8vw + 7px); /* Reduced from 0.9vw */
    margin: 10px 0;
    display: flex;
    justify-content: space-around;
}

#five-day-forecast {
    background-color: #d9e1e5;
    border: 1px solid #c4ccd0;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

#five-day-forecast h3 {
    font-size: calc(1vw + 10px); /* Reduced from 1.2vw */
    margin: 0 0 10px 0;
    text-align: center;
}

.day {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.day .day-name {
    font-size: calc(0.8vw + 7px); /* Reduced from 0.9vw */
    font-weight: bold;
    width: calc(2.5vw + 20px);
    text-align: center;
    margin-right: 10px;
}

.day .details {
    flex-grow: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: calc(0.7vw + 6px); /* Reduced from 0.8vw */
}

.weather-icon {
    width: calc(1.5vw + 15px); /* Reduced from 2vw */
    height: calc(1.5vw + 15px); /* Reduced from 2vw */
    vertical-align: middle;
    background-color: #9a9ebe;
    padding: 3px;
    border-radius: 50%; /* Circular icons */
    box-sizing: border-box;
}

#weather-alerts {
    background-color: #fff0f0;
    border: 1px solid #ffcccc;
    border-radius: 6px;
    padding: 15px;
}

#weather-alerts h3 {
    font-size: calc(1vw + 10px); /* Reduced from 1.2vw */
    margin: 0 0 10px 0;
    text-align: center;
    color: #d00000;
}

#weather-alerts ul {
    list-style: none;
    padding: 0;
    margin: 5px 0;
}

#weather-alerts li {
    font-size: calc(0.7vw + 6px); /* Reduced from 0.8vw */
    margin-bottom: 8px;
}

#calendar-frame {
    flex-grow: 1;
    min-height: 400px; /* Minimum height to prevent calendar from being too small */
    height: 100%;
}

#calendar-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* Media Queries for Responsiveness */
@media (max-width: 768px) {
    .container {
        flex-direction: column; /* Stack on small screens */
        align-items: center;
    }
    #weather, #calendar {
        width: 90%; /* Full width on small screens */
        max-width: none;
        min-width: 0;
    }
    #calendar-frame {
        min-height: 300px; /* Adjusted minimum height for small screens */
    }
    .temp-display {
        font-size: calc(1vw + 10px); /* Further reduce on small screens */
    }
    #today-weather h3, #five-day-forecast h3, #weather-alerts h3 {
        font-size: calc(0.8vw + 8px);
    }
}
