/**
 * MW-Aufnahme System - Stylesheet
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header & Navigation */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
}

header h1 {
    font-size: 1.5rem;
    color: #fff;
}

nav a {
    color: #888;
    text-decoration: none;
    margin-left: 20px;
    font-size: 0.9rem;
    transition: color 0.2s;
}

nav a:hover,
nav a.active {
    color: #4fc3f7;
}

/* Status-Leiste */
.status-bar {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding: 12px 20px;
    background: #16213e;
    border-radius: 8px;
    font-size: 0.9rem;
}

.status-bar .count {
    font-weight: bold;
    color: #4fc3f7;
}

.status-bar .timestamp {
    color: #666;
    margin-left: auto;
}

/* TICKET-060: Latest-Plugin-Version-Pin im Status-Bar */
.latest-version-pin {
    color: #888;
    font-size: 0.85em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.latest-version-pin input[type="text"] {
    background: #1a1a2e;
    color: #4fc3f7;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.9em;
}
.latest-version-pin input[type="text"]:focus {
    border-color: #4fc3f7;
    outline: none;
}
.latest-version-pin button {
    background: #0f3460;
    color: #4fc3f7;
    border: 1px solid #4fc3f7;
    border-radius: 3px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 0.85em;
}
.latest-version-pin button:hover {
    background: #4fc3f7;
    color: #0f3460;
}
.latest-version-pin button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Szene-laeuft Toggle */
.scene-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    margin-left: 10px;
}

.scene-toggle-label input[type="checkbox"] {
    display: none;
}

.scene-toggle-slider {
    position: relative;
    width: 40px;
    height: 22px;
    background: #333;
    border-radius: 11px;
    transition: background 0.3s;
    flex-shrink: 0;
}

.scene-toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #888;
    border-radius: 50%;
    transition: transform 0.3s, background 0.3s;
}

.scene-toggle-label input:checked + .scene-toggle-slider {
    background: #4caf50;
}

.scene-toggle-label input:checked + .scene-toggle-slider::after {
    transform: translateX(18px);
    background: #fff;
}

.scene-toggle-text {
    font-size: 0.85rem;
    color: #aaa;
    transition: color 0.3s;
}

.scene-toggle-label input:checked ~ .scene-toggle-text {
    color: #4caf50;
    font-weight: 600;
}

.scene-status {
    font-size: 0.8rem;
    color: #4caf50;
    animation: pulse 2s infinite;
}

/* User-Karten */
.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.user-card {
    background: #16213e;
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid #666;
    transition: border-color 0.3s, transform 0.2s;
}

.user-card.online {
    border-left-color: #4caf50;
}

.user-card.offline {
    border-left-color: #f44336;
    opacity: 0.6;
}

/* Offset-Warnung: |Drift| > 1s (TICKET-035) — orange Rand, ueberschreibt
 * den gruenen Rand des Online-Status durch hoehere Spezifitaet. */
.user-card.online.offset-warn {
    border-left-color: #ff9800;
}

.user-card.online.offset-warn .status-dot {
    background: #ff9800;
    box-shadow: 0 0 6px #ff9800;
}

/* Offset-Kritisch: |Drift| > 5s — roter Rand mit Puls */
.user-card.online.offset-crit {
    border-left-color: #f44336;
    animation: offset-pulse 1.4s infinite;
}

.user-card.online.offset-crit .status-dot {
    background: #f44336;
    box-shadow: 0 0 8px #f44336;
}

@keyframes offset-pulse {
    0%, 100% { box-shadow: inset 4px 0 0 #f44336; }
    50%      { box-shadow: inset 4px 0 0 #f44336, 0 0 12px rgba(244, 67, 54, 0.6); }
}

/* Kleines Label fuer Sync-Methode neben dem Drift-Wert */
.user-card .sync-label {
    color: #666;
    font-size: 0.8em;
}

/* Plugin-Version-Anzeige pro User-Card (TICKET-047) */
.user-card .version-current {
    color: #4caf50;
    font-size: 0.85em;
}
.user-card .version-outdated {
    color: #ff9800;
    font-size: 0.85em;
    font-weight: bold;
}
.user-card .version-unknown {
    color: #999;
    font-size: 0.85em;
    font-style: italic;
}

/* Letzte-Sync-Zeit pro User-Card (TICKET-051) */
.user-card .sync-fresh {
    color: #4caf50;
    font-size: 0.85em;
}
.user-card .sync-stale {
    color: #ff9800;
    font-size: 0.85em;
}
.user-card .sync-old {
    color: #f44336;
    font-size: 0.85em;
    font-weight: bold;
}

/* Sync-loss-during-recording sticky Marker (TICKET-043). Persistenter
 * roter Banner ueber dem User-Card, damit der Director nach Stop sofort
 * sieht welche Footage in Post gegen-geprueft werden muss. */
.user-card.sync-lost {
    border: 2px solid #c62828;
}
.user-card .sync-lost-banner {
    background: #c62828;
    color: white;
    padding: 4px 8px;
    margin: -10px -10px 8px -10px;
    border-radius: 4px 4px 0 0;
    font-size: 0.85em;
    font-weight: bold;
    text-align: center;
}

.user-card .name {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.user-card .details {
    font-size: 0.85rem;
    color: #888;
}

.user-card .status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.user-card.online .status-dot {
    background: #4caf50;
    box-shadow: 0 0 6px #4caf50;
    animation: pulse 2s infinite;
}

.user-card.offline .status-dot {
    background: #f44336;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 1.1rem;
}

/* Szenen-Tabelle */
.scene-table {
    width: 100%;
    border-collapse: collapse;
    background: #16213e;
    border-radius: 8px;
    overflow: hidden;
}

.scene-table th,
.scene-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #222;
}

.scene-table th {
    background: #0f3460;
    color: #4fc3f7;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.scene-table td {
    font-size: 0.9rem;
}

.scene-table tbody tr:hover {
    background: #1a2744;
}

/* Modal / Popup */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #16213e;
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal h2 {
    margin-bottom: 20px;
    color: #4fc3f7;
    font-size: 1.3rem;
}

.modal label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: #aaa;
}

.modal input,
.modal textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    background: #0f3460;
    border: 1px solid #333;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.95rem;
}

.modal input:focus,
.modal textarea:focus {
    outline: none;
    border-color: #4fc3f7;
}

.modal textarea {
    resize: vertical;
    min-height: 60px;
}

.modal .btn-row {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-primary {
    background: #4fc3f7;
    color: #1a1a2e;
}

.btn-primary:hover {
    background: #81d4fa;
}

.btn-secondary {
    background: #333;
    color: #ccc;
}

.btn-secondary:hover {
    background: #444;
}

/* Toast-Benachrichtigung */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: #4caf50;
    color: #fff;
    border-radius: 8px;
    font-size: 0.9rem;
    transform: translateY(100px);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    z-index: 2000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    background: #f44336;
}

/* Delete-Button auf User-Karten */
.user-card {
    position: relative;
}

.delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
}

.delete-btn:hover {
    background: #f44336;
    color: #fff;
}

/* Re-Sync Button (TICKET-036) — drei Zustaende:
 *   default      = "Resync jetzt"           — User idle, sofort lieferbar
 *   .resync-queued = "Resync nach Aufnahme"  — User nimmt auf, wird queued
 *   .disabled    = grau/inaktiv             — Cooldown laeuft oder bereits angefragt
 */
.resync-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    background: transparent;
    border: 1px solid #4fc3f7;
    color: #4fc3f7;
    font-size: 0.78rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
    text-align: center;
}

.resync-btn:hover:not(.disabled):not(:disabled) {
    background: #4fc3f7;
    color: #1a1a2e;
}

.resync-btn.resync-queued {
    border-color: #ff9800;
    color: #ff9800;
}

.resync-btn.resync-queued:hover:not(.disabled):not(:disabled) {
    background: #ff9800;
    color: #1a1a2e;
}

.resync-btn.disabled,
.resync-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Force-Stop Button auf Online-Karten */
.force-stop-btn {
    display: block;
    width: calc(100% - 0px);
    margin-top: 10px;
    background: transparent;
    border: 1px solid #f44336;
    color: #f44336;
    font-size: 0.78rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    text-align: center;
}

.force-stop-btn:hover {
    background: #f44336;
    color: #fff;
}

/* Scene-Tabelle Delete-Button */
.scene-delete-btn {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.scene-delete-btn:hover {
    background: #f44336;
    color: #fff;
    border-color: #f44336;
}

/* Stats-Tabelle */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    background: #16213e;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 15px;
}

.stats-table th,
.stats-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #222;
}

.stats-table th {
    background: #0f3460;
    color: #4fc3f7;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.stats-table td {
    font-size: 0.9rem;
}

.participant-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.participant-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #0f3460;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.8rem;
}

.participant-chip .cam-id {
    color: #4fc3f7;
    font-weight: bold;
}

/* Sub-Navigation Tabs */
.sub-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.sub-nav a {
    padding: 8px 16px;
    background: #16213e;
    color: #888;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: background 0.2s, color 0.2s;
}

.sub-nav a:hover,
.sub-nav a.active {
    background: #0f3460;
    color: #4fc3f7;
}
