:root {
  --bg: #161616;
  --surface: #232323;
  --surface-raised: #2b2b2b;
  --ink: #f2f2f0;
  --ink-soft: #a8a8a5;
  --accent: #e6e6e2;
  --accent-dark: #ffffff;
  --accent-soft: #3a3a3a;
  --accent-ink: #161616;
  --line: #3c3c3c;
  --danger: #d9765a;
  --radius: 18px;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  font-size: 19px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Verdana, Arial, sans-serif;
  line-height: 1.5;
}

body {
  padding-bottom: 110px;
}

.site-header {
  background: #000000;
  color: var(--ink);
  padding: 28px 20px 32px;
  text-align: center;
  box-shadow: var(--shadow);
  border-bottom: 1px solid var(--line);
}

.site-logo {
  display: block;
  height: 30px;
  width: auto;
  margin: 0 auto 22px;
}

.site-header h1 {
  margin: 0 auto;
  font-size: clamp(1.4rem, 4vw, 2.3rem);
  font-weight: 700;
  max-width: 900px;
}

.view { max-width: 1000px; margin: 0 auto; padding: 28px 20px 20px; }
.hidden { display: none !important; }

/* Startseite: 3 grosse Ordner */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-top: 12px;
}

.folder-tile {
  background: var(--surface);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, border-color 0.12s ease;
  font-family: inherit;
}

.folder-tile:hover, .folder-tile:focus-visible {
  transform: translateY(-4px);
  border-color: var(--accent);
  outline: none;
}

.folder-icon { font-size: 3.4rem; }
.folder-label { font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.folder-count { font-size: 1rem; color: var(--ink-soft); }

/* Kategorie-Ansicht */
.category-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.category-header h2 { margin: 0; font-size: 1.8rem; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 18px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.select-all-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  cursor: pointer;
}

.empty-hint { color: var(--ink-soft); font-style: italic; }

input[type="checkbox"] {
  width: 26px;
  height: 26px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Datei-Kacheln */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}

.file-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 3px solid transparent;
  position: relative;
  display: flex;
  flex-direction: column;
}

.file-card.selected { border-color: var(--accent); }

.file-card-select {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 8px;
  padding: 4px;
}

.file-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #0c0c0c;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.group-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin: 30px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.group-heading:first-child { margin-top: 0; }

.file-thumb img, .file-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 4px 9px;
  border-radius: 20px;
  font-size: 0.85rem;
}

.file-info {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.file-name {
  font-size: 0.98rem;
  word-break: break-word;
  color: var(--ink);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-secondary { background: var(--accent-soft); color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover { background: #454545; }
.btn-small { padding: 9px 14px; font-size: 0.92rem; align-self: flex-start; }

/* Auswahl-Leiste unten */
.selection-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #000000;
  color: var(--ink);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 -6px 20px rgba(0,0,0,0.5);
  z-index: 20;
  border-top: 1px solid var(--line);
}

#selection-count { font-size: 1.1rem; font-weight: 600; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 26, 22, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal-inner {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 1100px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-body {
  flex: 1;
  min-height: 300px;
  max-height: 75vh;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body img { max-width: 100%; max-height: 75vh; object-fit: contain; }
.modal-body video { width: 100%; max-height: 75vh; }
.pano-viewer { width: 100%; height: 70vh; }

.modal-footer {
  padding: 16px 20px;
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 22px;
  border-radius: 30px;
  z-index: 60;
  font-size: 1rem;
  box-shadow: var(--shadow);
}

@media (max-width: 480px) {
  :root { font-size: 17px; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
