* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --text-color: #334155;
    --border-color: #e2e8f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    width: 100%;
}

.weather-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}
.weather-container h1 {
    text-align: center;
    color: var(--dark-color);
    margin-bottom: 30px;
}
.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}
.search-form input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}
.search-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}
.search-form button {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}
.search-form button:hover {
    background: var(--primary-dark);
}
.search-form button:disabled {
    background: #ccc;
    cursor: not-allowed;
}
.results {
    background: var(--light-color);
    border-radius: 12px;
    padding: 24px;
}
.city-name {
    font-size: 24px;
    font-weight: bold;
    color: var(--dark-color);
    margin-bottom: 8px;
}
.country {
    color: var(--secondary-color);
    margin-bottom: 20px;
}
.period {
    font-size: 14px;
    color: #888;
    margin-bottom: 20px;
}
.error {
    background: #fee;
    color: #c00;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}
.loading {
    text-align: center;
    color: var(--secondary-color);
    padding: 20px;
}
.locations {
    background: var(--light-color);
    border-radius: 12px;
    padding: 16px;
}
.locations h3 {
    margin-bottom: 12px;
    color: var(--dark-color);
}
.location-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.location-item {
    padding: 12px 16px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}
.location-item:hover {
    border-color: var(--primary-color);
    background: #f0f0ff;
}
.location-name {
    font-weight: bold;
    color: var(--dark-color);
}
.location-details {
    font-size: 14px;
    color: var(--secondary-color);
    margin-top: 4px;
}
.unit-toggle, .preset-toggle {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}
.unit-btn, .preset-btn {
    padding: 8px 16px;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.unit-btn.active, .preset-btn.active {
    background: var(--primary-color);
    color: white;
}
.unit-btn:hover:not(.active), .preset-btn:hover:not(.active) {
    background: #f0f0ff;
}
.date-range {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.date-range label {
    font-size: 13px;
    color: var(--secondary-color);
}
.date-range input[type="date"] {
    padding: 6px 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
}
.date-range input[type="date"]:focus {
    border-color: var(--primary-color);
    outline: none;
}
.date-range .apply-btn {
    padding: 6px 14px;
    font-size: 13px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}
.tab-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}
.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--secondary-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab-btn:hover {
    color: var(--primary-color);
}
.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}
.tab-content {
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.monthly-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.monthly-table th {
    background: var(--primary-color);
    color: white;
    padding: 10px 6px;
    text-align: center;
    font-weight: 600;
    font-size: 11px;
}
.monthly-table th:first-child {
    text-align: left;
    padding-left: 12px;
}
.monthly-table td {
    padding: 8px 6px;
    text-align: center;
    border-bottom: 1px solid #eee;
}
.monthly-table td:first-child {
    text-align: left;
    padding-left: 12px;
    font-weight: 600;
    color: var(--dark-color);
}
.monthly-table tr:hover {
    background: white;
}
.monthly-table .avg-col {
    color: var(--primary-color);
    font-weight: 600;
}
.monthly-table .record-col {
    color: #764ba2;
}
.monthly-table .record-date {
    font-size: 10px;
    color: #999;
    display: block;
}
.monthly-table tfoot .annual-row {
    background: #f0f4ff;
    border-top: 2px solid var(--primary-color);
    font-weight: 600;
}
.monthly-table tfoot .annual-row td:first-child {
    color: var(--primary-color);
}
.recent-searches {
    margin-bottom: 24px;
}
.recent-searches h3 {
    font-size: 14px;
    color: var(--secondary-color);
    margin-bottom: 10px;
    text-align: center;
}
.recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.recent-item {
    padding: 6px 12px;
    background: #f0f0ff;
    border: 1px solid #d0d0e0;
    border-radius: 16px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}
.recent-item:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}
.attribution {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 12px;
    color: #888;
}
.attribution a {
    color: var(--primary-color);
    text-decoration: none;
}
.attribution a:hover {
    text-decoration: underline;
}
