:root {
    --primary-color: #007BFF;
    --hover-color: #0056b3;
    --bg-color: #f8f9fa;
    --text-color: #333;
    --card-bg: #ffffff;
    --border-color: #ddd;
    --accent-color: #28a745;
    --success-color: #28a745;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;
}

/* Navigation */
.nav-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 1rem;
    background-color: var(--card-bg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-button {
    padding: 8px 16px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-button:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

/* Zentriert die Login-Karte, wenn man auf der Login-Seite ist */
.login-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;

    /* Diese Zeilen sorgen für die Zentrierung ohne den Body zu sprengen: */
    margin: 10vh auto;
}



.error-msg {
    color: #dc3545;
    background: #f8d7da;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.main-content {
    max-width: 1200px; /* Erhöht für zwei Graphen nebeneinander */
    margin: 2rem auto;
    padding: 0 1rem;

}


.welcome-section {
    margin-bottom: 3rem;
}

h1, h2, h3 {
    text-align: center;
    color: #2c3e50;
}

.subtitle {
    font-size: 1.2rem;
    color: #666;
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 2rem;
}

.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-bottom: 4px solid var(--primary-color);
}



.card h3 {
    margin: 10px 0;
    color: var(--primary-color);
}

.card p {
    font-size: 0.95rem;
    color: #777;
}

.highlight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 2rem;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-align: center;
    border-bottom: 4px solid var(--primary-color);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chart-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-box {
    flex: 1;
    background: white;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #eee;

    /* Ändere 450px auf einen kleineren Wert, z.B. 350px oder 400px */
    height: 550px;

    min-width: 0;
}
/* Card Style für das Formular */
.form-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    text-align: left;
    margin-bottom: 1.5rem;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.2);
}

.full-width {
    grid-column: span 2;
}

label {
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: #555;
}

input, select, textarea {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.2);
}
button[type="submit"] {
    grid-column: span 2;
    background-color: var(--primary-color);
    color: white;
    padding: 12px;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}


button[type="submit"]:hover {
    background-color: var(--hover-color);
}

/* Tabelle Styling */
.table-container {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* Spezifisch für den CSV-Bereich, damit der Button daneben bleibt */
.import-section {
    display: flex;
    flex-wrap: wrap; /* Erlaubt Umbruch auf sehr kleinen Handys */
    gap: 10px;
    align-items: center;
}

/* Verhindert, dass der Import-Button auf 100% Breite springt */
.import-section button {
    width: auto !important;
    padding: 8px 15px;
    margin: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: #f1f3f5;
    color: #495057;
    font-weight: 600;
    text-align: left;
    padding: 15px;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

tr:hover {
    background-color: #f8f9fa;
}

.empty-msg {
    text-align: center;
    color: #888;
    font-style: italic;
}


/* Liste der Beobachtungen */
.observation-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}


button:hover { background-color: #0056b3; }

.back-link {
    display: inline-block;
    margin-top: 1.5rem;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

button {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s;
}



button[type="submit"]:hover {
    background-color: var(--hover-color);
}


.observation-item {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 5px solid var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

button[type="delete"] {
    background-color: #dc3545; /* Kräftiges Rot */
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

button[type="delete"]:hover {
    background-color: #c82333; /* Dunkleres Rot beim Drüberfahren */
}

/* Sicherstellen, dass die Meta-Zeile den Button richtig ausrichtet */
.observation-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}


.observation-text {
    white-space: pre-wrap;
    color: #333;
}

.empty-msg {
    text-align: center;
    color: #888;
    padding: 2rem;
    background: #eee;
    border-radius: 8px;
}
.image-gallery {
    display: flex;
    flex-wrap: wrap; /* Erlaubt Zeilenumbruch auf kleinen Bildschirmen */
    gap: 12px;       /* Abstand zwischen den Bildern */
    margin-top: 15px;
}

/* Einzelner Bilder-Rahmen */
.image-container {
    width: 150px;
    height: 150px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    cursor: pointer;
}

.image-container:hover {
    transform: scale(1.05); /* Kleiner Zoom-Effekt beim Drüberfahren */
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Schneidet das Bild quadratisch zu, ohne es zu verzerren */
}

.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    height: auto;
    overflow: hidden;
}

/* Legend Kasten spezifisch */
.legend-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 10px auto 25px auto; /* 10px nach oben zum H2, 25px nach unten zum Chart */
    padding: 12px;
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 8px;
    max-width: fit-content;
}

/* Handy & Tablet: Richtig flach */
@media (max-width: 780px) {

    .main-content {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }

    .chart-row {
        flex-direction: column;
        display: block;
        gap: 10px;
    }

    .chart-box {
        height: 250px; /* Schön kompakt für mobiles Scrollen */
        padding: 5px;
    }

    .container {
        margin: 10px auto;
        padding: 10px;
    }



    .full-width {
        grid-column: span 1; /* Elemente nehmen die volle Breite der einen Spalte ein */
    }

    button[type="submit"] {
        grid-column: span 1;
        width: 100%;
    }

    .nav-container {
        flex-wrap: wrap; /* Navigation bricht um, wenn Platz fehlt */
        gap: 5px;
        padding: 0.5rem;
    }

    .nav-button {
        padding: 6px 10px;
        font-size: 0.9rem;
        flex: 1 1 auto; /* Buttons füllen den Platz gleichmäßig aus */
        text-align: center;
    }

    .observation-meta {
        flex-direction: column; /* Datum und Löschbutton untereinander auf ganz kleinen Handys */
        align-items: flex-start;
        gap: 10px;
    }

    button[type="delete"] {
        align-self: flex-end; /* Löschbutton bleibt rechts unten in der Meta-Zeile */
    }

    .subtitle {
        font-size: 1rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr; /* Kacheln untereinander stapeln */
        gap: 15px;
    }

    .card {
        padding: 1.5rem; /* Etwas kompakter */
    }

    /* Formular auf eine Spalte umstellen */
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group, .full-width, button[type="submit"] {
        grid-column: span 1;
    }

    /* TABELLEN-TRICK: Zeilen zu Karten umwandeln */
    .table-container {
        background: transparent;
        box-shadow: none;
    }

    table, thead, tbody, th, td, tr {
        display: block; /* Alle Tabellenelemente untereinander */
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        background: var(--card-bg);
        margin-bottom: 15px;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        padding: 10px;
        border: 1px solid var(--border-color);
    }

    td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50% !important; /* Platz für das Label links */
        text-align: right;
        min-height: 35px;
    }

    td:last-child {
        border-bottom: none;
        text-align: center;
        padding-left: 15px !important;
    }

    /* Hier fügen wir die Label-Namen für das Handy ein */
    td:before {
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
        text-align: left;
    }

    /* Beschriftungen der "Karten-Felder" */
    td:nth-of-type(1):before { content: "Datum"; }
    td:nth-of-type(2):before { content: "Konzentration"; }
    td:nth-of-type(3):before { content: "Probe"; }
    td:nth-of-type(4):before { content: "Nr."; }
    td:nth-of-type(5):before { content: "Durchlauf"; }
    td:nth-of-type(6):before { content: "Max"; }
    td:nth-of-type(7):before { content: "Min"; }
    td:nth-of-type(8):before { content: "Avg"; }

    h2 { font-size: 1.1rem; margin-bottom: 10px; }
    h3 { font-size: 0.9rem; margin-bottom: 5px; }
}
