/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Trebuchet MS', sans-serif;
    font-size: 14px;
    background: #f5f5f5;
    color: #333;
}

/* ── Page Shell (flexbox column, full viewport height) ────── */
div.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Sticky Navigation ────────────────────────────────────── */
div.navigation {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #222;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

nav {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 52px;
}

nav h1 {
    margin: 0;
    font-size: 18px;
}

nav h1 a,
nav a {
    color: #eee;
    text-decoration: none;
    margin-right: 16px;
    font-size: 14px;
    transition: color 0.2s;
}

nav h1 a {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
}

nav h1 a:hover,
nav a:hover {
    color: #adf;
}

.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 20px;
}

/* ── Main Content (grows to fill space between nav & footer) ─ */
div.body {
    flex: 1;
    padding: 24px 20px;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

/* ── Sticky Footer ────────────────────────────────────────── */
div.footer {
    position: sticky;
    bottom: 0;
    background: #222;
    color: #888;
    padding: 10px 20px;
    font-size: 12px;
    text-align: center;
    border-top: 1px solid #333;
}

div.footer a {
    color: #aaa;
    text-decoration: none;
    margin-left: 12px;
}

div.footer a:hover {
    color: #fff;
}

/* ── Toast Notification ───────────────────────────────────── */
.toast {
    background: #d4edda;
    border: 1px solid #6abf77;
    color: #2d6a3f;
    border-radius: 4px;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    opacity: 1;
    transition: opacity 0.8s ease;
}

/* ── Error & Flash Messages ───────────────────────────────── */
div.error {
    margin: 12px 0;
    background: #FAE4E4;
    border: 1px solid #DD6F6F;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
}

ul.flashes {
    list-style: none;
    margin: 12px 0;
    padding: 0;
}

ul.flashes li {
    background: #B9F3ED;
    border: 1px solid #81CEC6;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
    margin-bottom: 4px;
}

/* ── Form Elements ────────────────────────────────────────── */
input[type="text"],
input[type="password"],
input[type="email"] {
    width: 100%;
    max-width: 360px;
    padding: 8px 10px;
    margin: 6px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

input[type="submit"] {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    background: #444;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

input[type="submit"]:hover {
    background: #222;
}

/* Search bar */
input[type="text"]#search-input,
input[name="q"] {
    width: 80%;
    max-width: none;
    padding: 10px 12px;
    margin: 0;
    font-size: 14px;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.search-form input[name="q"] {
    flex: 1;
}

.search-form select {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f0f0f0;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

/* ── Custom Select Dropdown ───────────────────────────────── */
.custom-select {
    position: relative;
}

.search-form button {
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1;
}

.custom-select-toggle {
    white-space: nowrap;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1;
}

.custom-select-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    list-style: none;
    padding: 4px 0;
    margin: 0;
    min-width: 100%;
    z-index: 200;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.custom-select-menu.open {
    display: block;
}

.custom-select-menu li a {
    display: block;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
}

.custom-select-menu li a:hover {
    background: #f0f0f0;
}

.search-form select:hover {
    background: #ddd;
}

button {
    padding: 10px 18px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f0f0f0;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

button:hover {
    background: #ddd;
}

button:active {
    background: #ccc;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* ── Search Results ───────────────────────────────────────── */
.results-count {
    font-size: 13px;
    color: #888;
    margin-bottom: 12px;
}

.search-results {
    margin-top: 20px;
}

.result-card {
    padding: 14px 0;
    border-bottom: 1px solid #e5e5e5;
}

.result-card:first-of-type {
    border-top: 1px solid #e5e5e5;
}

.result-title {
    font-size: 16px;
    margin: 0 0 4px 0;
}

.result-title a {
    color: #1a0dab;
    text-decoration: none;
}

.result-title a:hover {
    text-decoration: underline;
}

.result-url {
    font-size: 12px;
    color: #006621;
    word-break: break-all;
}

.no-results {
    margin-top: 20px;
    color: #888;
    font-size: 14px;
}

/* ── Weather Card ─────────────────────────────────────────── */
.wx-card {
    max-width: 420px;
    margin: 40px auto;
    background: #f2f7ff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.wx-header {
    background: #e0eafc;
    padding: 28px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wx-city {
    font-size: 2rem;
    font-weight: 700;
    color: #2e3440;
    margin: 0 0 4px;
}

.wx-datetime {
    font-size: 0.95rem;
    color: #5e81ac;
    margin: 0;
}

.wx-main {
    padding: 32px 32px 8px;
    color: #2e3440;
}

.wx-temp {
    display: flex;
    align-items: flex-start;
    line-height: 1;
    margin-bottom: 6px;
}

.wx-temp-value {
    font-size: 5rem;
    font-weight: 300;
    letter-spacing: -2px;
}

.wx-temp-unit {
    font-size: 2.2rem;
    font-weight: 400;
    margin-top: 10px;
    margin-left: 4px;
    color: #5e81ac;
}

.wx-desc {
    font-size: 1rem;
    color: #5e81ac;
    margin: 0 0 24px;
}

.wx-details {
    display: flex;
    gap: 16px;
    padding: 0 32px 32px;
}

.wx-detail-card {
    flex: 1;
    background: #e0eafc;
    border-radius: 16px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.wx-detail-icon {
    width: 24px;
    height: 24px;
    stroke: #5e81ac;
    opacity: 0.85;
}

.wx-detail-value {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2e3440;
}

.wx-detail-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5e81ac;
}

/* ── Definition Lists (login/register forms) ──────────────── */
dl {
    margin-bottom: 16px;
}

dt {
    font-weight: bold;
    margin-top: 10px;
}

dd {
    margin-left: 0;
}
