/* ============================================================
 * VPano Viewer Design Tokens
 * ------------------------------------------------------------
 * Single source of truth fuer das visuelle Look-and-Feel des
 * Standard-Panorama-Editors UND des Export/Public-Viewers.
 *
 * MUSS identisch sein mit:
 *   backend/src/templates/export-viewer/assets/viewer-tokens.css
 *
 * Pruefen: `node scripts/check-viewer-tokens.mjs`
 * ============================================================ */

:root,
.vp-light {
    color-scheme: light;

    --vp-glass-bg:        rgba(255, 255, 255, 0.82);
    --vp-glass-border:    rgba(15, 23, 42, 0.10);
    --vp-glass-shadow:    0 8px 32px rgba(0, 0, 0, 0.10);

    --vp-accent:          #0ea5e9;
    --vp-accent-strong:   #38bdf8;
    --vp-accent-glow:     rgba(14, 165, 233, 0.22);
    --vp-accent-ring:     rgba(14, 165, 233, 0.30);

    --vp-button-bg:       rgba(15, 23, 42, 0.06);
    --vp-button-border:   rgba(15, 23, 42, 0.13);
    --vp-button-text:     #0f172a;
    --vp-text-muted:      rgba(15, 23, 42, 0.52);

    /* ── Animated-Hotspots (Light) ───────────────────────────────
       Quelle: logo design/design_handoff_hotspots/README.md.
       White-signals werden im Light-Theme zu Dark-Ink (Accent-Flip),
       damit Marker auf hellen Panoramen lesbar bleiben. */
    --vp-hs-glass:           rgba(248, 250, 252, 0.72);
    --vp-hs-glass-strong:    rgba(252, 253, 254, 0.85);
    --vp-hs-glass-line:      rgba(15, 20, 28, 0.14);
    --vp-hs-glass-line-soft: rgba(15, 20, 28, 0.08);
    --vp-hs-ink:             #11151c;
    --vp-hs-ink-dim:         rgba(17, 21, 28, 0.60);
    --vp-hs-fill:            #11151c;
    --vp-hs-on-fill:         #ffffff;
    --vp-hs-accent:          #11151c;
    --vp-hs-blur:            saturate(1.4) blur(20px);
    --vp-hs-sh:              0 10px 30px -12px rgba(20, 30, 50, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.70);
}

html.dark,
.vp-dark {
    color-scheme: dark;

    --vp-glass-bg:        rgba(9, 13, 22, 0.75);
    --vp-glass-border:    rgba(255, 255, 255, 0.10);
    --vp-glass-shadow:    0 8px 40px rgba(0, 0, 0, 0.55);

    --vp-accent:          #38bdf8;
    --vp-accent-strong:   #7dd3fc;
    --vp-accent-glow:     rgba(56, 189, 248, 0.22);
    --vp-accent-ring:     rgba(56, 189, 248, 0.30);

    --vp-button-bg:       rgba(255, 255, 255, 0.08);
    --vp-button-border:   rgba(255, 255, 255, 0.13);
    --vp-button-text:     #e8f2ff;
    --vp-text-muted:      rgba(220, 238, 255, 0.52);

    /* ── Animated-Hotspots (Dark) ────────────────────────────────
       Standardfall im Handoff. Weisses Signal auf dunkler Glas-Pille. */
    --vp-hs-glass:           rgba(13, 17, 28, 0.55);
    --vp-hs-glass-strong:    rgba(13, 17, 28, 0.74);
    --vp-hs-glass-line:      rgba(255, 255, 255, 0.16);
    --vp-hs-glass-line-soft: rgba(255, 255, 255, 0.09);
    --vp-hs-ink:             #f3f6fb;
    --vp-hs-ink-dim:         rgba(243, 246, 251, 0.62);
    --vp-hs-fill:            #f1f4f9;
    --vp-hs-on-fill:         #11151c;
    --vp-hs-accent:          #ffffff;
    --vp-hs-blur:            saturate(1.4) blur(20px);
    --vp-hs-sh:              0 10px 34px -10px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

/* Animated-Hotspots Theme-Override (unabhaengig vom Haupt-uiStyle).
   Wird ueber [data-hotspot-theme="light|dark"] auf documentElement gesetzt,
   ueberschreibt NUR die --vp-hs-*-Tokens — andere UI-Tokens bleiben unberuehrt. */
[data-hotspot-theme="light"] {
    --vp-hs-glass:           rgba(248, 250, 252, 0.72);
    --vp-hs-glass-strong:    rgba(252, 253, 254, 0.85);
    --vp-hs-glass-line:      rgba(15, 20, 28, 0.14);
    --vp-hs-glass-line-soft: rgba(15, 20, 28, 0.08);
    --vp-hs-ink:             #11151c;
    --vp-hs-ink-dim:         rgba(17, 21, 28, 0.60);
    --vp-hs-fill:            #11151c;
    --vp-hs-on-fill:         #ffffff;
    --vp-hs-accent:          #11151c;
    --vp-hs-sh:              0 10px 30px -12px rgba(20, 30, 50, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.70);
}
[data-hotspot-theme="dark"] {
    --vp-hs-glass:           rgba(13, 17, 28, 0.55);
    --vp-hs-glass-strong:    rgba(13, 17, 28, 0.74);
    --vp-hs-glass-line:      rgba(255, 255, 255, 0.16);
    --vp-hs-glass-line-soft: rgba(255, 255, 255, 0.09);
    --vp-hs-ink:             #f3f6fb;
    --vp-hs-ink-dim:         rgba(243, 246, 251, 0.62);
    --vp-hs-fill:            #f1f4f9;
    --vp-hs-on-fill:         #11151c;
    --vp-hs-accent:          #ffffff;
    --vp-hs-sh:              0 10px 34px -10px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

/* Editor-Sondertheme: Glass (transparent ueber Panorama, weisser Text) */
.vp-glass,
html[data-ui-theme="glass"] {
    --vp-glass-bg:        rgba(255, 255, 255, 0.10);
    --vp-glass-border:    rgba(255, 255, 255, 0.25);
    --vp-glass-shadow:    0 6px 24px rgba(0, 0, 0, 0.25);
    --vp-button-text:     #ffffff;
    --vp-text-muted:      rgba(255, 255, 255, 0.70);
    --vp-accent:          #38bdf8;
    --vp-accent-glow:     rgba(56, 189, 248, 0.22);
    --vp-accent-ring:     rgba(56, 189, 248, 0.30);

    /* Panorama-UI-Glass Tokens — Glass = extra-transparent dark base.
       Sonst fallen panorama-ui-glass.css-Selektoren auf :root (Light) zurueck
       und das Glass-Theme sieht aus wie Light. */
    --vp-hs-glass:           rgba(255, 255, 255, 0.10);
    --vp-hs-glass-strong:    rgba(255, 255, 255, 0.16);
    --vp-hs-glass-line:      rgba(255, 255, 255, 0.22);
    --vp-hs-glass-line-soft: rgba(255, 255, 255, 0.12);
    --vp-hs-ink:             #ffffff;
    --vp-hs-ink-dim:         rgba(255, 255, 255, 0.65);
    --vp-hs-fill:            rgba(255, 255, 255, 0.95);
    --vp-hs-on-fill:         #11151c;
    --vp-hs-accent:          #ffffff;
    --vp-hs-blur:            saturate(1.6) blur(24px);
    --vp-hs-sh:              0 8px 28px -10px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* Editor-Sondertheme: Minimal (kompakt, kein Blur, kein Glow) */
.vp-minimal,
html[data-ui-theme="minimal"] {
    --vp-glass-bg:        rgba(0, 0, 0, 0.30);
    --vp-glass-border:    rgba(255, 255, 255, 0.10);
    --vp-glass-shadow:    none;
    --vp-button-text:     rgba(255, 255, 255, 0.80);
    --vp-text-muted:      rgba(255, 255, 255, 0.55);
    --vp-blur:            0px;
    --vp-saturate:        100%;

    /* Panorama-UI-Glass Tokens — Minimal = subtile dunkle Pille, kein Blur. */
    --vp-hs-glass:           rgba(0, 0, 0, 0.42);
    --vp-hs-glass-strong:    rgba(0, 0, 0, 0.55);
    --vp-hs-glass-line:      rgba(255, 255, 255, 0.10);
    --vp-hs-glass-line-soft: rgba(255, 255, 255, 0.05);
    --vp-hs-ink:             rgba(255, 255, 255, 0.85);
    --vp-hs-ink-dim:         rgba(255, 255, 255, 0.50);
    --vp-hs-fill:            rgba(255, 255, 255, 0.90);
    --vp-hs-on-fill:         #11151c;
    --vp-hs-accent:          #ffffff;
    --vp-hs-blur:            none;
    --vp-hs-sh:              none;
}

/* ── Geometrie / Spacing (themenuebergreifend) ────────────────── */
:root {
    --vp-blur:            18px;
    --vp-saturate:        180%;

    --vp-topbar-inset:    16px;
    --vp-topbar-gap:      12px;

    --vp-pill-pad-x:      8px;     /* matches Editor px-2 */
    --vp-pill-pad-y:      6px;     /* matches Editor py-1.5 */
    --vp-pill-gap:        4px;     /* matches Editor gap-1 */
    --vp-pill-radius:     9999px;
    --vp-card-radius:     14px;
    --vp-strip-radius:    16px;
    --vp-strip-item-radius: 10px;

    --vp-btn-size:        34px;
    --vp-icon-size:       16px;
    --vp-ctrl-size:       36px;
    --vp-ctrl-icon-size:  17px;

    /* Logo: gemeinsame Pille fuer Editor + Public (box-sizing: border-box).
       Content-Hoehe = max-h - 2*pad-y - 2*border = 40 - 8 - 2 = 30px sichtbares Bild. */
    --vp-logo-max-w:      140px;
    --vp-logo-max-h:      40px;
    --vp-logo-pad-x:      6px;
    --vp-logo-pad-y:      4px;
    --vp-logo-radius:     4px;

    --vp-hover-ring-width: 2px;    /* matches Editor ring-2 */

    --vp-title-size:      13px;
    --vp-title-weight:    700;
    --vp-title-tracking:  0.01em;

    --vp-transition:      150ms ease-out;

    /* Schrift: Editor erhaelt Geist via Next.js (--font-geist-sans).
       Im Export laedt style.css "Geist" via @font-face — gleiche Optik. */
    --vp-font-family:     var(--font-geist-sans, "Geist"), "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ============================================================
 * Gemeinsame Component-Styles (Editor + Export + Public-Viewer)
 * ------------------------------------------------------------
 * Diese Klassen werden im Export direkt verwendet. Der Editor
 * (Tailwind/JSX) referenziert dieselben Werte via Tokens und
 * matcht das Aussehen 1:1, ohne dass style.css es ueberschreibt.
 * ============================================================ */

/* Buttons sind transparent in einer Glass-Pill — keine eigene
   Hintergrund-Schicht. Hover gibt einen Akzent-Ring (kein border). */
.icon-button {
    background: transparent;
    border: none;
}
.icon-button:hover {
    border-color: transparent;
    box-shadow: 0 0 0 var(--vp-hover-ring-width) var(--vp-accent-ring);
}
.icon-button.is-active {
    border-color: transparent;
    box-shadow: 0 0 0 var(--vp-hover-ring-width) var(--vp-accent-ring);
}

/* TopBar-Pills: einheitliches Padding und Gap aus Tokens. */
#topBar .top-left,
#topBar .top-center,
#topBar .top-right {
    padding: var(--vp-pill-pad-y) var(--vp-pill-pad-x);
}
#topBar .top-right,
.tool-buttons {
    gap: var(--vp-pill-gap);
}

/* ============================================================
 * Panorama-UI Glass-Aliase (Handoff-kompatibel)
 * ------------------------------------------------------------
 * Die Klassen in panorama-ui-glass.css referenzieren die
 * unprefixed Token-Namen aus dem Handoff. Wir mappen sie auf
 * die existierende --vp-hs-* Suite, damit Theme-Switching
 * (light/dark/glass/minimal/auto) automatisch greift.
 * ============================================================ */
:root {
    --glass:           var(--vp-hs-glass);
    --glass-strong:    var(--vp-hs-glass-strong);
    --glass-line:      var(--vp-hs-glass-line);
    --glass-line-soft: var(--vp-hs-glass-line-soft);
    --ink:             var(--vp-hs-ink);
    --ink-dim:         var(--vp-hs-ink-dim);
    --grad:            var(--vp-hs-fill);
    --on-fill:         var(--vp-hs-on-fill);
    --blur:            var(--vp-hs-blur);
    --sh:              var(--vp-hs-sh);
    /* Handoff-Wert 1:1 (48px). */
    --hit:             48px;
}

/* ============================================================
 * Business Card (Visitenkarte)
 * ------------------------------------------------------------
 * Shared UI between EditorViewport (React) and Export/Public Viewer (viewer.js).
 * Must not rely on Tailwind-only colors (avoid drift).
 * ============================================================ */

.vp-bc-panel {
    position: absolute;
    top: 60px;
    right: 8px;
    z-index: 9000;
    min-width: 200px;
    max-width: 280px;
    pointer-events: auto;

    background: var(--vp-glass-bg);
    border: 1px solid var(--vp-glass-border);
    box-shadow: var(--vp-glass-shadow);
    backdrop-filter: blur(var(--vp-blur)) saturate(var(--vp-saturate));
    -webkit-backdrop-filter: blur(var(--vp-blur)) saturate(var(--vp-saturate));

    border-radius: 12px;
    padding: 12px;
    color: var(--vp-button-text);
    font-family: var(--vp-font-family);
    font-size: 13px;
    line-height: 1.4;

    display: none;
    animation: vp-bc-in 0.15s ease;
}

.vp-bc-panel.visible {
    display: block;
}

@keyframes vp-bc-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.vp-bc-logo {
    border-radius: 10px;
    display: block;
    margin-bottom: 10px;
    height: auto;
    max-width: 100%;
    object-fit: contain;
}

.vp-bc-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.25;
}

.vp-bc-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vp-bc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 10px;
    padding: 6px 8px;
    border: 1px solid var(--vp-glass-border);
    background: var(--vp-button-bg);
    overflow: hidden;
    text-overflow: ellipsis;
}

.vp-bc-row-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    color: var(--vp-text-muted);
}

.vp-bc-row-icon svg {
    width: 16px;
    height: 16px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.vp-bc-row-text {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vp-bc-row--link {
    color: var(--vp-accent);
    text-decoration: none;
}

.vp-bc-row--link:hover {
    color: var(--vp-accent-strong);
    box-shadow: 0 0 0 var(--vp-hover-ring-width) var(--vp-accent-ring);
}

.vp-bc-row--text {
    color: var(--vp-button-text);
    opacity: 0.8;
}

.vp-bc-social {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.vp-bc-social-link {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--vp-button-bg);
    border: 1px solid var(--vp-button-border);
    color: var(--vp-accent);
    text-decoration: none;
    transition: box-shadow 0.16s, color 0.16s, transform 0.12s;
}

.vp-bc-social-link:hover {
    color: var(--vp-accent-strong);
    transform: translateY(-1px);
    box-shadow: 0 0 0 var(--vp-hover-ring-width) var(--vp-accent-ring);
}

.vp-bc-social-icon {
    width: 16px;
    height: 16px;
    display: block;
}

.vp-bc-social-icon[data-ic-kind="brand"] {
    fill: currentColor;
}

.vp-bc-social-icon[data-ic-kind="fallback"] {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.vp-bc-disclaimer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--vp-glass-border);
    font-size: 11px;
    line-height: 1.45;
    color: var(--vp-text-muted);
    overflow-wrap: anywhere;
}

.vp-bc-disclaimer a {
    color: var(--vp-accent);
    text-decoration: underline;
}

.vp-bc-disclaimer a:hover {
    color: var(--vp-accent-strong);
}

.vp-bc-btn {
    overflow: hidden;
    padding: 0;
}

.vp-bc-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
