/* ============================================================
   Stockschützen Wolfersdorf – Dashboard-Design (PV & Sportheim)
   Gemeinsames Stylesheet im Sportheim-Look
   ============================================================ */

:root {
    color-scheme: light;
    --bg: #f3f6fa;
    --text: #172033;
    --muted: #667085;
    --card: #ffffff;
    --border: #e4e9f0;
}

* {
    box-sizing: border-box;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 14px;
    margin-bottom: 18px;
    box-shadow: 0 2px 8px rgba(24, 39, 64, .06);
}

.site-nav a {
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
    padding: 8px 15px;
    border: 0;
    border-radius: 10px;
    background: none;
    transition: color .15s ease, background-color .15s ease;
}

.site-nav a:hover,
.site-nav a.active {
    color: #a44f00;
    background: #fbe9d6;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

a {
    font: inherit;
    text-decoration: none;
    border: 1px solid #d5dce6;
    border-radius: 9px;
    padding: 9px 13px;
    background: white;
    color: #172033;
}

a:hover, button:hover { background: #eef3f9; }

button, select, input[type=date] {
    font: inherit;
    border: 1px solid #d5dce6;
    border-radius: 9px;
    padding: 9px 13px;
    background: white;
    color: #172033;
}

button, select { cursor: pointer; }
input[type=date] { max-width: 100%; }

nav, form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.day-navigation {
    display: flex;
    align-items: center;
    gap: 6px;
}

.day-navigation button {
    min-width: 42px;
    padding: 9px 12px;
    font-size: 1.1rem;
}

.day-navigation input[type=date] {
    min-width: 155px;
}

.chart-wrap {
    position: relative;
    height: 430px;
    width: 100%;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.stat {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
}

.stat strong { display: block; margin-bottom: 8px; }
.stat p { margin: 5px 0; font-size: .9rem; }


main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 28px 18px 40px;
}

main.wide {
    max-width: 1160px;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 26px;
}

h1 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin: 0 0 5px;
}

.subtitle {
    color: var(--muted);
    font-size: .92rem;
}

.muted {
    color: var(--muted);
    font-size: .9rem;
}

.refresh {
    white-space: nowrap;
    font-size: .8rem;
    color: var(--muted);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px 12px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 4px 16px rgba(25, 45, 75, .04);
    border-top: 4px solid var(--accent);
    min-width: 0;
}

.card.cold   { --accent: #2684ff; }
.card.normal { --accent: #19a66a; }
.card.warm   { --accent: #ed9a16; }
.card.hot    { --accent: #e34c4c; }
.card.unknown { --accent: #98a2b3; }

.symbol {
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.label {
    color: var(--muted);
    font-size: .95rem;
    font-weight: 600;
}

.value {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 750;
    letter-spacing: -1px;
    margin: 8px 0;
    white-space: nowrap;
}

.status {
    display: inline-block;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, white);
    border-radius: 20px;
    padding: 5px 10px;
    font-size: .8rem;
    font-weight: 650;
}

.section {
    margin-top: 30px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 22px;
}

.panel {
    margin-top: 18px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 4px 16px rgba(25, 45, 75, .04);
}

h2 {
    margin: 0 0 16px;
    font-size: 1.1rem;
}

.last-update {
    color: var(--muted);
    font-size: .9rem;
    margin-top: 22px;
}

.error {
    border: 1px solid #e9aaaa;
    background: #fff0f0;
    color: #a22020;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 20px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
    font-variant-numeric: tabular-nums;
}

th, td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: .8rem;
    font-weight: 650;
}

tbody tr:last-child td {
    border-bottom: 0;
}

footer {
    margin-top: 22px;
    color: var(--muted);
    font-size: .8rem;
    text-align: center;
}

/* ---------- PV-Komponenten ---------- */

.overview-container {
    text-align: center;
    background: #fff7ef;
    border: 1px solid #f6d6b3;
    border-radius: 18px;
    padding: 16px 18px;
    margin: 0;
}

.overview-values {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 26px;
    font-size: 1.05rem;
    color: var(--text);
}

.overview-values strong {
    color: #a44f00;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.controls .spacer {
    margin-left: auto;
}

#table-container {
    max-height: 70vh;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
}

#data-table {
    font-size: 13px;
}

#data-table th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #606060;
    color: #fff;
    text-align: center;
    font-size: .78rem;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

#data-table td {
    text-align: right;
    padding: 6px 8px;
    font-size: 12px;
    white-space: nowrap;
}

#data-table tbody tr:nth-child(even) td {
    background: #f8fafc;
}

#data-table tbody tr:hover td {
    background: #fbe9d6;
}

.login-form {
    display: grid;
    gap: 6px;
    max-width: 360px;
}

.login-form label {
    margin-top: 8px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--muted);
}

.login-form input[type=text],
.login-form input[type=password] {
    font: inherit;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d5dce6;
    border-radius: 9px;
    background: #fff;
    color: #172033;
}

.login-form button {
    margin-top: 12px;
    justify-self: start;
}

.source-filter {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-bottom: 14px;
    font-size: .95rem;
    color: var(--text);
}

.source-filter label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

@media (max-width: 650px) {
    main {
        padding: 20px 12px 30px;
    }

    header {
        align-items: flex-start;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .card {
        padding: 17px 20px;
    }

    .symbol {
        display: inline-block;
        margin: 0 10px 0 0;
    }

    .value {
        font-size: 2rem;
    }

    .section {
        padding: 16px 12px;
    }

    .panel {
        padding: 16px 12px;
    }

    .chart-wrap { height: 330px; }
    .stats { grid-template-columns: 1fr; }
}
