:root {
    --bg: #0f1620;
    --panel: #161f2c;
    --panel-2: #1c2733;
    --border: #2a3645;
    --text: #e8edf3;
    --text-dim: #8a99ab;
    --accent: #ff8a3d;
    --accent-cold: #4db8ff;
    --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ---- Sidebar: ~15% šířky ---- */
.sidebar {
    flex: 0 0 15%;
    min-width: 200px;
    max-width: 320px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
}

.sidebar-title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin: 0 0 14px 0;
}

.stations-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.station-card {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    cursor: pointer;
    transition: border-color .15s ease, transform .1s ease;
}

.station-photo {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #0a0e14;
    display: block;
    cursor: zoom-in;
}

.station-card:hover {
    border-color: var(--accent);
}

.station-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent) inset;
}

.station-name {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.station-temp {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.1;
}

.station-temp.cold { color: var(--accent-cold); }
.station-temp.warm { color: var(--accent); }

.station-time {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
}

.loading, .error {
    color: var(--text-dim);
    font-size: 13px;
}

.error { color: #ff6b6b; }

/* ---- Chart area: zbytek šířky ---- */
.chart-area {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: 20px 24px;
    min-width: 0;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.chart-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
}

.range-buttons {
    display: flex;
    gap: 6px;
}

.range-buttons button {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.range-buttons button:hover {
    color: var(--text);
}

.range-buttons button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #1a1106;
    font-weight: 600;
}

.mode-tabs {
    display: flex;
    gap: 6px;
    margin-right: auto;
}

.mode-tabs button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.mode-tabs button:hover {
    color: var(--text);
}

.mode-tabs button.active {
    background: var(--panel-2);
    border-color: var(--accent-cold);
    color: var(--text);
    font-weight: 600;
}

.years-select {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    order: 10; /* na nový řádek pod header */
}

.year-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.year-checkbox:hover {
    border-color: var(--accent-cold);
}

.year-checkbox input {
    accent-color: var(--accent-cold);
    cursor: pointer;
}

.year-checkbox.checked {
    border-color: var(--accent-cold);
    color: var(--text);
}

.chart-wrap {
    flex: 1 1 auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    position: relative;
    min-height: 0;
}

#tempChart {
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 720px) {
    .layout { flex-direction: column; }
    .sidebar {
        flex: 0 0 auto;
        max-width: none;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .stations-list {
        flex-direction: row;
        overflow-x: auto;
    }
    .station-card { min-width: 140px; }
}

/* ---- Lightbox ---- */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 12, 0);
    backdrop-filter: blur(0px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, background .25s ease, backdrop-filter .25s ease;
    cursor: zoom-out;
}

.lightbox.open {
    opacity: 1;
    visibility: visible;
    background: rgba(5, 8, 12, 0.85);
    backdrop-filter: blur(4px);
}

.lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: default;
    transform: scale(0.92);
    transition: transform .25s ease;
}

.lightbox.open .lightbox-img {
    transform: scale(1);
}

.lightbox-caption {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text);
    font-size: 14px;
    letter-spacing: 0.03em;
    opacity: 0.8;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 24px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, transform .15s ease;
}

.lightbox-close:hover {
    background: var(--accent);
    color: #1a1106;
    transform: rotate(90deg);
}

/* ---- Login screen ---- */
.login-page {
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.login-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
    width: 100%;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-box h1 {
    margin: 0;
    font-size: 22px;
    text-align: center;
}

.login-subtitle {
    margin: -8px 0 8px 0;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
}

.login-box label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-dim);
}

.login-box input {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
}

.login-box input:focus {
    outline: none;
    border-color: var(--accent-cold);
}

.login-box button {
    margin-top: 6px;
    background: var(--accent);
    border: none;
    color: #1a1106;
    font-weight: 600;
    padding: 11px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.login-box button:hover {
    filter: brightness(1.08);
}

.login-error {
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.4);
    color: #ff6b6b;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
}

/* ---- Sidebar header s logout ---- */
.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.sidebar-top .sidebar-title {
    margin: 0;
}

.logout-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color .15s ease, background .15s ease;
}

.logout-link:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}
