/* Globale Resets und Box-Sizing */
* {
    box-sizing: border-box;
}

/* Allgemeine Body-Einstellungen */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #fdfdfd;
    color: #333;
    padding-top: 60px; /* Genug Platz für den Sticky Header */
}

/* Wrapper für zentrierte Inhalte (z.B. Startseite, Upload-Seite) */
.page-wrapper.center-content,
.upload-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 60px); /* Höhe angepasst wegen Header */
    padding: 1rem;
    background-color: #f9f9f9;
}

/* Anpassung für .page-wrapper ohne .center-content (also für Galerie) */
/* Damit es sich nicht wie ein flex-Container verhält, der den Inhalt zentriert */
.page-wrapper:not(.center-content) {
    display: block; /* Entfernt die flexbox-Eigenschaften */
    min-height: auto; /* Deaktiviert die min-height auf 100vh */
    padding: 0; /* Setzt Padding zurück, da es der gallery-box zugewiesen wird */
}

/* Standard-Box-Stil für schmale, zentrierte Inhalte (Startseite, Upload-Seite) */
.page-box, .upload-box {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* Neue Klasse für die Galerie-Seite, um volle Breite zu nutzen */
.gallery-box {
    background: white;
    padding: 10px;
    border-radius: 10px;
    width: 94%; /* Nutzt 94% der Breite des Elternelements */
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    margin: 20px auto; /* Zentrieren und etwas Abstand vom Header */
    padding-bottom: 80px; /* Platz für den späteren "Nachladen"-Button */
}

/* Überschriften-Stile */
h1, h2 {
    color: #7a1f31;
    margin-top: 0;
}

/* Button-Stile */
button,
input[type="submit"],
.btn {
    background-color: #7a1f31;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    margin: 10px auto;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

button:hover,
input[type="submit"]:hover,
.btn:hover {
    background-color: #5a141d;
}

/* Button-Gruppen-Stil */
.button-group {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Dateiupload-Feld */
input[type="file"] {
    margin: 20px 0;
    font-size: 1rem;
}

/* Nachrichten-Stil (z.B. Upload-Bestätigung) */
.message {
    margin-top: 1rem;
    font-weight: bold;
    color: #7a1f31;
}

/* Grid-Layout für die Galerie (ursprüngliches Raster-Layout) */
.grid {
    display: grid;
    /* Spalten passen sich automatisch an, mindestens 150px breit, füllen den verfügbaren Platz */
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px; /* Abstand zwischen den Grid-Elementen */
    padding: 10px; /* Padding innerhalb des Grids */
    max-width: 100%;
    margin: 0 auto;
}

/* Stil für Zeit-Gruppen-Header im Grid */
.time-group-header {
    grid-column: 1 / -1; /* Macht, dass der Header alle Spalten überspannt */
    
    /* Farbliche Invertierung */
    background-color: #7a1f31; /* Roter Hintergrund */
    color: white; /* Weiße Schrift */

    padding: 15px 20px;
    margin-bottom: 10px;
    
    /* Vertikale und horizontale Zentrierung mit Flexbox */
    display: flex;
    align-items: center;   /* Vertikal zentrieren */
    justify-content: center; /* Horizontal zentrieren */
    
    font-size: 1.2rem;
    font-weight: bold;
    border-bottom: 1px solid #ccc; /* Kann nach Wunsch angepasst oder entfernt werden */
    border-radius: 5px; /* Leichte Abrundung für den Header-Kasten */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); /* Sehr dezenter Schatten */
}

.time-group-header h2 {
    margin: 0; /* Entfernt Standard-Margin von h2 */
    color: inherit; /* Erbt die Farbe vom übergeordneten Div (jetzt weiß) */
    font-size: 1.2rem; /* Stellt sicher, dass die h2-Größe mit dem Eltern-Div übereinstimmt */
}


/* Stil für die Links (Container der Bilder), um sie quadratisch zu machen */
.grid a {
    display: block;
    text-decoration: none;
    line-height: normal;
    border: none;
    margin: 0;
    aspect-ratio: 1 / 1; /* NEU: Macht den Link-Container (und damit die Zelle) quadratisch */
    padding: 0; /* Stellt sicher, dass kein zusätzliches Padding den quadratischen Bereich verändert */
}

/* Stil für Bilder im Grid */
.grid img {
    width: 100%; /* Bilder füllen die Breite ihrer quadratischen Grid-Zelle aus */
    height: 100%; /* NEU: Bilder füllen die Höhe ihrer quadratischen Grid-Zelle aus */
    object-fit: cover; /* Stellt sicher, dass das Bild den Bereich ausfüllt, auch wenn es zugeschnitten wird */
    border: 1px solid #ccc; /* Rahmen */
    display: block; /* Entfernt zusätzlichen Platz unter dem Bild */
    padding: 3px; /* NEU: 3px Padding INSIDE des Bilderrahmens */
}

/* Allgemeine Link-Stile (unabhängig vom Grid) */
a {
    display: inline-block;
    margin: 0px auto;
    color: #7a1f31;
    text-decoration: none;
    font-weight: normal;
    padding: 10px;
    border: 1px solid #e4d2d6;
    line-height: 15px;
}

/* Stile für Material Symbols Icons */
.material-symbols-outlined {
    font-size: 14px !important;
}

/* Fortschrittsanzeige (z.B. für Uploads) */
progress {
    height: 20px;
    width: 100%;
    appearance: none;
}
progress::-webkit-progress-bar {
    background-color: #eee;
    border-radius: 5px;
}
progress::-webkit-progress-value {
    background-color: #7a1f31;
    border-radius: 5px;
}
progress::-moz-progress-bar {
    background-color: #7a1f31;
    border-radius: 5px;
}

/* Sticky Header */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 10px 20px;
    z-index: 1000;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.main-header nav {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

.header-btn {
    margin: 0;
    padding: 8px 15px;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background-color: #7a1f31;
    color: white;
}

.header-btn .material-symbols-outlined {
    font-size: 18px !important;
}

/* Zusätzlicher Stil für den Zurück-Button in der Galerie */
.gallery-back-btn {
    margin-top: 30px;
    margin-bottom: 20px;
}