@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;900&display=swap');

/* === General Body & Layout === */
body {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    margin: 0;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    transition: background-image 1.5s ease-in-out;
    background-color: #1a1a1a;
    background-image: url('https://wallpaperaccess.com/full/535628.jpg');
}

/* === App Container === */
#app {
    background: rgba(30, 30, 30, 0.95);
    color: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    max-width: 420px;
    width: 100%;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 500px;
    display: flex;
    flex-direction: column;
}

/* === Header & Search === */
header {
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

header h1 {
    font-size: 2rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 1.5rem;
    color: #4a90e2;
}

.search-container {
    display: flex;
    gap: 0.75rem;
}

.search-container input {
    flex-grow: 1;
    padding: 0.75rem;
    border-radius: 10px;
    background-color: #333;
    color: white;
    border: 1px solid #555;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
    transition: border-color 0.2s;
    font-family: 'Inter', sans-serif;
}

.search-container input::placeholder {
    color: #bbb;
}

.search-container input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.5);
}

.search-container button {
    padding: 0.75rem;
    font-weight: bold;
    border-radius: 10px;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    min-width: 44px;
}

.search-container button:active {
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

#searchButton {
    background-color: #4a90e2;
    color: white;
}

#searchButton:hover {
    background-color: #3a7acb;
}

#locationButton {
    background-color: #5cb85c;
    color: white;
}

#locationButton:hover {
    background-color: #4cae4c;
}

/* === Main Content Container === */
#weatherContainer {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 380px;
    position: relative;
}

/* All content sections - Fixed positioning to prevent movement */
#weatherContainer > div {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* === Message States === */
.message {
    padding: 2rem 1rem;
    color: #ddd;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
}

.message p {
    margin: 0;
    line-height: 1.5;
}

.message h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #4a90e2;
}

.hint {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #999;
    line-height: 1.4;
}

.text-blue-400 {
    color: #4a90e2;
}

/* === Loading Spinner === */
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #4a90e2;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* === Weather Card Details === */
.weather-card {
    background-color: #444;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.weather-header {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid #555;
    padding-bottom: 1rem;
}

@media (min-width: 640px) {
    .weather-header {
        flex-direction: row;
    }
    .weather-header > div:first-child {
        text-align: left;
    }
}

.weather-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
    color: #4a90e2;
    margin: 0;
    text-align: center;
}

.weather-header p {
    font-size: 1.1rem;
    text-transform: capitalize;
    color: #ccc;
    margin: 0.5rem 0 0 0;
}

.weather-icon {
    width: 80px;
    height: 80px;
    margin-top: 0.5rem;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

/* === Temperature Section === */
.temp-section {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin: 1rem 0;
    gap: 0.5rem;
}

#temperature {
    font-size: 4rem;
    font-weight: 900;
    line-height: 1;
    margin: 0;
}

#tempUnit {
    font-size: 2rem;
    font-weight: bold;
    color: #4a90e2;
    margin-bottom: 0.5rem;
}

/* === Details Grid === */
.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    text-align: center;
    margin-top: auto;
}

.details-grid > div {
    padding: 1rem;
    background-color: #333;
    border-radius: 10px;
    box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 70px;
}

.details-grid p:first-child {
    font-size: 0.875rem;
    font-weight: 500;
    color: #bbb;
    margin-bottom: 0.25rem;
    margin: 0;
}

.details-grid p:last-child {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0;
}

/* === Error Message === */
.error-message {
    color: #ff6347;
    text-align: center;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
}

.error-message p:last-child {
    font-size: 0.875rem;
    color: #ff998a;
    margin-top: 0.5rem;
}

/* === Loading State === */
#loadingSpinner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* === Hidden State === */
.hidden {
    display: none !important;
}
