/* Box-Model */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
/*  Max-Breite festlegen */
.container {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 15px;
}
/* Typografie */
body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    line-height: 1.5;
    color: #222;
    background-color: #fafafa;
  }
/* Überschrift h1 */
h1 {
    font-size: 2rem;       
    font-weight: bold;    
    text-align: center;    
  } 
  /* Absatz */
p {
    font-size: 1rem;       
    line-height: 1.6;      
    text-align: left;     
  }
/* Farben & Abstände für Grund-Container */
header,
main,
footer {
  background-color: white;  
  padding: 1rem;              
} 
header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "nav logo search";
  align-items: center;
  background-color: #f5f5f5;
  padding: 1rem;
}

/* Navigation*/
nav { grid-area: nav; }
nav ul {
  display: flex;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: bold;
  text-transform: uppercase;
  color: #000;
  text-decoration: none;
}
.nav-link .icon {
  width: 24px;
  height: 24px;
  display: block;
}
.nav-link .icon { display: none; }
.nav-link .label { display: inline; }

/* Logo zentrieren */
header h1 {
  grid-area: logo;
  justify-self: center;
  margin: 0;
  display: inline-block;     /* Linie nur so breit wie der Text */
  border-bottom: 4px solid #000;  /* Dicke und Farbe der Unterstreichung */
  line-height: 1;            /* Zeilenhöhe = Textgröße, keine Extra-Lücke */
  padding-bottom: 0;         /* kein zusätzlicher Abstand */
}

/* Suche rechts */
.search-form {
  grid-area: search;
  display: flex;
  gap: 0.5rem;
}
.search-form input {
  padding: 0.5rem;
  border: 1px solid #ccc;
}
.search-form button {
  padding: 0.5rem 1rem;
  border: none;
  background-color: #000;
  color: #fff;
  cursor: pointer;
}
/* Link-Styling */
a:link,
a:visited {
  color: black;
  text-decoration: none;
}
a:hover,
a:active {
  text-decoration: underline;
}
/* Hero-Section 
.hero {
  background-color: #e0e0e0;
  padding: 2rem 1rem;
  text-align: center;
}
.hero img {
  max-width: 100%;
  max-height: 400px;
  height: auto;
}
.hero h2 {
  margin-top: 1rem;
  font-size: 1.75rem;
  text-transform: uppercase;
} */

/* Grid für Post-Vorschau */
.post-list {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr; /* Mobile-first: 1 Spalte */
}

.post-preview {
  background: #fff;
  border: 1px solid #ddd;
  padding: 1rem;     
}
.post-preview img {
  width: 100%;
  aspect-ratio: 210 / 297;        
  object-fit: cover;    
  display: block;
}
.post-preview h3 {
  margin: 0.5rem 0;
}
.post-preview a {
  text-decoration: none;
  color: #0077cc;
}
.post-preview a:hover {
  text-decoration: underline;
}

.paging-nav {
  text-align: center;
  margin: 2em 0 1em 0;
}

/* Paging*/
.paging-nav {
  text-align: center;
  margin: 2em 0 1em 0;
}


/* ===== Create-Formular ===== */
.form-section {
  max-width: 800px;
  margin: 2rem auto;
  background: #fff;
  padding: 1rem;
  border: 1px solid #ddd;
}
.post-form label {
  display: block;
  margin-top: 1rem;
  font-weight: bold;
}
.post-form input[type="text"],
.post-form input[type="file"],
.post-form textarea {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.5rem;
  border: 1px solid #ccc;
  font-family: inherit;
}
.post-form button {
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  background: #000;
  color: #fff;
  border: none;
  cursor: pointer;
}
.form-actions {
  display: flex;
  justify-content: flex-start;   /* oder center für Zentrierung */
  gap: 2rem;
  margin-top: 2em;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5em;
}

.action-btn {
  padding: 0.5rem 1rem;
  background: #000;
  color: white;
  text-decoration: none;
  font-weight: bold;
  border-radius: 2px;
}

/* roter Rahmen um das File-Input und rote Dateinamen-Anzeige */
/* Fehlerkasten */
div.fehler {
    color: red;
    border: 2px solid red;
    padding: 5px;
    margin-bottom: 8px;
}

/* Roter Rahmen, aber schwarze Schrift im Feld */
input.fehler,
textarea.fehler {
    border: 2px solid red;
    color: #000; /* Text im Feld bleibt schwarz */
}

/* Hinweis 5mb */
.hinweis {
    color: #555;
    font-size: 0.95em;
    margin-bottom: 10px;
}

/* ===== Detailseite: 2-Spalten-Layout mit vollständigem Bild ===== */
.post-detail-content.single-column {
  display: flex;
  flex-direction: column;
  align-items: center; /* zentriert Inhalt horizontal */
  gap: 1.5rem;
  background: #fff;
  border: 1px solid #ddd;
  padding: 2rem 1rem;
  max-width: 800px;
  margin: 0 auto; /* zentriert den Container */
}

.post-detail-content {
  display: grid;
  grid-template-columns: 1fr 2fr; /* Bild vs. Text */
  gap: 1.5rem;
  align-items: start;
  background: #fff;
  border: 1px solid #ddd;
  padding: 1.5rem;
}

/* Bild immer komplett sichtbar und proportional 
.post-image img {
  width: 100%;
  height: auto;        proportional skalieren 
  display: block; 
}*/
.post-image img {
  width: 100%;
  max-width: 600px;
  aspect-ratio: 210 / 297;
  object-fit: cover;
  display: block;
  min-height: 350px;
  border: 1px solid #ccc;
}

/* Textbereich */
.post-text h2 {
  font-size: 2rem;
  text-align: center;
  margin: 0;
}

.post-body {
  max-width: 700px;
  text-align: center;
}

.post-body p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

/* Aktionen */
.post-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.button.edit {
  padding: 0.5rem 1rem;
  background: #000;
  color: white;
  text-decoration: none;
  font-weight: bold;
  border-radius: 2px;
}
.button.delete {
  padding: 0.5rem 1rem;
  background: #c00;
  color: white;
  text-decoration: none;
  font-weight: bold;
  border-radius: 2px;
}


/* ===== Login-Seite ===== */
.login-section {
  max-width: 400px;           /* Schlanke Box in der Mitte */
  margin: 2rem auto;          /* Abstand oben/unten, zentriert */
  background: #fff;           
  padding: 1.5rem;            
  border: 1px solid #ddd;     
  border-radius: 4px;         /* Optional: sanfte Ecken */
}

.login-section h2 {
  margin: 0 0 1.5rem;
  font-size: 1.75rem;
  text-align: center;
}

.login-form label {
  display: block;
  margin-top: 1rem;
  font-weight: bold;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 2px;
  font-family: inherit;
  box-sizing: border-box;
}

.login-form button {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.75rem;
  background-color: #000;
  color: #fff;
  font-weight: bold;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.login-form button:hover {
  opacity: 0.85;
}

.login-footer {
  text-align: left;
  margin-top: 1.5rem;
}
.login-footer .button:hover {
  opacity: 0.85;
}

/* kein Horizontales scrollen */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

/* Responsive */

@media (max-width: 500px) {
  header {
    grid-template-columns: 1fr;
    grid-template-areas:
      "logo"
      "nav"
      "search";
    row-gap: 0.5rem;
    padding: 0.5rem;
    text-align: center;
  }
  nav ul {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  .search-form {
    justify-content: center;
    width: 100%;
  }
  .search-form input {
    width: 60vw;
    max-width: 130px;
    min-width: 60px;
  }
  .search-form button {
    width: auto;
    font-size: 1rem;
    padding: 0.4rem 0.6rem;
    min-width: 60px;
  }
  header h1 {
    font-size: 1.2rem;
    padding: 0.1rem 0;
  }
}

@media (min-width: 512px) {
  .post-list {
    grid-template-columns: repeat(2, 1fr);
  }
}


@media (min-width: 768px) {
  .post-list {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 1024px) {
  .post-list {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 768px) {
  .nav-link .label {
    display: none;
  }
  .nav-link .icon {
    display: block;
    width: 32px; height: 32px;
  }
  /* Suche kleiner machen, damit alles reinpasst */
  .search-form input {
    width: 100px;
  }
}

/* Mobile: 1-Spalten-Layout */
@media (max-width: 768px) {
  .post-detail-content {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .container {
    padding: 0 5px;
  }
  .post-preview {
    padding: 0.5rem;
  }
}

