/* Gemeinsame Grundlage beider Dashboards.
 *
 * ⚠️ **Die `--glass-*`-Namen sind eine Übergangsschicht.** Sie stehen in hunderten
 * Deklarationen quer durch elf Stylesheets; sie alle auf einmal umzuschreiben, hieße,
 * einen Fehler erst am Ende zu bemerken. Stattdessen zeigen sie ab dem 18.09.2026 auf
 * die Catinity-Werte aus `tokens.css` — jede Seite steht damit sofort richtig, und die
 * Deklarationen wandern Datei für Datei nach. Ist die letzte umgestellt, verschwindet
 * dieser Block ersatzlos.
 *
 * ⛔ `tokens.css` muss VOR dieser Datei geladen werden, sonst sind die Variablen leer. */
:root {
    /* Flächen */
    --glass-dark: var(--ebene-2);
    --glass-darker: var(--grund);
    --glass-surface: var(--flaeche);
    --glass-surface-hover: var(--flaeche-gehoben);
    --glass-border: var(--feldrand);

    /* Akzent */
    --glass-accent: var(--akzent);
    --glass-accent-dim: var(--akzent-fuellung);

    /* Text */
    --glass-text-primary: var(--text-stark);
    --glass-text-secondary: var(--text-normal);
    --glass-text-tertiary: var(--text-schwach);

    /* Abstände bleiben vorerst, wie sie sind: Sie sind eine Skala (4…32), Catinity
       dagegen nennt Rollen (Kartenpolsterung 26, Kartenabstand 20). Das ist ein
       Layout-Eingriff und gehört nicht in eine reine Farb-Etappe. */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Radien: Catinity kennt nur vier Stufen (8/9/16/100). Die alten fünf werden
       darauf abgebildet — 12 und 20 verschwinden. */
    --radius-sm: var(--radius-eingabe);
    --radius-md: var(--radius-knopf);
    --radius-lg: var(--radius-karte);
    --radius-xl: var(--radius-karte);

    /* Glas: Die Quelle nennt genau einen Wert — backdrop-filter: blur(20px). */
    --blur-sm: 8px;
    --blur-md: 16px;
    --blur-lg: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow: hidden;
    position: fixed;
    width: 100%;
}

body {
    font-family: var(--schrift);
    /* ⛔ Hier standen zwei `radial-gradient` in Cyan. Die Catinity-Haltung schließt
       das aus: „Kein Verlauf, keine Illustration, keine Zierde." Sie lagen zudem
       hinter dem Kamerabild und färbten die Ränder ein. */
    background: var(--grund);
    height: 100%;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: var(--spacing-md);
    color: var(--text-stark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
}

/* Button Styles */
button {
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Kein Doppeltipp-Zoom auf Bedienelementen; Pinch-Zoom der Seite bleibt erlaubt (WCAG 1.4.4) */
button,
input,
select,
textarea,
summary,
[role="button"],
[role="tab"],
[role="switch"] {
    touch-action: manipulation;
}

.btn {
    padding: var(--spacing-md) var(--spacing-lg);
    border: 1px solid var(--feldrand);
    border-radius: var(--radius-md);
    background: var(--flaeche);
    backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
    color: var(--text-stark);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    background: var(--flaeche-gehoben);
    border-color: var(--akzent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 212, 212, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: rgba(0, 212, 212, 0.15);
    border-color: rgba(0, 212, 212, 0.3);
    color: var(--akzent);
}

.btn-primary:hover {
    background: rgba(0, 212, 212, 0.25);
    border-color: rgba(0, 212, 212, 0.5);
    box-shadow: 0 12px 32px rgba(0, 212, 212, 0.3);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--text-stark);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 12px 32px rgba(239, 68, 68, 0.3);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--flaeche);
    backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: blur(var(--blur-lg));
    border: 1px solid var(--feldrand);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    min-height: calc(100vh - 32px);
    position: relative;
    overflow: hidden;
}

/* ⛔ Hier lag eine Zierlinie: ein Verlauf, der zur Mitte hin im Akzent aufleuchtete.
   Catinity: „Kein Verlauf, keine Illustration, keine Zierde." Die Kante bleibt, sie
   trennt den Rahmen sichtbar vom Grund — sie leuchtet nur nicht mehr. */
.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--trennlinie);
}

/* Header */
.header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--feldrand);
    position: relative;
}

.header h1 {
    color: var(--text-stark);
    margin-bottom: var(--spacing-sm);
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 8px rgba(0, 212, 212, 0.3);
}

.header p {
    color: var(--text-normal);
    font-size: 14px;
    margin: 0;
}

/* Status */
.status {
    background: var(--flaeche);
    backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
    border: 1px solid var(--feldrand);
    border-left: 2px solid var(--akzent);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-stark);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

/* Toast */
.toast {
    background: var(--flaeche);
    backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
    border: 1px solid var(--feldrand);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    font-weight: 500;
    font-size: 14px;
    color: var(--text-stark);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.toast.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 2px solid rgba(239, 68, 68, 0.6);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2);
}

.toast.success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-left: 2px solid rgba(34, 197, 94, 0.6);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.2);
}

.toast.info {
    background: rgba(0, 212, 212, 0.15);
    border: 1px solid rgba(0, 212, 212, 0.3);
    border-left: 2px solid rgba(0, 212, 212, 0.6);
    box-shadow: 0 4px 16px rgba(0, 212, 212, 0.2);
}

.toast.mini {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    opacity: 0.85;
}

.toast.inspection {
    padding: 4px 8px;
    font-size: 12px;
    margin-bottom: 4px;
    border-radius: 4px;
    opacity: 0.8;
    min-width: auto;
    max-width: 200px;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 400px;
}

/* Inspection mode (Customer): show toasts center-bottom with tighter spacing */
.toast-container.inspection-mode {
    top: auto;
    bottom: 100px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    max-width: 250px;
    gap: 4px;
}

/* Inspection mode - individual toasts */
.toast-container.inspection-mode .toast {
    padding: 4px 8px;
    font-size: 12px;
    margin-bottom: 4px;
}

/* Surveyor Dashboard: use mini toasts and stack vertically */
.toast-container.surveyor-mode {
    gap: 6px;
    max-width: 280px;
    /* Keep default position: top-right */
}

/* Surveyor mode - individual mini toasts */
.toast-container.surveyor-mode .toast.mini,
.toast-container.surveyor-mode .toast.success,
.toast-container.surveyor-mode .toast.error {
    padding: 5px 10px;
    font-size: 12px;
    margin-bottom: 2px;
}

.toast-container > * {
    pointer-events: auto;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--akzent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Video Container */
.video-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .video-container {
        grid-template-columns: 1fr;
    }
}

.video-wrapper {
    position: relative;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--feldrand);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    aspect-ratio: 16 / 9;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.video-wrapper:hover {
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Orientierungsabhängige Video Aspect Ratios */
@media (orientation: portrait) {
    .video-wrapper {
        aspect-ratio: 9 / 16;  /* Portrait: höher als breit */
    }
}

@media (orientation: landscape) {
    .video-wrapper {
        aspect-ratio: 16 / 9;  /* Landscape: breiter als hoch */
    }
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/**
 * Inspection Mode Video - NUR z-index ändern
 * Kein position:relative um stacking context NICHT zu ändern
 * Das verhindert WebRTC-Rendering-Probleme
 */
.video-wrapper.inspection-mode-video {
    z-index: 101;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: blur(var(--blur-lg));
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--flaeche);
    backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: blur(var(--blur-lg));
    border: 1px solid var(--feldrand);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    max-width: 500px;
    width: 90%;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        border-radius: var(--radius-lg);
        padding: var(--spacing-md);
    }

    .header h1 {
        font-size: 24px;
    }

    .btn {
        padding: var(--spacing-md);
        font-size: 14px;
    }
}

/* ============================================
   Barrierefreiheit — gilt für alle Seiten
   ============================================

   ⛔ Diese beiden Blöcke standen bis zum 18.09.2026 in `phase-3-advanced.css`,
   die im selben Zug gelöscht wurde. Sie sind der Grund, warum die Datei NICHT
   einfach entfernt werden konnte: Ein Abgleich der Klassennamen sah sie nicht,
   weil sie über Media-Queries wirken, nicht über Klassen.

   Der globale `*`-Block ist der einzige, der auch die Animationen in den
   <style>-Blöcken der HTML-Dateien erfasst; die anderen CSS-Dateien haben je
   eigene `prefers-reduced-motion`-Regeln nur für ihre eigenen Bausteine. */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Windows-Kontrastmodus: Bedienelemente übernehmen die Systemfarben. */
@media (forced-colors: active) {
    button,
    input,
    select {
        border: 1px solid ButtonBorder;
        background-color: ButtonFace;
        color: ButtonText;
    }

    button:hover {
        background-color: Highlight;
        color: HighlightText;
    }
}
