:root {
    --bg: #f4f5f7;
    --panel: #ffffff;
    --border: #e0e2e7;
    --text: #1f2430;
    --muted: #6b7280;
    --primary: #2f6fed;
    --primary-dark: #1f4fc4;
    --danger: #d64545;
    --success: #1e8e5a;
    --radius: 8px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { background: var(--panel); border-bottom: 1px solid var(--border); }
.topbar-inner {
    max-width: 1100px; margin: 0 auto; padding: 12px 20px;
    display: flex; align-items: center; gap: 24px;
    position: relative;
}
/* Stand 01.10.2026: frueher per "position:absolute; left:50%" in der Mitte
   der GESAMTEN Kopfzeile zentriert -- bei genug Nav-Links (z.B. nach
   Hinzufuegen von "Backup") reichte der Admin-Nav-Bereich dann bis unter
   das Logo und wurde unlesbar ueberdeckt. Jetzt ein normales Flex-Element
   NACH der Navigation (siehe layout.php): .topnav hat flex:1 und saugt den
   gesamten freien Platz auf, das Logo landet dadurch automatisch ganz
   rechts direkt vor dem Nutzer-Bereich -- unabhaengig davon, wie viele
   Nav-Links es gibt, nie mehr eine Ueberlappung. */
.topbar-logo { max-height: 36px; width: auto; }
.brand { font-weight: 700; color: var(--text); font-size: 1.1rem; }
.brand:hover { text-decoration: none; }
.topnav { display: flex; gap: 16px; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; color: var(--muted); }
.btn-link { color: var(--primary); }

.page { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
.footer { text-align: center; padding: 16px; color: var(--muted); font-size: 0.8rem; }

h1 { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.9rem; }
.alert-success { background: #e6f6ed; color: var(--success); border: 1px solid #b7e4c9; }
.alert-error { background: #fceaea; color: var(--danger); border: 1px solid #f3bcbc; }

.auth-box {
    max-width: 380px; margin: 8vh auto; background: var(--panel);
    padding: 32px; border-radius: var(--radius); border: 1px solid var(--border);
}
.auth-box h1 { font-size: 1.4rem; margin-bottom: 2px; }
.auth-logo { display: block; max-width: 300px; height: auto; margin: 0 auto 20px; }
.auth-forgot-hint { margin-top: 16px; text-align: center; }
.captcha-box { margin: 4px 0 14px; }
.captcha-gate { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc; }
.captcha-gate p { margin: 0 0 8px; }
.captcha-error { color: var(--danger); margin: 6px 0 0; }
.auth-legal-links {
    margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
    text-align: center; font-size: 0.8rem; color: var(--muted);
    display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px;
}
.auth-legal-links a { color: var(--muted); text-decoration: underline; }
.auth-legal-links a:hover { color: var(--text, #1f2937); }

/* Hintergrundbild auf der Login-Seite -- als eigenes ::before HINTER dem
   Inhalt (nicht als CSS "opacity" auf body/Inhalt!), damit NUR das Bild
   selbst zu 50% durchscheinend ist und Formular/Texte davon unberuehrt
   bleiben. Der Login-Kasten (.auth-box) hat ohnehin einen deckenden weissen
   Hintergrund; fuer den Hinweistext und den Footer OHNE eigenen Kasten
   sorgt ein halbtransparenter weisser Untergrund fuer genug Kontrast. */
body.login-page {
    position: relative;
    background: var(--bg);
}
body.login-page::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url('../img/login-bg.jpg') center center / cover no-repeat;
    opacity: 0.5;
    z-index: -1;
}
body.login-page .auth-hint {
    display: inline-block;
    background: rgba(255, 255, 255, 0.8);
    padding: 5px 14px;
    border-radius: 999px;
}
body.login-page .footer span {
    display: inline-block;
    background: rgba(255, 255, 255, 0.8);
    padding: 3px 10px;
    border-radius: 999px;
}

form label { display: block; margin-bottom: 14px; font-size: 0.85rem; color: var(--muted); }
form input[type=text], form input[type=password], form input[type=email],
form input[type=number], form textarea, form select {
    display: block; width: 100%; margin-top: 4px; padding: 9px 10px;
    border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem;
    font-family: inherit; color: var(--text); background: #fff;
}
form textarea { resize: vertical; min-height: 80px; }

.btn {
    display: inline-block; padding: 9px 16px; border-radius: 6px; border: 1px solid transparent;
    font-size: 0.9rem; cursor: pointer; font-weight: 600;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: #fff; border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: #f0f1f3; text-decoration: none; }
.btn-danger { background: #fff; border-color: #f3bcbc; color: var(--danger); }
.btn-danger:hover { background: #fceaea; text-decoration: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

.tour-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.tour-card .thumb { height: 140px; background: #e8eaed center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.8rem; }
.tour-card .body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.tour-card .title { font-weight: 600; }
.tour-card .meta { font-size: 0.78rem; color: var(--muted); }
.tour-card .actions { padding: 12px 14px; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-wrap: wrap; }
.copy-tour-form { display: flex; gap: 6px; align-items: center; }
.copy-target-select { padding: 5px 6px; border-radius: 6px; border: 1px solid var(--border); font-size: 0.78rem; max-width: 140px; background: #fff; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.badge-published { background: #e6f6ed; color: var(--success); }
.badge-draft { background: #f1f1f3; color: var(--muted); }
.badge-active { background: #e6f6ed; color: var(--success); }
.badge-inactive { background: #f1f1f3; color: var(--muted); }
.badge-suspended { background: #fceaea; color: var(--danger); }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { background: #fafbfc; color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

.scene-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.scene-thumb { position: relative; border: 2px solid var(--border); border-radius: 6px; overflow: hidden; cursor: grab; background: #000; }
.scene-thumb.active { border-color: var(--primary); }
/* Reihenfolge per Drag & Drop, siehe assets/js/scene-reorder.js. Die
   gezogene Kachel wird halbtransparent, damit klar erkennbar bleibt, welche
   gerade bewegt wird -- die Ziel-Einfuegeposition zeigt sich direkt durch
   die live umsortierten Kacheln daneben. */
.scene-thumb.dragging { opacity: 0.4; cursor: grabbing; }
.scene-thumb img { width: 100%; height: 100px; object-fit: cover; display: block; opacity: 0.9; }
.scene-thumb .label { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,0.6); color: #fff; font-size: 0.75rem; padding: 4px 6px; }
.scene-thumb .del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: 4px; width: 20px; height: 20px; cursor: pointer; font-size: 0.8rem; line-height: 1; }
.scene-thumb .scene-start-badge { position: absolute; top: 4px; left: 4px; background: rgba(47,111,237,0.9); color: #fff; font-size: 0.65rem; font-weight: 600; padding: 2px 6px; border-radius: 4px; letter-spacing: 0.02em; z-index: 1; }
.scene-rename-form { position: absolute; bottom: 0; left: 0; right: 0; display: flex; gap: 4px; background: rgba(0,0,0,0.65); padding: 4px; cursor: default; }
.scene-rename-form input[type="text"] { flex: 1; min-width: 0; width: auto; margin: 0; padding: 3px 5px; background: rgba(255,255,255,0.1); border: 1px solid transparent; border-radius: 3px; color: #fff; font-size: 0.75rem; cursor: text; }
.scene-rename-form input[type="text"]:focus { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.4); outline: none; }
.scene-rename-form button { flex: none; background: rgba(255,255,255,0.15); color: #fff; border: none; border-radius: 3px; width: 22px; height: 22px; cursor: pointer; font-size: 0.8rem; line-height: 1; }
.scene-rename-form button:hover { background: rgba(255,255,255,0.3); }

.editor-layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
.editor-viewer-wrap { position: relative; }
#psv-viewer { width: 100%; height: 560px; background: #000; border-radius: var(--radius); overflow: hidden; }
.editor-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.hint-box { background: #eef3ff; border: 1px solid #c9d9fb; color: #1f4fc4; padding: 8px 12px; border-radius: 6px; font-size: 0.82rem; margin-bottom: 10px; }

.hotspot-marker {
    width: 26px; height: 26px; border-radius: 50%; background: var(--primary);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 14px; cursor: pointer; box-shadow: 0 0 0 2px #fff;
}
.hotspot-marker.info { background: #6b7280; }
.hotspot-marker.website { background: #2f9e6b; }
.hotspot-marker.image { background: #d97706; }
.hotspot-marker.audio { background: #9333ea; }
.hotspot-marker.video { background: #dc2626; }
.hotspot-marker.pdf { background: #475569; }
.hotspot-marker.shop { background: #db2777; }
.hotspot-marker.quiz { background: #0891b2; }
    /* Verlinkung auf eine Video-Szene: Miniaturbild des Videos statt Icon */
/* Verknuepfung mit Vorschaubild der Zielszene statt Icon (Option je Hotspot): runde Miniatur mit weissem Rand */
.hotspot-marker.scene-thumb {
    width: 64px; height: 64px; padding: 0; border-radius: 50%; overflow: hidden; background: #000;
    box-shadow: 0 0 0 3px #fff, 0 2px 10px rgba(0,0,0,0.55);
}
.hotspot-marker.scene-thumb.size-small { width: 48px; height: 48px; }
.hotspot-marker.scene-thumb.size-large { width: 88px; height: 88px; }
.hotspot-marker.scene-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.hotspot-marker.scene-thumb + .hotspot-label { margin-top: 9px; }
.hotspot-marker.vthumb {
    width: 96px; height: 54px; border-radius: 8px; background: #000; position: relative; overflow: hidden;
    box-shadow: 0 0 0 2px #fff, 0 2px 10px rgba(0,0,0,0.55);
}
.hotspot-marker.vthumb.size-small { width: 72px; height: 41px; }
.hotspot-marker.vthumb.size-large { width: 128px; height: 72px; }
.hotspot-marker.vthumb img, .hotspot-marker.vthumb video {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none;
}
.hotspot-marker.vthumb .vthumb-play {
    position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
    background: rgba(0,0,0,0.55); box-shadow: 0 0 0 2px rgba(255,255,255,0.9); pointer-events: none;
}
.hotspot-marker.vthumb .vthumb-play::after {
    content: ''; position: absolute; left: 10px; top: 7px; border-style: solid; border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent #fff;
}
.hotspot-marker svg { width: 16px; height: 16px; stroke: currentColor; fill: none; pointer-events: none; }
.hotspot-marker.size-small { width: 20px; height: 20px; font-size: 11px; }
.hotspot-marker.size-small svg { width: 12px; height: 12px; }
.hotspot-marker.size-large { width: 34px; height: 34px; font-size: 18px; }
.hotspot-marker.size-large svg { width: 20px; height: 20px; }

.embed-box textarea { font-family: monospace; font-size: 0.8rem; }

/* Icon-Picker im Hotspot-Dialog (Marker-Icon-Auswahl) */
#field-icon { margin-bottom: 14px; }
.form-label-text { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.85rem; }
.icon-picker {
    display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
    max-height: 160px; overflow-y: auto; padding: 6px; border: 1px solid #d8dee9;
    border-radius: 6px; background: #f8fafc;
}
.icon-pick-btn {
    width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
    border: 1px solid transparent; border-radius: 5px; background: #fff; cursor: pointer;
    color: #475569; padding: 0;
}
.icon-pick-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }
.icon-pick-btn:hover { background: #eef3ff; border-color: #c9d9fb; }
.icon-pick-btn.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.icon-pick-default-label { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.02em; }

/* Größen-Picker (Marker-Größe je Hotspot) */
.size-picker { display: flex; gap: 6px; margin-top: 4px; }
.size-pick-btn {
    display: flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid #d8dee9;
    border-radius: 6px; background: #fff; cursor: pointer; color: #475569; font-size: 0.82rem;
}
.size-pick-btn:hover { background: #eef3ff; border-color: #c9d9fb; }
.size-pick-btn.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.size-pick-dot { display: inline-block; border-radius: 50%; background: currentColor; }
.size-pick-dot-small { width: 8px; height: 8px; }
.size-pick-dot-medium { width: 11px; height: 11px; }
.size-pick-dot-large { width: 14px; height: 14px; }

.floorplan-pin {
    position: absolute; width: 22px; height: 22px; border-radius: 50%;
    background: #2f6fed; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%); cursor: pointer; display: flex; align-items: center;
    justify-content: center; color: #fff; font-size: 11px; font-weight: bold;
}
.floorplan-pin.current { background: #e0472c; }

.floorplan-minimap {
    position: absolute; left: 14px; bottom: 14px; z-index: 20; max-width: 220px;
    background: rgba(0,0,0,0.55); border-radius: 8px; padding: 6px; backdrop-filter: blur(2px);
}
.floorplan-minimap img { display: block; max-width: 100%; border-radius: 4px; }
.floorplan-minimap .floorplan-pin { width: 16px; height: 16px; font-size: 0; }
.floorplan-minimap-toggle {
    position: absolute; left: 14px; bottom: 14px; z-index: 21; background: rgba(0,0,0,0.55);
    color: #fff; border: none; border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 0.8rem;
}

.public-viewer-page { margin: 0; padding: 0; background: #000; }
.public-viewer-page .page { max-width: none; padding: 0; }
.public-viewer-page main.page { display: block; }
#psv-public { width: 100vw; height: 100vh; }

@media (max-width: 720px) {
    .editor-layout { grid-template-columns: 1fr; }
    .topbar-inner { flex-wrap: wrap; }
    /* Seit 01.10.2026 ist .topbar-logo kein absolut positioniertes Element
       mehr (siehe Kommentar dort) -- die urspruengliche Ueberlappungsgefahr
       beim Umbrechen besteht nicht mehr. Bleibt trotzdem auf schmalen
       Bildschirmen ausgeblendet, um die Kopfzeile dort kompakt zu halten;
       der Schriftzug "Tour CMS" bleibt als Markenkennzeichnung erhalten. */
    .topbar-logo { display: none; }
}

/* Quill-Editor fuer Rechtstexte/Information (Impressum, Datenschutz,
   Kontakt, Beschreibung), siehe assets/js/html-editor.js. Stand
   19.09.2026: zurueck von TinyMCE auf Quill. Quill selbst bringt sein
   Grundlayout per vendor/quill/quill.snow.css mit -- hier nur Abstand
   unter dem Editor sowie eine Mindesthoehe fuer den Bearbeitungsbereich,
   damit er nicht kleiner wirkt als die vorherige Textarea. */
.html-editor-container { margin-bottom: 4px; border-radius: var(--radius); overflow: hidden; }
.html-editor-container .ql-toolbar.ql-snow { border: 1px solid var(--border); border-bottom: none; border-radius: var(--radius) var(--radius) 0 0; }
.html-editor-container .ql-container.ql-snow { border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
.html-editor-container .ql-editor { min-height: 220px; font-size: 0.95rem; }
.html-editor-container .ql-editor img { cursor: pointer; }

/* Ziehgriff zum Anpassen der Anzeigebreite eines in einen Rich-Text-Editor
   eingefuegten Bildes (siehe html-editor.js, enableImageResize()). Wird per
   JS an document.body angehaengt (position:fixed, Viewport-Koordinaten),
   nicht in den Editor-Container selbst -- so ist keine Sonderbehandlung fuer
   dessen eigenes Scrollen/Ueberlauf noetig. */
.img-resize-handle {
    position: fixed;
    width: 14px;
    height: 14px;
    background: #2563eb;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 9999;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* "Little Planet"-Startanimation: "360°"-Hinweis-Badge, das waehrend der
   Fischauge-Aufloesung (public/assets/js/panorama-start-animation.js)
   kurz eingeblendet wird -- funktioniert sowohl im Editor
   (.editor-viewer-wrap als Container) als auch im oeffentlichen Viewer
   (#psv-public als Container). */
.psv-start-hint {
    position: absolute;
    top: 66%; /* etwas unterhalb der Mitte, damit der Hinweis Inhalte in Bildmitte nicht verdeckt (Nutzerwunsch 16.10.2026) */
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(20, 24, 28, 0.72);
    color: #fff;
    padding: 10px 18px;
    border-radius: 999px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.45s ease, transform 0.45s ease;
}
.psv-start-hint.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.psv-start-hint svg { flex: none; }

/* Editor: Bildschirm/Leinwand-Flaeche - Rahmen nur beim Darueberfahren sichtbar (sonst unsichtbar, aber klickbar) */
.screen-hit:hover { stroke: #ffb300 !important; fill: rgba(255,179,0,0.10) !important; }

/* Deaktivierte Szenen (Szenenliste + Editor-Seitenleiste): ausgegraut, bleiben aber bedienbar */
.scene-thumb.scene-inactive img { filter: grayscale(1); opacity: 0.45; }
.scene-thumb.scene-inactive .label::after { content: ' (deaktiviert)'; opacity: 0.8; }
.scene-thumb .del.scene-toggle { right: 28px; font-size: 0.7rem; }

/* PDF-Hotspot mit eigenem Bild statt Icon (optional, Editor-Dialog "Eigenes Bild statt Icon") */
.hotspot-marker.hotspot-img { width: 56px; height: 56px; background: none; border-radius: 0; box-shadow: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5)); }
.hotspot-marker.hotspot-img.size-small { width: 40px; height: 40px; }
.hotspot-marker.hotspot-img.size-large { width: 84px; height: 84px; }
.hotspot-marker.hotspot-img img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
