/* ========= Core / Design System ========= */
:root {
    color-scheme: dark;
    --hl: #cc3300;          /* Primary Highlight (beibehalten) */
    --hl-soft: rgba(204, 51, 0, 0.08);
    --bg: #0f172a;          /* dunkler Hintergrund für mehr Kontrast */
    --surface: #0b1120;     /* Karten-/Header-Hintergrund */
    --surface-alt: #020617;
    --fg: #e5e7eb;          /* Haupttext */
    --fg-muted: #9ca3af;    /* sekundärer Text */
    --bd: rgba(148, 163, 184, 0.4);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-pill: 999px;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.55);
    --shadow-subtle: 0 10px 30px rgba(15, 23, 42, 0.4);
    --transition-fast: 0.15s ease-out;
    --transition-med: 0.25s ease;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: radial-gradient(circle at top, #1e293b 0, #020617 45%, #020617 100%);
    color: var(--fg);
    -webkit-font-smoothing: antialiased;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: cover;
}

/* ========= Layout ========= */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 16px clamp(16px, 3vw, 32px) 32px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

/* Grid: Karten / Panels – auto-fit für Responsiveness */
.grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    align-items: stretch;
}

/* ========= Header / Nav ========= */
header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(18px);
    background: linear-gradient(to right, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.9));
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.65);
    padding: 10px clamp(16px, 3vw, 32px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    font-weight: 800;
    font-size: clamp(1.15rem, 2.2vw, 1.4rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hl);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.brand::before {
    content: "";
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 20%, #fee2e2 0, #fb923c 35%, #b91c1c 100%);
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.2),
        0 16px 40px rgba(0, 0, 0, 0.7);
}

/* Nav: Links modern, pill-hover */
nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

nav a {
    position: relative;
    padding: 7px 14px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--fg-muted);
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

nav a:last-child {
    margin-right: 0;
}

nav a::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at top, rgba(248, 250, 252, 0.2), transparent 55%);
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
}

nav a:hover,
nav a:focus-visible {
    background: rgba(15, 23, 42, 0.9);
    color: #f9fafb;
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.6);
}

nav a:hover::after,
nav a:focus-visible::after {
    opacity: 1;
}

/* ========= Login Layout ========= */
/* Falls body die Klasse "login" bekommt, zentriere den Inhalt */
.login main.container {
    max-width: 420px;
    margin-inline: auto;
}

/* .login kann Body oder Wrapper sein – flexibel halten */
.login {


    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    background: radial-gradient(circle at top, #1e293b 0, #020617 55%, #000 100%);
    margin-left: auto;
    margin-right: auto;
}

/* Footer */
footer div {
    text-align: center;
    padding: 20px 16px 32px;
    font-size: 0.8rem;
    color: var(--fg-muted);
}

/* Sprach-Item – typischer kleiner Link/Button */
.langitm {
    margin-right: 0;
    font-size: 0.85rem;
    opacity: 0.8;
}

/* ========= Cards / Panels ========= */
.card,
.panel {
    position: relative;
    background: radial-gradient(circle at top left, rgba(248, 250, 252, 0.12), transparent 60%),
        linear-gradient(to bottom right, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.98));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: var(--shadow-soft);
    padding: 20px 18px;
    overflow: hidden;
    transition: transform var(--transition-med), box-shadow var(--transition-med), border-color var(--transition-med), background var(--transition-med);
}

.card::before,
.panel::before {
    content: "";
    position: absolute;
    inset: -30%;
    background:
        radial-gradient(circle at 0 0, rgba(248, 113, 113, 0.08), transparent 55%),
        radial-gradient(circle at 100% 0, rgba(251, 191, 36, 0.08), transparent 55%);
    opacity: 0;
    transition: opacity var(--transition-med);
    pointer-events: none;
}

.card--link:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.9);
    border-color: rgba(248, 113, 113, 0.6);
    cursor:pointer;
}

.card--link:hover::before {
    opacity: 1;
}

.card--link:hover .btn{
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 24px 55px rgba(248, 113, 113, 0.75);
    filter: brightness(1.03);
    background-position: 100% 0;
}

.card h2 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #f9fafb;
}

.card p {
    margin: 6px 0;
    color: var(--fg-muted);
    font-size: 0.92rem;
    line-height: 1.5;
    min-height:70px;
}

.card .btn{
    width:100%;
}

.card--link {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.card--link .btn--inline {
  pointer-events: none;
}

/* Login-Panel spezifisch */
.login .panel {
    width: 100%;
    max-width: 420px;
    padding: 28px 22px 24px;
}

/* ========= Buttons ========= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, #f97316, #b91c1c);
    color: #f9fafb;
    padding: 11px 20px;
    border-radius: var(--radius-pill);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    box-shadow: 0 18px 40px rgba(248, 113, 113, 0.55);
    transition: transform var(--transition-fast),
        box-shadow var(--transition-fast),
        filter var(--transition-fast),
        background-position 0.25s ease-out;
    background-size: 150% 150%;
}

.btn:hover,
.btn:focus-visible {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 24px 55px rgba(248, 113, 113, 0.75);
    filter: brightness(1.03);
    background-position: 100% 0;
}

.btn:active {
    transform: translateY(0) scale(0.99);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.9);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    filter: grayscale(0.1);
}

/* Ghost / Secondary Button */
.btn--ghost {
    background: rgba(15, 23, 42, 0.75);
    color: #e5e7eb;
    border: 1px solid rgba(148, 163, 184, 0.7);
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.8);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(248, 250, 252, 0.7);
}

/* ========= Forms ========= */
.form {
    width: 100%;
    max-width: 520px;
}

/* Labels & Hilfetexte */
label {
    display: block;
    font-size: 0.86rem;
    margin: 14px 0 6px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #e5e7eb;
}

/* Inputs, Selects, Textareas */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 11px 13px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.95);
    color: #e5e7eb;
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background var(--transition-fast),
        transform var(--transition-fast);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.95);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="number"]::placeholder,
textarea::placeholder {
    color: rgba(148, 163, 184, 0.85);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: rgba(248, 113, 113, 0.9);
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.6), 0 20px 40px rgba(15, 23, 42, 1);
    background: rgba(15, 23, 42, 0.98);
    transform: translateY(-1px);
}


/* Speziell für Date-Input */
input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    padding-right: 40px; /* Platz rechts für Icon */
}

/* Inhalt (Jahr-Monat-Tag) im Darkmode */
input[type="date"]::-webkit-datetime-edit {
    color: #e5e7eb;
}

input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    background: transparent;
}

input[type="date"]::-webkit-datetime-edit-year-field,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field {
    color: #e5e7eb;
}

/* Standard-Icon "unsichtbar" machen, aber anklickbar lassen, falls JS mal nicht läuft */
input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0;
    width: 24px;
    padding: 0;
    margin: 0;
}

/* Optional: Kalendersymbol als Background-Icon rechts */
input[type="date"] {
    background-image:
        radial-gradient(circle at 0 0, rgba(248, 250, 252, 0.06), transparent 55%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%23f97316' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='3' y='4' width='18' height='18' rx='3' ry='3'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: auto, 18px;
}

/* Kleinere Texte */
.help {
    font-size: 0.78rem;
    color: var(--fg-muted);
    margin-top: 5px;
}

.error {
    color: #fecaca;
    background: rgba(127, 29, 29, 0.55);
    border-radius: 10px;
    padding: 8px 10px;
    margin-top: 10px;
    font-size: 0.85rem;
    border: 1px solid rgba(248, 113, 113, 0.7);
}

.small {
    color: var(--fg-muted);
    font-size: 0.8rem;
}

/* ========= Tables ========= */
.table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: linear-gradient(to bottom right, #020617, #020617);
    border: 1px solid rgba(148, 163, 184, 0.55);
    box-shadow: var(--shadow-subtle);
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(31, 41, 55, 0.85);
    text-align: left;
    white-space: nowrap;
}

.table th {
    background: linear-gradient(to right, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.98));
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    color: #e5e7eb;
    border-bottom-color: rgba(148, 163, 184, 0.8);
}

.table tr:nth-child(even) td {
    background: rgba(15, 23, 42, 0.6);
}

.table tr:nth-child(odd) td {
    background: rgba(15, 23, 42, 0.85);
}

.table tr:hover td {
    background: rgba(15, 23, 42, 1);
}

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

tr.row-click {
    cursor: pointer;
    transition: background 0.15s ease, filter 0.15s ease;
}

tr.row-click:hover {
    background: rgba(255, 255, 255, 0.06); /* bei Dark Theme */
    filter: brightness(1.12);
}


/* ========= Responsiveness ========= */

/* Mobile-First ist bereits Standard – hier Feintuning */

/* <= 768px: Smartphone */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    nav {
        width: 100%;
        justify-content: flex-start;
        row-gap: 6px;
    }

    .container {
        padding-inline: 14px;
    }

    .card,
    .panel {
        padding: 18px 14px;
    }

    .form {
        max-width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .login {
        padding: 24px 14px;
    }

    .login .panel {
        padding-inline: 16px;
    }
}

/* 769px – 1199px: Tablet / kleiner Desktop */
@media (min-width: 769px) and (max-width: 1199px) {
    .container {
        max-width: 960px;
    }
}

/* >= 1200px: Widescreen Desktop */
@media (min-width: 1200px) {
    .container {
        max-width: 1180px;
    }

    .card,
    .panel {
        padding: 24px 22px;
    }
}




/****EDIT***/

/* ==== Main / Page Layout für Detail-Ansichten (Incubator Edit) ==== */

main {
  padding: 24px clamp(16px, 4vw, 32px) 40px;
}

/* Überschrift + Subline */
main > h1 {
  margin: 0 0 6px;
  font-size: clamp(1.4rem, 2.4vw, 1.8rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f9fafb;
}

main > p.small {
  margin: 0 0 20px;
  max-width: 520px;
}

/* Trennlinien etwas „glowig“ */
main hr {
  border: none;
  height: 1px;
  margin: 28px 0 22px;
  background: linear-gradient(to right,
    rgba(148, 163, 184, 0.0),
    rgba(248, 113, 113, 0.6),
    rgba(148, 163, 184, 0.0)
  );
  opacity: 0.9;
}

/* Sekundäre Überschriften (z.B. Device, Measurements) */
main h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #e5e7eb;
}

/* Kleine Texte in diesem Kontext */
main .small {
  margin-bottom: 10px;
  line-height: 1.5;
}

/* ==== Formular-Layout auf dieser Seite ==== */

/* Allgemeiner Wrapper pro Feldgruppe */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

/* Checkbox-Row (Label mit Checkbox drin) */
.form-row input[type="checkbox"] {
  accent-color: var(--hl);
  width: 16px;
  height: 16px;
  margin-right: 8px;
}

/* Label neben Checkbox nicht in Kapitälchen erzwingen */
.form-row > label > input[type="checkbox"] + span,
.form-row > label > input[type="checkbox"] + * {
  text-transform: none;
  letter-spacing: normal;
}

/* Actions unten im Formular */
.form-row:last-of-type {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

/* Save / Cancel nebeneinander, mobil untereinander */
@media (max-width: 640px) {
  .form-row:last-of-type {
    flex-direction: column;
  }

  .form-row:last-of-type .btn,
  .form-row:last-of-type .btn.btn--ghost {
    width: 100%;
    justify-content: center;
  }
}

/* Datums-Filter-Form minimal anders abgesetzt */
form[method="get"].form {
  background: radial-gradient(circle at top left, rgba(148, 163, 184, 0.12), transparent 60%),
              linear-gradient(to bottom right, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.98));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow: var(--shadow-subtle);
  padding: 16px 16px 12px;
  margin-top: 10px;
}

/* Datumsfelder kompakter */
form[method="get"].form .form-row {
  margin-bottom: 10px;
}

/* ==== Chart-Bereich ==== */

/* Canvas wie Card aussehen lassen */
#measureChart {
  display: block;
  width: 100% !important;
  max-width: 100%;
  margin: 10px 0 24px;
  background: radial-gradient(circle at top left, rgba(248, 250, 252, 0.05), transparent 60%),
              linear-gradient(to bottom right, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 1));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(148, 163, 184, 0.45);
}

/* Kein eigenes padding, Chart.js nutzt die komplette Fläche sauber */

/* Info-Text "No measurements..." etwas luftiger */
main p.small:last-child {
  margin-top: 8px;
  max-width: 520px;
}


/* ============================================================
   Measurement Info Card (rechte Seite)
   ============================================================ */



/* Card für letzte Messung vertikal layouten */
.card--last-measurement {
    display: flex;
    flex-direction: column;
}

/* Bereich unter der Überschrift füllt den Rest der Card und
   zentriert die Messwerte vertikal im verfügbaren Platz */
.card--last-measurement .metric-wrap {
    margin-top: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;   /* Werte + Zeit eher mittig statt ganz oben */
}

/* Grid für Temp / Luftfeuchte */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 10px;
    align-items: flex-end;
}

.metric-item { min-width: 0; }

.metric-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-muted);
    margin-bottom: 4px;
}

.metric-value-big {
    font-size: clamp(3.2rem, 3.1vw, 3.8rem);
    font-weight: 700;
    color: #f9fafb;
    line-height: 1.1;
    white-space: nowrap;
}

.metric-unit {
    font-size: 2.5rem;
    margin-left: 4px;
    color: var(--fg-muted);
}

.metric-time.small {
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--fg-muted);
}

.metric-time.small span {
    font-weight: 600;
    color: #f9fafb;
}

/* Mobile: Temp / LF untereinander */
@media (max-width: 640px) {
    .metric-grid {
        grid-template-columns: 1fr;
    }
}


/* Sprachumschalter Container */
.lang-switcher {
    position: relative;
    display: inline-block;
    margin-left: 20px;
}

/* Aktuelle Sprache (Button) */
.lang-current {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}

/* Flaggen allgemein */
.lang-switcher img,
.lang-single img {
    width: 24px;
    height: 16px;
    display: block;
    border-radius: 2px;
}

/* Dropdown-Liste */
.lang-menu {
    position: absolute;
    top: 100%;
    right: 0;
 
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 4px;
    min-width: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    padding: 4px;
    display: none;
    z-index: 1000;
}

/* Einträge im Dropdown */
.lang-option {
    display: block;
    padding: 4px;
    text-decoration: none;
}

.lang-option img {
    width: 24px;
    height: 16px;
}

/* Hover-Effekt (falls du später Text hinzufügst) */
.lang-option:hover {
   /* background: #f2f2f2;*/
}

/* Dropdown per Hover öffnen (für Schnelllösung ohne JS) */
.lang-switcher:hover .lang-menu {
    display: block;
}

/* Single Flag (keine Auswahl nötig) */
.lang-single {
    display: inline-block;
    margin-left: 20px;
}
