/* Valaiscom Signage – Screen-Sharing (Mitarbeiter-Startseite)
   Freundlich, klar, mit grosser Monitor-Visualisierung. Grün = verbinden. */

@font-face {
    font-family: 'Manrope';
    src: url('../fonts/Manrope-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --green:        #16A34A;
    --green-hover:  #15803D;
    --green-soft:   #DCFCE7;
    --green-ring:   rgba(22, 163, 74, 0.18);
    --ink:          #18181B;
    --ink-soft:     #52525B;
    --ink-light:    #A1A1AA;
    --surface:      #FFFFFF;
    --bg:           #F7FAF8;
    --border:       #E7E5E4;
    --border-strong:#D6D3D1;
    --danger:       #DC2626;
    --danger-hover: #B91C1C;
    --radius:       10px;
    --radius-lg:    16px;
    --font:         'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --transition:   160ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(1100px 460px at 50% -8%, rgba(22, 163, 74, 0.10), transparent 70%),
        var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Topbar ── */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 28px;
    max-width: 1160px; margin: 0 auto;
}
.brand { display: flex; align-items: center; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.brand strong { font-weight: 800; }
.brand-dot {
    width: 11px; height: 11px; border-radius: 50%; background: var(--green);
    margin-right: 10px; box-shadow: 0 0 0 4px var(--green-ring);
}
.cms-link {
    color: var(--ink-soft); text-decoration: none; font-size: 13.5px; font-weight: 600;
    border: 1px solid var(--border); padding: 8px 15px; border-radius: 8px; background: var(--surface);
    transition: border-color var(--transition), color var(--transition);
}
.cms-link:hover { color: var(--ink); border-color: var(--border-strong); }

/* ── Layout ── */
.share-wrap { max-width: 1160px; margin: 0 auto; padding: 20px 24px 72px; }

.share-head { text-align: center; margin: 14px 0 34px; }
.share-head h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 8px; }
.hint { color: var(--ink-soft); font-size: 16px; margin: 0; }

/* ── Player-Grid ── */
.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(264px, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}
.loading { grid-column: 1 / -1; text-align: center; color: var(--ink-light); padding: 48px 0; font-size: 15px; }

.player-card {
    position: relative;
    display: flex; flex-direction: column; align-items: center;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 18px 20px;
    cursor: pointer; font: inherit; color: inherit; text-align: center;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.player-card:hover { border-color: #BEE7CB; transform: translateY(-3px); box-shadow: 0 12px 26px -12px rgba(22, 163, 74, 0.25); }
.player-card.selected {
    border-color: var(--green);
    box-shadow: 0 0 0 4px var(--green-ring);
}
.player-card.offline { opacity: 0.66; }
.player-card.offline:hover { transform: none; box-shadow: none; border-color: var(--border-strong); }

/* Monitor-Visualisierung */
.monitor-stage {
    height: 150px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    margin-bottom: 6px;
}
.monitor {
    background: #14181d;
    padding: 8px;
    border-radius: 10px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 6px 14px -6px rgba(0,0,0,0.35);
    transition: background var(--transition);
}
.monitor-screen {
    border-radius: 4px;
    background:
        linear-gradient(135deg, #2b3440 0%, #1c2530 100%);
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
    transition: background var(--transition);
}
.monitor-screen::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(120deg, rgba(255,255,255,0.10) 0%, transparent 45%);
}
.monitor-format {
    position: relative; z-index: 1;
    font-size: 13px; font-weight: 700; letter-spacing: 0.06em;
    color: rgba(255,255,255,0.78);
}
.monitor-neck { width: 34px; height: 10px; background: #14181d; margin-top: -1px; }
.monitor-base { width: 78px; height: 6px; border-radius: 0 0 5px 5px; background: #14181d; }

/* Ausgewählt → Bildschirm leuchtet grün */
.player-card.selected .monitor { background: var(--green); }
.player-card.selected .monitor-screen { background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%); }
.player-card.selected .monitor-format { color: #fff; }
.player-card.selected .monitor-neck,
.player-card.selected .monitor-base { background: var(--green); }

/* Grünes Häkchen bei Auswahl */
.pc-check {
    position: absolute; top: 14px; right: 14px;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--green); color: #fff;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transform: scale(0.6);
    transition: opacity var(--transition), transform var(--transition);
}
.pc-check svg { width: 15px; height: 15px; }
.player-card.selected .pc-check { opacity: 1; transform: scale(1); }

.pc-body { width: 100%; }
.pc-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.pc-format { font-size: 12.5px; color: var(--ink-light); margin: 3px 0 9px; font-variant-numeric: tabular-nums; }
.pc-status {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
    background: #F4F4F5; padding: 4px 11px; border-radius: 999px;
}
.pc-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pc-dot.on  { background: var(--green); box-shadow: 0 0 0 3px var(--green-ring); }
.pc-dot.off { background: var(--ink-light); }

/* ── Aktionsleiste (Name + Verbinden) ── */
.action-bar {
    display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
    justify-content: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 18px 22px; box-shadow: 0 1px 3px rgba(10,10,10,0.05);
    position: sticky; bottom: 18px; max-width: 620px; margin: 0 auto;
}
.name-row { flex: 1; min-width: 200px; text-align: left; }
.name-row label { display: block; font-size: 12.5px; color: var(--ink-soft); font-weight: 600; margin-bottom: 6px; }
.name-row .optional { color: var(--ink-light); font-weight: 400; }
.name-row input {
    width: 100%; padding: 11px 14px; border-radius: 9px;
    border: 1px solid var(--border); background: var(--surface); color: var(--ink);
    font-size: 15px; font-family: inherit; outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.name-row input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-ring); }

/* ── Buttons ── */
.btn-connect, .btn-danger {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    font-size: 16px; font-weight: 700; font-family: inherit;
    padding: 14px 26px; border: none; border-radius: 11px; color: #fff;
    cursor: pointer; white-space: nowrap;
    transition: background var(--transition), box-shadow var(--transition), transform var(--transition), opacity var(--transition);
}
.btn-connect svg { width: 19px; height: 19px; }
.btn-connect {
    background: var(--green);
    box-shadow: 0 8px 18px -6px var(--green-ring);
}
.btn-connect:hover:not(:disabled) { background: var(--green-hover); transform: translateY(-1px); }
.btn-connect:disabled { background: #D8DCD9; color: #fff; cursor: not-allowed; box-shadow: none; }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); transform: translateY(-1px); }

.error-msg {
    display: block; margin: 20px auto 0; max-width: 620px; text-align: center;
    color: #991B1B; background: #FEE2E2; border: 1px solid #FECACA;
    border-radius: 10px; padding: 12px 16px; font-size: 14px; font-weight: 500;
}
.error-msg[hidden] { display: none; }

/* ── Live-Ansicht ── */
.live-card {
    max-width: 900px; margin: 10px auto 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px; box-shadow: 0 12px 30px -16px rgba(10,10,10,0.2);
}
.live-top { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.live-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--green-soft); color: var(--green-hover);
    font-size: 13px; font-weight: 800; letter-spacing: 0.04em;
    padding: 7px 14px; border-radius: 999px; flex-shrink: 0;
}
.live-pulse {
    width: 9px; height: 9px; border-radius: 50%; background: var(--green);
    box-shadow: 0 0 0 0 var(--green-ring); animation: pulse 1.6s infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.35); }
    70%  { box-shadow: 0 0 0 9px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
.live-heading h1 { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.live-status { color: var(--ink-soft); font-size: 14px; margin: 3px 0 0; }
.live-status.ok   { color: var(--green-hover); font-weight: 600; }
.live-status.warn { color: #B45309; font-weight: 600; }

.preview-box {
    background: #0c1116; border-radius: 12px; overflow: hidden;
    border: 1px solid var(--border); margin-bottom: 20px; aspect-ratio: 16 / 9;
}
.preview-box video { width: 100%; height: 100%; object-fit: contain; }

@media (max-width: 560px) {
    .share-head h1 { font-size: 26px; }
    .player-grid { grid-template-columns: 1fr; }
    .action-bar { flex-direction: column; align-items: stretch; position: static; }
    .btn-connect { width: 100%; }
}
