/* =============================================================
   Siedlergemeinschaft Hirschknock – Admin-Backend Stylesheet
   ============================================================= */

:root {
  --green:       #408000;
  --green-dark:  #2d5a00;
  --green-light: #eaf3d8;
  --text:        #272726;
  --text-muted:  #666;
  --border:      #e0ddd5;
  --bg:          #f4f5f7;
  --white:       #ffffff;
  --danger:      #c0392b;
  --warning:     #e67e22;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow:      0 2px 8px rgba(0,0,0,.10);
  --radius:      6px;
  --sidebar-w:   240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }
ul, ol { padding-left: 1.25rem; }

/* === Admin-Layout ========================================== */
.admin-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--green-dark);
  color: rgba(255,255,255,.88);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand img {
  height: 40px;
  filter: brightness(0) invert(1);
  opacity: .85;
  margin-bottom: .5rem;
}
.sidebar-brand-name { font-size: .82rem; color: rgba(255,255,255,.7); line-height: 1.3; }

.sidebar-nav { padding: .75rem 0; flex: 1; }
.sidebar-section {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.4);
  padding: .9rem 1.25rem .3rem;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem 1.25rem;
  color: rgba(255,255,255,.78);
  font-size: .88rem;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  text-decoration: none;
}
.sidebar-nav a .nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: .82rem;
  color: rgba(255,255,255,.5);
}
.sidebar-footer a { color: rgba(255,255,255,.65); }
.sidebar-user { font-weight: 600; color: rgba(255,255,255,.88); margin-bottom: .25rem; }

/* Hauptbereich */
.admin-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.admin-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}
.admin-topbar h1 { font-size: 1.15rem; font-weight: 600; color: var(--text); }
.topbar-actions { display: flex; gap: .6rem; align-items: center; }

.admin-content { padding: 1.75rem; flex: 1; }

/* === Karten ================================================ */
.admin-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.admin-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
  color: var(--green-dark);
}

/* Dashboard-Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border-top: 4px solid var(--green);
  text-align: center;
}
.stat-number { font-size: 2rem; font-weight: 700; color: var(--green); line-height: 1; }
.stat-label { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }

/* === Tabellen ============================================== */
.table-responsive { overflow-x: auto; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.admin-table th {
  background: var(--bg);
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .7rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
.admin-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:hover td { background: #fafafa; }
.admin-table tr:last-child td { border-bottom: none; }

/* Status-Badges */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.badge-published  { background: var(--green-light); color: var(--green-dark); }
.badge-draft      { background: #fff3cd; color: #7a5800; }
.badge-active     { background: var(--green-light); color: var(--green-dark); }
.badge-cancelled  { background: #fdecea; color: var(--danger); }
.badge-admin      { background: #e8e0f8; color: #5b21b6; }
.badge-redakteur  { background: #e0f0ff; color: #1a4f8a; }

/* Aktions-Buttons in Tabellen */
.action-btns { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--radius);
  font-size: .85rem;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s;
}
.btn-edit   { background: #e0f0ff; color: #1a4f8a; }
.btn-edit:hover { background: #c8e2ff; text-decoration: none; color: #1a4f8a; }
.btn-delete { background: #fdecea; color: var(--danger); }
.btn-delete:hover { background: #fad4d1; text-decoration: none; color: var(--danger); }
.btn-view   { background: var(--green-light); color: var(--green-dark); }
.btn-view:hover { background: #d4ecb8; text-decoration: none; color: var(--green-dark); }

/* === Formulare ============================================= */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.form-grid-full { grid-column: 1 / -1; }
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block; font-size: .85rem; font-weight: 600;
  margin-bottom: .35rem; color: var(--text);
}
.form-group .hint { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: .55rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .92rem;
  color: var(--text);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(64,128,0,.12);
}
.form-group textarea { min-height: 110px; resize: vertical; }
.form-group input[type="checkbox"] { width: auto; }

/* Quill WYSIWYG */
.ql-container { border-radius: 0 0 var(--radius) var(--radius) !important; }
.ql-toolbar { border-radius: var(--radius) var(--radius) 0 0 !important; }

/* Bild-Vorschau */
.img-preview {
  max-width: 280px;
  max-height: 180px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  object-fit: cover;
  margin-top: .5rem;
}
.img-current { margin-bottom: .5rem; }
.img-current label { font-size: .75rem; color: var(--text-muted); margin-bottom: .25rem; }

/* === Buttons =============================================== */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.2rem;
  border-radius: var(--radius);
  font-family: inherit; font-size: .88rem; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none;
  transition: background .15s, box-shadow .15s;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); color: #fff; text-decoration: none; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: #eee; text-decoration: none; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; color: #fff; text-decoration: none; }
.btn-sm { padding: .35rem .8rem; font-size: .8rem; }

/* === Meldungen ============================================= */
.notice {
  padding: .85rem 1.15rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: .88rem;
}
.notice-success { background: var(--green-light); color: var(--green-dark); border-left: 4px solid var(--green); }
.notice-error   { background: #fdecea; color: var(--danger); border-left: 4px solid var(--danger); }
.notice-warning { background: #fff3cd; color: #7a5800; border-left: 4px solid #f9a825; }
.notice-info    { background: #e8f4f8; color: #1a6680; border-left: 4px solid #1a6680; }

/* === Log-Tabelle =========================================== */
.log-action { font-size: .78rem; font-family: monospace; background: var(--bg); padding: .15rem .4rem; border-radius: 3px; }

/* === Upload-Bereich Galerie ================================ */
.gallery-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.gallery-img-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--green-light);
}
.gallery-img-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-img-actions {
  position: absolute; top: .3rem; right: .3rem;
  display: flex; gap: .25rem;
  opacity: 0; transition: opacity .2s;
}
.gallery-img-item:hover .gallery-img-actions { opacity: 1; }
.gallery-img-delete,
.gallery-img-rotate {
  background: rgba(0,0,0,.6); color: #fff;
  border: none; border-radius: 50%; width: 26px; height: 26px;
  cursor: pointer; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; line-height: 1;
}
.gallery-img-rotate { font-size: 1rem; }
.gallery-img-rotate:disabled { opacity: .4; cursor: default; }
.gallery-img-caption {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.55); color: #fff; font-size: .7rem; padding: .25rem .4rem;
}

/* === Responsive ============================================ */
@media (max-width: 768px) {
  .admin-sidebar { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .admin-content { padding: 1rem; }
}
