/* ==========================================================
   GrowTek Dashboard
   ========================================================== */

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #121212;
    color: white;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.test-page {
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 25px;
}


/* ==========================================================
   GrowTek Header
   ========================================================== */

header {
    background: #181818;
    padding: 20px 0;
    border-bottom: 2px solid #33cc66;
}

header .container {
    width: 90%;
    max-width: 1200px;
    margin: auto;

    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

header h1 {
    margin: 0;
    font-size: 28px;
}

header nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

header nav a {
    color: white;
    text-decoration: none;
    margin-left: 25px;
    transition: .3s;
}

header nav a:visited {
    color: white;
}

header nav a:hover {
    color: #33cc66;
}

header nav a:active {
    color: white;
}


/* ==========================================================
   Panels
   ========================================================== */

.panel {
    background: #1c1c1c;
    border: 1px solid #2c2c2c;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 25px;
}

.panel h2 {
    margin-top: 0;
    color: #ccc;
    font-size: 20px;
    font-weight: normal;
}


/* ==========================================================
   Aktuelle Werte
   ========================================================== */

.value-grid {
    display: flex;
    gap: 20px;
}

.value-box {
    flex: 1;
    background: #181818;
    border-radius: 12px;
    padding: 25px 15px;
    text-align: center;
}

.label {
    display: block;
    color: #aaa;
    margin-bottom: 12px;
}

.value {
    display: block;
    font-size: 32px;
    font-weight: bold;
}

.last-measurement {
    margin-top: 20px;
    color: #777;
    text-align: center;
}

.last-measurement strong {
    color: #ccc;
}


/* ==========================================================
   Statistik
   ========================================================== */

.statistics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #333;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row span {
    color: #aaa;
}

.stat-row strong {
    color: white;
}


/* ==========================================================
   Charts
   ========================================================== */

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.chart-panel {
    height: 380px;
}

.chart-panel canvas {
    width: 100% !important;
    height: 300px !important;
}


/* ==========================================================
   Messwertverlauf / Messabstände
   ========================================================== */

.data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.data-header,
.data-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 15px;
    align-items: center;
}

.data-header {
    color: #777;
    font-size: 14px;
    padding: 10px 0;
    border-bottom: 1px solid #333;
}

.data-list {
    max-height: 450px;
    overflow-y: auto;
}

.data-row {
    padding: 10px 0;
    border-bottom: 1px solid #2d2d2d;
    font-size: 14px;
}

.data-row:last-child {
    border-bottom: none;
}


/* ==========================================================
   Messabstände
   ========================================================== */

.data-grid > .panel:nth-child(2) .data-header,
.data-grid > .panel:nth-child(2) .data-row {
    grid-template-columns: 1.5fr 1fr;
}


/* ==========================================================
   Messlücken
   ========================================================== */

.warning {
    background: #2a2020;
    border-left: 4px solid #aa4444;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    color: #ddd;
}

.ok {
    background: #202820;
    border-left: 4px solid #557755;
    border-radius: 6px;
    padding: 12px;
    color: #bbb;
}


/* ==========================================================
   Footer
   ========================================================== */

.test-footer {
    text-align: center;
    margin-top: 30px;
    padding-bottom: 10px;
    color: #777;
    font-size: 14px;
}


/* ==========================================================
   Scrollbars
   ========================================================== */

.data-list::-webkit-scrollbar {
    width: 8px;
}

.data-list::-webkit-scrollbar-track {
    background: #181818;
    border-radius: 10px;
}

.data-list::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 10px;
}


/* ==========================================================
   Smartphone
   ========================================================== */

/* ==========================================================
   Mehrere Sensoren
   ========================================================== */

.dashboard-section-heading,
.selected-sensor-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.dashboard-section-heading {
    margin-bottom: 20px;
}

.dashboard-section-heading h2,
.dashboard-section-heading p,
.selected-sensor-heading h2 {
    margin: 0;
}

.dashboard-section-heading p,
.selected-sensor-heading span {
    color: #888;
    font-size: 14px;
}

.sensor-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 34px;
}

.sensor-card {
    min-width: 0;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    padding: 22px;
    background: #1c1c1c;
    color: white;
    border: 1px solid #2c2c2c;
    border-radius: 12px;
    text-decoration: none;
    transition: border-color .2s ease, background .2s ease;
}

.sensor-card:visited {
    color: white;
}

.sensor-card:hover {
    background: #202020;
    border-color: #447653;
}

.sensor-card.is-selected {
    background: #1c241f;
    border-color: #33cc66;
    box-shadow: inset 0 0 0 1px rgba(51, 204, 102, .15);
}

.sensor-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 18px;
}

.sensor-card-heading strong,
.sensor-card-heading span {
    display: block;
}

.sensor-card-heading strong {
    font-size: 17px;
}

.sensor-card-heading span,
.sensor-card-heading small,
.sensor-card-time,
.sensor-card-empty {
    color: #888;
    font-size: 12px;
}

.sensor-card-values {
    display: grid;
    gap: 5px;
    margin-bottom: 15px;
    color: #aaa;
    font-size: 13px;
}

.sensor-card-values span {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.sensor-card-values strong {
    color: white;
    font-weight: 600;
}

.sensor-card-time,
.sensor-card-empty {
    margin-top: auto;
}

.selected-sensor-heading {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #2c2c2c;
}

.selected-sensor-heading h2 {
    font-size: 26px;
}

.selected-sensor-heading > strong {
    padding: 5px 10px;
    background: #202820;
    color: #8dd5a4;
    border-radius: 20px;
    font-size: 12px;
}

.dashboard-empty-state {
    text-align: center;
    color: #999;
}

.dynamic-value-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.dynamic-statistics-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.dashboard-chart-panel {
    height: 430px;
}

.dashboard-chart-panel canvas {
    height: 350px !important;
}

.measurement-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.measurement-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.measurement-table th,
.measurement-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #2d2d2d;
    text-align: left;
    white-space: nowrap;
}

.measurement-table th {
    color: #777;
    font-weight: normal;
}

.measurement-table tr:last-child td {
    border-bottom: none;
}

.sensor-test-row {
    display: grid;
    grid-template-columns: 1.35fr 1.2fr .8fr 1.2fr;
    gap: 15px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #2d2d2d;
    font-size: 14px;
}

.sensor-test-row:last-child {
    border-bottom: none;
}

.sensor-test-row a,
.sensor-test-row a:visited {
    color: #33cc66;
    text-decoration: none;
}

.sensor-test-row a:hover {
    text-decoration: underline;
}

@media (max-width: 800px) {

    header .container {
        flex-direction: column;
        gap: 15px;
    }

    header nav {
        justify-content: center;
    }

    header nav a {
        margin: 5px 10px;
    }

    .value-grid,
    .statistics-grid,
    .chart-grid,
    .data-grid {
        grid-template-columns: 1fr;
    }

    .value-grid {
        display: flex;
        flex-direction: column;
    }

    .value {
        font-size: 28px;
    }

    .chart-panel {
        height: 340px;
    }

    .chart-panel canvas {
        height: 270px !important;
    }

    .data-list {
        max-height: 350px;
    }

    .sensor-test-row {
        grid-template-columns: 1fr 1fr;
    }

}


@media (max-width: 500px) {

    .dashboard-container,
    header .container {
        width: 92%;
    }

    header h1 {
        font-size: 25px;
    }

    header nav a {
        font-size: 14px;
        margin: 4px 7px;
    }

    .panel {
        padding: 25px;
    }

    .data-header,
    .data-row {
        gap: 8px;
        font-size: 12px;
    }

    .selected-sensor-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .sensor-card-grid,
    .sensor-test-row {
        grid-template-columns: 1fr;
    }

    .sensor-test-row {
        gap: 5px;
    }

}
