/* ── Design-Tokens ─────────────────────────────────────────────────────── */
:root {
  --navy:         #1a2e6e;
  --navy-dark:    #111f4d;
  --navy-light:   #2a3f8f;
  --navy-subtle:  #eef1fb;
  --accent:       #c8a84b;      /* Gold-Akzent */
  --sidebar-w:    272px;
  --navbar-h:     60px;
  --border:       #d8dde8;
  --text:         #1a1d2e;
  --text-muted:   #64748b;
  --radius:       8px;
  --shadow-sm:    0 1px 3px rgba(26,46,110,.10);
  --shadow-md:    0 4px 16px rgba(26,46,110,.14);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f8;
  color: var(--text);
  font-size: 15px;
}

/* ── Navbar ────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--navy) !important;
  height: var(--navbar-h);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
  position: relative;
  z-index: 300;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff !important;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .02em;
  text-decoration: none;
}
.navbar-brand img {
  height: 38px;
  width: 38px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: 3px;
}
.navbar-brand .brand-text { line-height: 1.2; }
.navbar-brand .brand-sub  { font-size: .7rem; font-weight: 400; opacity: .75; display: block; }

.btn-sidebar-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,.9);
  font-size: 1.5rem;
  cursor: pointer;
  padding: .25rem .4rem;
  border-radius: 6px;
  transition: background .15s;
  line-height: 1;
  display: flex;
  align-items: center;
}
.btn-sidebar-toggle:hover { background: rgba(255,255,255,.15); }

#nav-username {
  color: rgba(255,255,255,.65);
  font-size: .82rem;
}

/* Dropdown-Button */
.navbar .dropdown-toggle {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  border-radius: var(--radius);
  padding: .3rem .75rem;
  font-size: .88rem;
  transition: background .15s;
}
.navbar .dropdown-toggle:hover { background: rgba(255,255,255,.22); }
.navbar .dropdown-menu {
  border: none;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius);
  min-width: 200px;
  margin-top: .3rem;
}
.navbar .dropdown-item {
  font-size: .9rem;
  padding: .5rem 1rem;
  border-radius: 4px;
  margin: 1px 4px;
}
.navbar .dropdown-item:hover { background: var(--navy-subtle); color: var(--navy); }

/* ── Login ─────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, var(--navy-dark) 0%, var(--navy) 55%, var(--navy-light) 100%);
  position: relative;
  overflow: hidden;
}
/* Dezente Hintergrundelemente */
.login-wrap::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  top: -200px; right: -150px;
}
.login-wrap::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,.03);
  bottom: -120px; left: -100px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem 2.25rem;
  width: min(400px, 92vw);
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
  position: relative;
  z-index: 1;
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo img {
  height: 90px;
  width: auto;
  margin-bottom: .75rem;
}
.login-logo h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: .15rem;
}
.login-logo p {
  font-size: .82rem;
  color: var(--text-muted);
}
.login-card .form-label  { font-weight: 500; color: var(--text); }
.login-card .form-control {
  border-color: var(--border);
  border-radius: var(--radius);
  padding: .55rem .85rem;
  font-size: .95rem;
}
.login-card .form-control:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,46,110,.12);
}
.login-card .btn-primary {
  background: var(--navy);
  border-color: var(--navy);
  border-radius: var(--radius);
  padding: .6rem;
  font-weight: 600;
  letter-spacing: .02em;
  transition: background .15s;
}
.login-card .btn-primary:hover { background: var(--navy-dark); border-color: var(--navy-dark); }

/* ── App-Layout ────────────────────────────────────────────────────────── */
.app-body {
  display: flex;
  height: calc(100vh - var(--navbar-h));
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: margin-left .25s ease;
  overflow: hidden;
}
.sidebar.hidden {
  margin-left: calc(-1 * var(--sidebar-w));
  width: 0;
}

.sidebar-header {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--navy-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}
.sidebar-header span {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--navy);
  text-transform: uppercase;
}
.sidebar-header .btn {
  border-radius: 6px;
  color: var(--navy);
  border-color: var(--navy);
  padding: .2rem .5rem;
  font-size: .82rem;
}
.sidebar-header .btn:hover { background: var(--navy); color: #fff; }

.sidebar-search {
  padding: .45rem .6rem;
  border-bottom: 1px solid var(--border);
  background: #fafbfd;
}
.sidebar-search .form-control {
  border-radius: 6px;
  border-color: var(--border);
  font-size: .85rem;
  background: #fff;
}
.sidebar-search .form-control:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 2px rgba(26,46,110,.1);
}

.page-tree {
  flex: 1;
  overflow-y: auto;
  padding: .4rem 0;
}
.page-tree::-webkit-scrollbar       { width: 5px; }
.page-tree::-webkit-scrollbar-track { background: transparent; }
.page-tree::-webkit-scrollbar-thumb { background: #c8d0e0; border-radius: 3px; }

/* ── Tree-Items ────────────────────────────────────────────────────────── */
.tree-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: .33rem .8rem;
  margin: 1px 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: .88rem;
  user-select: none;
  transition: background .12s, color .12s;
}
.tree-item:hover  { background: var(--navy-subtle); color: var(--navy); }
.tree-item.active { background: var(--navy); color: #fff; font-weight: 500; }
.tree-item.active .tree-icon,
.tree-item.active .tree-chevron { color: rgba(255,255,255,.75); }

.tree-chevron    { width: 13px; flex-shrink: 0; font-size: .68rem; color: #adb5bd; }
.tree-icon       { flex-shrink: 0; font-size: .82rem; color: var(--text-muted); }
.tree-icon-lock  { color: #cbd5e1 !important; }
.tree-label      { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-children   { border-left: 2px solid var(--navy-subtle); margin-left: 18px; }
.tree-item.locked         { opacity: .55; cursor: default; }
.tree-item.locked:hover   { background: transparent; color: var(--text); }

/* ── Main ──────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: #f0f2f8;
}
.view { flex: 1; display: flex; flex-direction: column; }

.view-header {
  padding: 1.4rem 2rem 1.1rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}
.view-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--navy);
}
.view-body { padding: 1.5rem 2rem; flex: 1; }

/* Buttons in navy */
.btn-primary   { background: var(--navy) !important; border-color: var(--navy) !important; border-radius: var(--radius) !important; }
.btn-primary:hover { background: var(--navy-dark) !important; border-color: var(--navy-dark) !important; }
.btn-outline-primary { color: var(--navy) !important; border-color: var(--navy) !important; border-radius: var(--radius) !important; }
.btn-outline-primary:hover { background: var(--navy) !important; color: #fff !important; }
.btn-outline-secondary { border-radius: var(--radius) !important; }

/* ── Wiki-Inhalt ───────────────────────────────────────────────────────── */
.wiki-content {
  max-width: 860px;
  line-height: 1.8;
  background: #fff;
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-sm);
}
.wiki-content img          { max-width: 100%; border-radius: 6px; margin: .6rem 0; }
.wiki-content h1,
.wiki-content h2,
.wiki-content h3           { color: var(--navy); margin-top: 1.6rem; }
.wiki-content h2           { border-bottom: 2px solid var(--navy-subtle); padding-bottom: .4rem; }
.wiki-content pre          { background: #f5f7ff; padding: 1rem; border-radius: 6px; border-left: 3px solid var(--navy); }
.wiki-content blockquote   { border-left: 4px solid var(--navy); padding-left: 1rem; color: var(--text-muted); margin: 1rem 0; }
.wiki-content a            { color: var(--navy); }

/* Breadcrumb */
.breadcrumb-item a { color: var(--navy); }
.breadcrumb-item.active { color: var(--text-muted); }

/* ── Quill ─────────────────────────────────────────────────────────────── */
#quill-editor           { height: 480px; background: #fff; border-radius: 0 0 var(--radius) var(--radius); }
.ql-container           { font-size: 15px; }
.ql-toolbar.ql-snow     { border-radius: var(--radius) var(--radius) 0 0; border-color: var(--border); background: #fafbfd; }
.ql-container.ql-snow   { border-color: var(--border); border-radius: 0 0 var(--radius) var(--radius); }
.ql-toolbar .ql-stroke  { stroke: var(--navy) !important; }
.ql-toolbar .ql-fill    { fill: var(--navy) !important; }
.ql-toolbar button:hover .ql-stroke { stroke: var(--navy-light) !important; }

/* ── Karten / Cards ────────────────────────────────────────────────────── */
.card                { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header         { background: var(--navy-subtle); border-bottom: 1px solid var(--border); color: var(--navy); font-weight: 600; border-radius: var(--radius) var(--radius) 0 0 !important; }
.table th            { color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; background: #fafbfd; }
.table-hover tbody tr:hover { background: var(--navy-subtle); }

/* Form Elemente */
.form-control:focus, .form-select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,46,110,.1);
}
.form-label { font-weight: 500; color: var(--text); font-size: .88rem; margin-bottom: .35rem; }

/* ── Anhänge ───────────────────────────────────────────────────────────── */
.att-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .85rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: .4rem;
  transition: box-shadow .15s;
}
.att-item:hover          { box-shadow: var(--shadow-sm); }
.att-item .att-icon      { font-size: 1.3rem; color: var(--navy); }
.att-item .att-name      { flex: 1; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-item .att-size      { color: var(--text-muted); font-size: .78rem; flex-shrink: 0; }

/* ── Rollen-Badges ─────────────────────────────────────────────────────── */
.badge-role          { font-size: .73rem; padding: .22rem .6rem; border-radius: 20px; font-weight: 600; letter-spacing: .02em; }
.badge-role.admin    { background: #fde8e8; color: #c0392b; }
.badge-role.vorstand { background: #fef3cd; color: #7d6608; }
.badge-role.trainer  { background: var(--navy-subtle); color: var(--navy); }
.badge-role.gast     { background: #f1f3f8; color: #64748b; }

/* ── Welcome / Empty ───────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 420px;
  text-align: center;
  padding: 2rem;
}
.empty-state .empty-logo   { height: 90px; width: auto; opacity: .18; margin-bottom: 1.25rem; }
.empty-state h3            { color: var(--text-muted); font-weight: 600; }
.empty-state p             { color: #94a3b8; margin-top: .4rem; }

/* ── Seiten-Meta ───────────────────────────────────────────────────────── */
#page-meta { color: var(--text-muted); font-size: .82rem; margin-top: .2rem; display: block; }

/* ── Toast ─────────────────────────────────────────────────────────────── */
#toasts {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  pointer-events: none;
}
#toasts .alert {
  pointer-events: all;
  min-width: 250px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: .9rem;
  animation: slideIn .2s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Modals ────────────────────────────────────────────────────────────── */
.modal-header  { background: var(--navy-subtle); border-bottom: 1px solid var(--border); }
.modal-title   { color: var(--navy); font-weight: 600; }
.modal-content { border-radius: var(--radius); border: none; box-shadow: var(--shadow-md); }
.modal-footer  { border-top: 1px solid var(--border); }

/* ── Sidebar Footer ────────────────────────────────────────────────────── */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: .4rem .5rem;
  background: #fafbfd;
  flex-shrink: 0;
}
.sidebar-footer-link {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .4rem .75rem;
  border-radius: 6px;
  color: var(--text);
  font-size: .88rem;
  text-decoration: none;
  transition: background .12s, color .12s;
}
.sidebar-footer-link:hover  { background: var(--navy-subtle); color: var(--navy); }
.sidebar-footer-link.active { background: var(--navy); color: #fff; }

/* ── Galerie: Alben-Grid ───────────────────────────────────────────────── */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}
.album-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  text-decoration: none;
  color: inherit;
}
.album-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.album-cover {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--navy-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}
.album-cover img      { width: 100%; height: 100%; object-fit: cover; }
.album-cover-empty i  { font-size: 3rem; color: #c8d0e0; }
.album-info           { padding: .75rem 1rem; }
.album-info h3        { font-size: 1rem; font-weight: 600; color: var(--navy); margin-bottom: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-info small     { color: var(--text-muted); font-size: .8rem; }
.album-info .album-actions { margin-top: .5rem; display: flex; gap: .4rem; }

/* ── Galerie: Foto-Grid ────────────────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .85rem;
}
.photo-card {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  background: var(--navy-subtle);
  box-shadow: var(--shadow-sm);
  transition: transform .15s;
}
.photo-card:hover { transform: scale(1.02); }
.photo-card img   { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-card .photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  opacity: 0;
  transition: opacity .15s;
  display: flex;
  align-items: flex-end;
  padding: .5rem;
}
.photo-card:hover .photo-overlay { opacity: 1; }
.photo-caption { color: #fff; font-size: .78rem; line-height: 1.3; flex: 1; }
.photo-del-btn {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  border-radius: 4px;
  padding: .15rem .4rem;
  cursor: pointer;
  font-size: .85rem;
  flex-shrink: 0;
}
.photo-del-btn:hover { background: rgba(220,38,38,.7); }

/* ── Upload-Zone ───────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 1.25rem;
  transition: border-color .15s, background .15s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--navy);
  background: var(--navy-subtle);
  color: var(--navy);
}
.upload-zone i  { font-size: 2.5rem; display: block; margin-bottom: .5rem; }
.upload-zone p  { margin: 0; font-size: .9rem; }

/* ── Lightbox ──────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.93);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.lightbox.d-none { display: none !important; }
.lb-img-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 4rem;
  max-width: 100%;
}
.lb-img-wrap img {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  border-radius: 4px;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.lb-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: rgba(255,255,255,.1);
  border: none;
  color: #fff;
  font-size: 1.3rem;
  border-radius: 50%;
  width: 42px; height: 42px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.lb-close:hover { background: rgba(255,255,255,.25); }
.lb-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.1);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  border-radius: 50%;
  width: 50px; height: 50px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.lb-nav:hover    { background: rgba(255,255,255,.25); }
.lb-prev         { left: 1rem; }
.lb-next         { right: 1rem; }
.lb-caption      { color: rgba(255,255,255,.8); font-size: .9rem; padding: .3rem 1rem; text-align: center; }
.lb-counter      { color: rgba(255,255,255,.4); font-size: .8rem; padding-bottom: .75rem; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }
  .sidebar {
    position: fixed;
    top: var(--navbar-h);
    left: 0;
    bottom: 0;
    z-index: 200;
    box-shadow: 4px 0 16px rgba(0,0,0,.15);
  }
  .sidebar.hidden { margin-left: calc(-1 * var(--sidebar-w)); width: var(--sidebar-w); }
  .view-header { padding: 1rem 1rem .85rem; }
  .view-body   { padding: 1rem; }
  .view-header h1 { font-size: 1.3rem; }
  .wiki-content { padding: 1.25rem; }
}
