/* XYZ Vertrieb – Anmeldung, Ordner, Vorschau. Farben wie das Panel: nur Blau/Cyan. */
@font-face { font-family: "Inter"; src: url("/assets/fonts/inter.v1.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Inter"; src: url("/assets/fonts/inter-ext.v1.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02AF, U+1E00-1EFF; }
@font-face { font-family: "Bricolage Grotesque"; src: url("/assets/fonts/bricolage.v1.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #070b14;
  --surface: #0c1220;
  --surface-hover: #111a2d;
  --line: rgba(148, 178, 220, 0.14);
  --line-strong: rgba(148, 178, 220, 0.3);
  --text: #eaf1fb;
  --muted: #9fb0c9;
  --faint: #76859f;
  --cyan: #22d3ee;
  --blue: #1f7fe6;
  --blue-hover: #3190f2;
  --danger: #ff8a8a;
  --head: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.noscript { padding: 24px; }

/* ------------------------------------------------------------ Anmeldung */
.login {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px calc(32px + env(safe-area-inset-bottom));
}
.login-form { width: 100%; max-width: 360px; }
.login-logo { display: block; width: 76px; height: auto; margin-bottom: 28px; }
.login h1 { margin: 0 0 6px; font: 700 34px/1.1 var(--head); letter-spacing: -0.01em; }
.login-lead { margin: 0 0 30px; color: var(--muted); }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--muted); }
.field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
}
.field input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan); }
.login-error { min-height: 22px; margin: 0 0 10px; font-size: 14px; color: var(--danger); }
.btn-primary {
  width: 100%;
  height: 48px;
  background: var(--blue);
  border-radius: 6px;
  font-weight: 600;
  color: #fff;
  transition: background-color 0.15s;
}
.btn-primary:hover { background: var(--blue-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

/* --------------------------------------------------------- Kopfzeile */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  /* Gleiche Fluchtlinie wie der Inhalt darunter (max. 1240px). */
  padding: env(safe-area-inset-top) max(var(--gutter), calc((100% - 1240px) / 2 + var(--gutter))) 0;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; font: 600 17px/1 var(--head); }
.brand img { width: 40px; height: auto; display: block; }
.who { display: flex; align-items: center; gap: 18px; font-size: 14px; color: var(--muted); min-width: 0; }
.who-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-btn { min-height: 44px; font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; }
.text-btn:hover { color: var(--cyan); }

/* ----------------------------------------------------- Ordneransicht */
.browse {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) var(--gutter) calc(64px + env(safe-area-inset-bottom));
}
.crumbs { display: flex; flex-wrap: wrap; gap: 2px 8px; margin: 0 0 8px; padding: 0; list-style: none; font-size: 15px; color: var(--muted); }
.crumbs li { display: flex; align-items: center; gap: 8px; }
.crumbs li + li::before { content: "/"; color: var(--faint); }
.crumbs a:hover { color: var(--cyan); }
.page-title { margin: 0 0 clamp(24px, 4vw, 40px); font: 700 clamp(30px, 4.6vw, 46px)/1.1 var(--head); letter-spacing: -0.015em; overflow-wrap: anywhere; }

.folders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  margin: 0 -14px 32px;
  padding: 0;
  list-style: none;
}
.folder {
  display: block;
  height: 100%;
  padding: 14px;
  border-radius: 8px;
  transition: background-color 0.15s;
}
.folder:hover { background: var(--surface-hover); }
.folder-icon { display: block; width: 100%; max-width: 120px; height: auto; margin-bottom: 12px; }
.folder-name { display: block; font: 600 18px/1.25 var(--head); overflow-wrap: anywhere; }
.folder-meta { display: block; margin-top: 3px; font-size: 14px; color: var(--muted); }

.section-label { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.files { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.file {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 68px;
  padding: 10px 14px;
  margin: 0 -14px;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.15s;
}
.file:hover { background: var(--surface-hover); }
.file-icon { flex: none; width: 34px; height: 34px; color: var(--cyan); }
.file-title { flex: 1; min-width: 0; font-weight: 500; font-size: 17px; overflow-wrap: anywhere; }
.file-action { flex: none; font-size: 14px; font-weight: 600; color: var(--cyan); }

.empty { margin: 0; padding: 40px 0; color: var(--muted); }
.problem { margin: 0 0 16px; color: var(--danger); }

/* ---------------------------------------------------------- Vorschau */
.viewer { flex: 1; display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.viewer-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 60px;
  padding: env(safe-area-inset-top) clamp(12px, 2vw, 24px) 0;
  border-bottom: 1px solid var(--line);
}
.viewer-back {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding-right: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.viewer-back:hover { color: var(--cyan); }
.viewer-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-full {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  background: var(--blue);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  transition: background-color 0.15s;
}
.viewer-full:hover { background: var(--blue-hover); }
.viewer-stage { position: relative; flex: 1; min-height: 0; background: #fff; }
.viewer-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.viewer-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--muted);
  font-size: 15px;
}

/* Vollbild: native Vollbild-API, sonst (iPhone) über den ganzen Viewport. */
.viewer-stage:fullscreen,
.viewer-stage:-webkit-full-screen { width: 100%; height: 100%; }
.viewer.is-pseudo-full .viewer-bar { display: none; }
.viewer.is-pseudo-full .viewer-stage { position: fixed; inset: 0; z-index: 50; }

.full-exit {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: calc(10px + env(safe-area-inset-right));
  z-index: 2;
  display: none;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  background: rgba(7, 11, 20, 0.86);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s;
}
/* Rechte obere Ecke als Greifzone – der Knopf erscheint nur beim Darüberfahren. */
.full-zone {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  width: 110px;
  height: 56px;
  display: none;
}
.viewer-stage:fullscreen .full-exit,
.viewer-stage:fullscreen .full-zone,
.viewer-stage:-webkit-full-screen .full-exit,
.viewer-stage:-webkit-full-screen .full-zone { display: flex; }
.full-zone:hover + .full-exit,
.full-exit:hover,
.full-exit:focus-visible,
.full-exit.is-shown { opacity: 1; }
/* Ohne Hover oder ohne native API muss der Knopf immer erreichbar sein. */
.viewer.is-pseudo-full .full-exit { display: flex; opacity: 0.75; }

@media (max-width: 560px) {
  .folders { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .folder-icon { max-width: 96px; }
  .who-name { display: none; }
  .viewer-back span { display: none; }
  .file-action { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
