@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Outfit:wght@300;400;500;600&display=swap');

:root {
    color-scheme: light;
    --green-deep: #2B4C2F;
    --green: #3E6B48;
    --green-light: #5A8F66;
    --brown: #7D6842;
    --brown-dark: #4A3728;
    --cream: #F5F0E6;
    --cream-light: #FAF7F0;
    --cream-dark: #E8E0D0;
    --gold: #B89B4A;
    --text: #2C2216;
    --text-muted: #7A6B5D;
    --border: #D5CBBA;
}

/* Dark palette: same variable roles, warm dark tones. theme.js sets
   data-theme on <html> (saved toggle choice, else browser preference).
   The greens brighten because --green-deep doubles as heading colour and
   button fill -- on dark surfaces the accent must be light, with the
   (now dark) --cream-light providing the button text. */
:root[data-theme="dark"] {
    color-scheme: dark;
    --green-deep: #7FB48A;
    --green: #91C69C;
    --green-light: #A8D8B2;
    --brown: #A08A5E;
    --brown-dark: #C4AD86;
    --cream: #191611;
    --cream-light: #221E17;
    --cream-dark: #2F2A20;
    --gold: #C9AD5E;
    --text: #EAE4D6;
    --text-muted: #A3947D;
    --border: #453E30;
}

/* ── Theme toggle (injected by theme.js on every page) ── */
#theme-toggle {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 90;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--cream-light);
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: border-color 0.15s, background 0.15s;
}

#theme-toggle:hover {
    border-color: var(--green);
    background: var(--cream-dark);
}

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

body {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text);
    background: var(--cream);
    min-height: 100vh;
    padding: 0;
}

.container {
    background: var(--cream-light);
    width: 100%;
    min-height: 100vh;
    padding: 20px 28px 28px;
}

/* ── Header ── */
.header {
    text-align: center;
    margin-bottom: 16px;
}

h1 {
    font-family: 'Fraunces', serif;
    font-optical-sizing: auto;
    font-weight: 600;
    font-size: 1.6rem;
    color: var(--green-deep);
    margin-bottom: 0;
    letter-spacing: -0.01em;
}

h1::after {
    content: '';
    display: block;
    width: 32px;
    height: 2px;
    background: var(--gold);
    margin: 6px auto 0;
    border-radius: 1px;
}

.header p {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 300;
    margin-bottom: 0;
}

/* ── Main layout: map + sidebar ── */
.main-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.map-col {
    flex: 1;
    min-width: 0;
}

#map {
    border-radius: 3px;
    overflow: hidden;
    border: 1.5px solid var(--border);
    box-shadow:
        0 1px 3px rgba(44, 34, 22, 0.06),
        0 4px 16px rgba(44, 34, 22, 0.04);
}

.map-container {
    margin-top: 6px;
}

.zoom-display {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 300;
    letter-spacing: 0.01em;
}

#zoom-display {
    display: none;
}

/* ── Sidebar / control panel ── */
.sidebar {
    width: 200px;
    min-width: 200px;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.sidebar-select {
    font-family: 'Outfit', sans-serif;
    font-size: 0.86rem;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--cream);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s;
    width: 100%;
}

.sidebar-select:focus {
    outline: none;
    border-color: var(--green);
}

.gpx-add-btn {
    display: inline-block;
    cursor: pointer;
    background: var(--cream-dark);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 5px 12px;
    font-size: 0.82rem;
    font-family: 'Outfit', sans-serif;
    color: var(--text-muted);
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
    text-align: center;
}

.gpx-add-btn:hover {
    background: var(--border);
    border-color: var(--brown);
}

#gpx-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gpx-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
}

.gpx-name {
    color: var(--green);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gpx-uploading {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.gpx-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--border);
    font-size: 1rem;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s;
    flex-shrink: 0;
}

.gpx-remove:hover {
    color: #c0392b;
}

/* ── Render button ── */
.sidebar .button {
    display: block;
    margin-top: auto;
    background: var(--green-deep);
    color: var(--cream-light);
    padding: 11px 16px;
    border-radius: 3px;
    text-decoration: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 0.88rem;
    letter-spacing: 0.03em;
    text-align: center;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.sidebar .button:hover {
    background: var(--green);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(43, 76, 47, 0.2);
}
