/* --- Variables --- */
:root {
    --bg: #f0f0f0;
    --text: #111;
    --card: #ffffff;
    --primary-blue: #007bff;
    --primary-blue-hover: #005acc;
    --shadow-color: rgba(0,0,0,0.1);
    --dark-toggle-bg: #444;
}

body.dark {
    --bg: #121212;
    --text: #f5f5f5;
    --card: #1e1e1e;
    --shadow-color: rgba(255,255,255,0.1); /* Lighter shadow for dark mode */
    --dark-toggle-bg: #555; /* Slightly lighter toggle in dark mode */
}

/* --- Global Styles & Reset --- */
*, *::before, *::after {
    box-sizing: border-box; /* Apply box-sizing globally */
    margin: 0; /* Basic reset */
    padding: 0; /* Basic reset */
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: Arial, sans-serif;
    /* Removed margin: 0; as it's handled by the reset */
    padding: 2rem 1rem; /* Add horizontal padding */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh; /* Ensure body takes full height */
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth theme transition */
    /* Removed zoom */
    font-size: 16px; /* Set a base font size */
}

h1 {
    font-size: clamp(1.8rem, 5vw, 2.2rem); /* Responsive font size */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Font stack */
    margin: 0; /* Remove default margin handled by parent padding */
    text-align: center;
}

/* --- Layout Containers --- */
.header-box,
.container {
    background-color: var(--card);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
    width: 100%;
    max-width: 400px; /* Max width for larger screens */
    padding: 1.5rem; /* Consistent padding */
    transition: background-color 0.3s ease; /* Smooth theme transition */
}

.header-box {
    margin-bottom: 1.5rem; /* Space below header */
}

.container {
    text-align: center; /* Center inline/inline-block children */
}

/* --- Clock --- */
.clock-badge {
    background-color: var(--primary-blue);
    color: white;
    font-size: 1rem;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    display: inline-block; /* To allow centering via text-align */
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    line-height: 1.4; /* Improve readability */
}

.clock-badge .date-text {
    font-size: 0.85em; /* Slightly smaller date */
    margin-top: 0.2em;
    display: block; /* Ensure it takes its own line */
}

/* --- Search --- */
.search-box {
    margin-bottom: 1.5rem;
}

input[type="text"] {
    font-family: inherit; /* Use body font */
    padding: 0.6rem 0.8rem;
    text-align: center;
    width: 100%;
    max-width: 300px; /* Limit input width */
    margin: 0 auto 0.75rem; /* Center and add bottom margin */
    display: block;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--bg); /* Match background */
    color: var(--text);
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth theme transition */
}

input[type="text"]:focus {
    outline: 2px solid var(--primary-blue);
    border-color: var(--primary-blue);
}

/* --- Buttons --- */
button {
    padding: 0.6rem 1.5rem; /* Adjusted padding */
    border-radius: 8px;
    background-color: var(--primary-blue);
    color: white;
    border: none;
    font-size: 1rem; /* Consistent font size */
    cursor: pointer;
    transition: background-color 0.2s ease; /* Hover transition */
    display: block; /* Ensure margin auto works */
    margin-left: auto;
    margin-right: auto;
    font-family: inherit;
}

button:hover {
    background-color: var(--primary-blue-hover);
}

/* --- Weather Info --- */
.weather-info {
    font-family: Tahoma, Geneva, Verdana, sans-serif; /* Weather-specific font */
    margin-top: 1.5rem;
    margin-bottom: 1.5rem; /* Consistent spacing */
    background-color: transparent; /* Remove extra background if inside container */
    padding: 1rem 0; /* Vertical padding only */
    border-radius: 0; /* Remove radius if inside */
    box-shadow: none; /* Remove shadow if inside */
    text-align: center;
    min-height: 100px; /* Prevent layout shift */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.5rem; /* Space between weather items */
}

.weather-info .item {
    font-size: 1.1rem;
    line-height: 1.5; /* Improve readability */
    display: flex; /* Align icon and text */
    align-items: center;
    gap: 0.5rem; /* Space between icon and text */
}

/* Style for error/loading messages */
.weather-info p,
.weather-info .error-message,
.weather-info .loading-message {
    font-style: italic;
    color: #888; /* Subdued color */
}

body.dark .weather-info p,
body.dark .weather-info .error-message,
body.dark .weather-info .loading-message {
    color: #aaa; /* Lighter subdued color */
}

.weather-info .error-message {
    color: #e53935; /* Red for errors */
}
body.dark .weather-info .error-message {
    color: #ff5252; /* Lighter red for errors */
}


/* --- Extra Message --- */
.extra-message {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

/* --- Theme Toggle --- */
.theme-toggle {
    margin-top: 1rem;
    background-color: var(--dark-toggle-bg);
    width: 100%; /* Make toggle button full width within container */
    max-width: 300px; /* Match input width */
}

.theme-toggle:hover {
    background-color: #666; /* Slightly lighter hover for toggle */
}

body.dark .theme-toggle:hover {
    background-color: #777;
}

/* --- Utility Class --- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* --- Media Query for Smaller Screens --- */
@media (max-width: 480px) {
    body {
        padding: 1rem 1rem; /* Reduce padding slightly */
        font-size: 15px; /* Slightly smaller base font size */
    }

    .header-box,
    .container {
        max-width: 100%; /* Allow full width on small screens */
        padding: 1rem; /* Reduce padding */
    }

    h1 {
        font-size: 1.5rem; /* Smaller heading on small screens */
    }
    
    .clock-badge {
        font-size: 0.9rem; /* Smaller clock badge on small screens */
        padding: 0.3rem 0.5rem; /* Adjust padding */
    }

    input[type="text"] {
        max-width: none; /* Allow full width relative to container */
    }

    button {
        max-width: none; /* Allow full width relative to container */
    }

    .clock-badge {
        font-size: 0.95rem;
        padding: 0.3rem 0.7rem;
    }

    .weather-info {
        min-height: 80px; /* Adjust min height */
    }

    .weather-info .item {
        font-size: 1rem;
    }

    .theme-toggle {
         max-width: none; /* Allow full width relative to container */
         padding: 0.7rem;
    }
}