/* General styling */
body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f4f8;
    color: #333;
    margin: 0;
    padding: 0;
}

h1 {
    text-align: center;
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 30px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header styling */
.header {
    background-color: #2c3e50;
    padding: 0.5px 0; /* Drastically reduced padding */
    width: 100%;
    height: auto;
    position: fixed;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05); /* Reduced box shadow */
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    color: #ecf0f1;
    font-size: 0.7rem; /* Further reduced font size */
    margin: 0;
    font-weight: bold;
}

.navbar {
    display: flex;
}

.navbar ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.navbar ul li {
    margin-left: 3px; /* Further reduced margin */
}

.navbar ul li a {
    color: #ecf0f1;
    text-decoration: none;
    padding: 2px 4px; /* Reduced padding further */
    font-size: 0.6rem; /* Further reduced font size */
    transition: background-color 0.3s;
    border-radius: 3px;
}

.navbar ul li a:hover, .navbar ul li a.active {
    background-color: #3498db;
    color: white;
}

/* Mobile navigation toggle */
.mobile-nav-toggle {
    display: none;
    color: #ecf0f1;
    font-size: 1rem; /* Further reduced size */
    cursor: pointer;
}

/* Adjust content below header */
.container {
    margin-top: 20px; /* Further reduced margin */
}

/* Input Fields */
.input-group {
    margin-bottom: 15px;
}

input {
    width: 100%;
    padding: 10px;
    border: 2px solid #3498db;
    border-radius: 5px;
    font-size: 1rem;
}

/* Button styling */
.action-button {
    padding: 4px 6px; /* Further reduced padding */
    width: 100px; /* Further reduced button width */
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    color: white;
    transition: background-color 0.3s;
    margin-left: 8px;
}

.action-button:first-child {
    margin-left: 0;
}

#get-weather {
    background-color: #2ecc71;
}

#get-weather:hover {
    background-color: #27ae60;
}

#clear-button {
    background-color: #e74c3c;
}

#clear-button:hover {
    background-color: #c0392b;
}

/* Flex container for weather result and search history */
.flex-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

#weather-result-container {
    flex: 3;
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Search history styling */
.history-container {
    flex: 1;
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 500px;
    overflow-y: auto;
}

ul#search-history {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

ul#search-history li {
    background-color: #ecf0f1;
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

ul#search-history li:hover {
    background-color: #dcdde1;
}

/* Clear history button */
#clear-history {
    display: block;
    margin-top: 20px;
    background-color: #e74c3c;
    border: none;
    color: white;
    padding: 6px 8px; /* Further reduced padding */
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100px; /* Further reduced button width */
}

#clear-history:hover {
    background-color: #c0392b;
}

/* Loading spinner styling */
#loading {
    display: none;
    margin: 20px auto;
    width: 30px; /* Further reduced size */
    height: 30px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .flex-container {
        flex-direction: column;
    }

    #weather-result-container, .history-container {
        width: 100%;
    }

    .action-button, #clear-history {
        width: 100%;
    }

    .action-button {
        margin-bottom: 10px;
    }

    /* Mobile navigation adjustments */
    .navbar ul {
        flex-direction: column;
        display: none;
        background-color: #34495e;
        width: 100%;
        position: absolute;
        top: 60px;
        left: 0;
    }

    .navbar ul.show {
        display: flex;
    }

    .navbar ul li {
        margin: 10px 0;
    }

    .mobile-nav-toggle {
        display: block;
    }
}
