/* --- BASIS UND TYPOGRAPHIE --- */
body {
    font-family: 'Inter', sans-serif;
    color: #333;
    background-color: #f4f7f6;
    margin: 0;
    padding: 20px;
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.6;
}

h1 {
    text-align: center;
    color: #007bff;
    margin-bottom: 25px;
    font-weight: 800;
    font-size: 2.5em;
}

h2 {
    color: #1a1a1a;
    font-size: 1.5em;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
    margin-top: 0;
    margin-bottom: 15px;
}

h3 {
    color: #007bff;
    font-size: 1.1em;
    margin-top: 20px;
    margin-bottom: 10px;
}

/* --- GRID LAYOUT --- */
.main-grid {
    display: grid;
    gap: 20px; /* Standard-Abstand zwischen den Blöcken */
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* 3-spaltiges Layout für Desktop */
.three-col-layout {
    grid-template-columns: 2fr 1fr; /* Zwei Spalten: Sensordaten (2/3) + Wetter (1/3) */
    /* Original-Rows, die sich an der linken Spalte orientieren */
    grid-template-rows: auto auto auto; 
    /* Originale Grid-Areas */
    grid-template-areas: 
        "grid-area-sensors grid-area-current"
        "grid-area-sensors grid-area-forecast"
        "grid-area-longterm grid-area-longterm"
        "grid-area-webcams grid-area-webcams";
}

/* --- DATEN CONTAINER STYLING --- */
.data-container {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 0; /* Das Grid managed den Abstand */
}

/* WICHTIGE KORREKTUR FÜR DIE LANGZEITGRAPHEN BOX */
.grid-area-longterm { 
    grid-area: grid-area-longterm; 
    /* Verhindert horizontales Überlaufen des Inhalts (falls das Bild zu breit ist) */
    overflow-x: hidden; 
}


.grid-area-sensors { grid-area: grid-area-sensors; }
.grid-area-current { 
    grid-area: grid-area-current; 
    /* Stellt sicher, dass die Box nicht unnötig gestreckt wird */
    align-self: start; 
}
.grid-area-forecast { 
    grid-area: grid-area-forecast; 
    /* Stellt sicher, dass die Box nicht unnötig gestreckt wird */
    align-self: start;
}

.grid-area-webcams { grid-area: grid-area-webcams; }

/* --- SPEZIFISCHE INHALTS-STYLING --- */
.summary-section .data-point {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    font-size: 1.1em;
    padding-bottom: 3px;
    border-bottom: 1px dotted #eee;
}

/* Der Bereich der vergrößerten Werte */
.summary-section strong {
    font-weight: 700;
}

/* WICHTIGE KORREKTUR FÜR GRAPHEN: Beseitigt das Überlaufen aus der Box */
.graph-section img {
    /* Stellt sicher, dass die Breite auf den Inhalt passt und nicht über das Elternelement-Padding hinausragt */
    width: 100%; 
    max-width: 100%; 
    height: auto;
    
    /* NEU: Wichtig. Entfernt jeglichen horizontalen Margin, der zum Überlaufen führen könnte. */
    margin-left: 0;
    margin-right: 0;
    /* Der vertikale Margin wird beibehalten oder unten neu gesetzt */
    margin-bottom: 15px; 
    margin-top: 0; 
    
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.graph-section img:hover {
    opacity: 0.9;
}

.current-weather-box {
    text-align: center;
}

.current-weather-icon {
    width: 100px;
    height: 100px;
    margin: 10px 0;
}

/* FORECAST GRID - Ein einfaches flexibles Layout für die Tagesvorschau */
.forecast-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.day-forecast-box {
    flex-grow: 1;
    min-width: 150px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    background-color: #fcfcfc;
}

.day-forecast-box h3 {
    margin-top: 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.hourly-details p {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    margin: 3px 0;
}

.day-icon {
    width: 25px;
    height: 25px;
    margin: 0 5px;
}

/* --- STEUERELEMENTE / BUTTONS --- */
.controls {
    text-align: center;
    margin-bottom: 20px;
}

.toggle-button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 15px;
    margin: 0 5px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.toggle-button:hover {
    background-color: #218838;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* --- MODAL (ZOOM) STYLING --- */
.modal {
    display: none; /* Versteckt das Modal standardmäßig */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9); /* Schwarzer Hintergrund mit Transparenz */
    align-items: center;
    justify-content: center;
}

.modal-content {
    margin: auto;
    display: block;
    width: 100%; /* Volle Breite des Modals */
    max-width: 100%; /* Keine maximale Breite, nutzt den Platz aus */
    padding: 20px; /* Optional: Etwas Polsterung zum Rand */
}

.modal-image {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%; /* Das Bild selbst darf nicht über den Container hinaus */
}

.close-button {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* --- DARK MODE STYLING --- */
body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode h1 {
    color: #4da6ff;
}

body.dark-mode h2 {
    color: #f4f7f6;
    border-bottom-color: #333;
}

body.dark-mode h3 {
    color: #4da6ff;
}

body.dark-mode .data-container {
    background-color: #2b2b2b;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

body.dark-mode .summary-section .data-point {
    border-bottom: 1px dotted #444;
}

body.dark-mode .day-forecast-box {
    border: 1px solid #333;
    background-color: #383838;
}

/* Blink Effekt für hohe Luftfeuchtigkeit */
.blink {
    animation: blink-animation 1s steps(5, start) infinite;
}

@keyframes blink-animation {
    to {
        visibility: hidden;
    }
}


/* --- COMPACT VIEW STYLING (Die Lösung für "nicht das gelbe vom Ei") --- */

body.compact-view .main-grid {
    gap: 10px; /* Reduziere den Abstand zwischen den Boxen */
}

body.compact-view .data-container {
    padding: 12px; /* Reduziere den Innenabstand der Boxen */
}

body.compact-view h2 {
    font-size: 1.3em; /* Mache die Haupttitel kleiner */
    padding-bottom: 5px;
    margin-bottom: 10px;
}

body.compact-view h3 {
    font-size: 1em; /* Mache die Untertitel kleiner */
    margin-top: 10px;
    margin-bottom: 5px;
}

/* Reduziere den Abstand in der Datentabelle */
body.compact-view .summary-section .data-point {
    font-size: 0.9em;
    margin: 2px 0;
}

/* Die großen Werte sollen auch im Compact View gut lesbar bleiben, daher nur leicht reduzieren */
body.compact-view .summary-section span[style*="font-size: 2.5em"] {
    font-size: 2em !important; 
}

/* Reduziere den Abstand unter den Graphen */
body.compact-view .graph-section p {
    margin: 5px 0;
    font-size: 0.85em;
}

/* Reduziere den Abstand und die Größe in der Vorhersage */
body.compact-view .day-forecast-box {
    padding: 8px;
}

body.compact-view .hourly-details p {
    font-size: 0.8em;
}


/* --- RESPONSIVENESS: Mobile Ansicht (unter 768px) --- */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .main-grid {
        /* Mobile: Alle Spalten untereinander */
        grid-template-columns: 1fr;
        grid-template-areas: 
            "grid-area-current"
            "grid-area-forecast"
            "grid-area-sensors"
            "grid-area-longterm"
            "grid-area-webcams";
    }

    h1 {
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.3em;
    }

    /* Im Compact View auf Mobile noch enger */
    body.compact-view .data-container {
        padding: 8px;
    }
}
