/* === FONT === */
@font-face {
    font-family: 'Manrope';
    src: url('/assets/fonts/Manrope-VariableFont_wght.woff2') format('woff2');
    font-weight: 200 800;
    font-display: swap;
}

/* === KIOSK RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --kiosk-accent: #009942;
    --kiosk-accent-soft: rgba(0, 153, 66, 0.22);
    --kiosk-bg: #111;
}

::selection {
    background: rgba(0, 153, 66, 0.18);
    color: #ffffff;
}

.kiosk-debug-label {
    position: absolute;
    left: 50%;
    bottom: 20vh;
    transform: translateX(-50%);
    width: fit-content;
    max-width: min(92vw, 1600px);
    color: #ff2a2a;
    font-size: clamp(2.75rem, 6vw, 5.5rem);
    font-weight: 800;
    line-height: 1;
    text-align: center;
    letter-spacing: 0.03em;
    background: #ffffff;
    border: 4px solid #ff2a2a;
    border-radius: 18px;
    padding: 0.4em 0.7em;
    box-shadow: none;
    z-index: 6;
    pointer-events: none;
    user-select: none;
}

body.kiosk-mode {
    overflow: hidden;
    cursor: none;
    background: var(--kiosk-bg);
    font-family: 'Manrope', sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-user-select: none;
    user-select: none;
}

body.kiosk-mode.cursor-visible {
    cursor: default;
}

/* === LAYOUT (fullscreen slideshow) === */

/*
 * .kiosk-scene  — rotation wrapper. Carries the CSS transform that orients the
 *                 display for the physical screen. Also acts as a flex container
 *                 so a module panel can share the rotated viewport alongside the
 *                 slideshow without a separate rotation step.
 *
 * .kiosk-container — the slideshow area. Fills the whole scene when no module is
 *                 active; shrinks to remaining flex space when a module panel is
 *                 shown. No longer rotated itself — rotation lives in .kiosk-scene.
 */
.kiosk-scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    transform-origin: 0 0;
    display: flex;
}

/* Orientation rotation — applied only to kiosk side; admin is unaffected. */
body.kiosk-mode[data-orientation="horizontal"] .kiosk-scene {
    transform: none;
}

body.kiosk-mode[data-orientation="horizontal-180"] .kiosk-scene {
    transform: translate(100vw, 100vh) rotate(180deg);
}

body.kiosk-mode[data-orientation="vertical"] .kiosk-scene {
    width: 100vh;
    height: 100vw;
    transform: translate(100vw, 0) rotate(90deg);
}

body.kiosk-mode[data-orientation="vertical-180"] .kiosk-scene {
    width: 100vh;
    height: 100vw;
    transform: translate(0, 100vh) rotate(-90deg);
}

/* Module panel position — flex direction */
.kiosk-scene[data-module-position="right"]  { flex-direction: row; }
.kiosk-scene[data-module-position="left"]   { flex-direction: row-reverse; }
.kiosk-scene[data-module-position="bottom"] { flex-direction: column; }
.kiosk-scene[data-module-position="top"]    { flex-direction: column-reverse; }

.kiosk-container {
    overflow: hidden;
    flex: 1;
    /* min-size prevents flex from collapsing to 0 when --module-size is large */
    min-width: 0;
    min-height: 0;
}

/* === MODULE PANEL === */
.kiosk-module-panel {
    flex-shrink: 0;
    overflow: hidden;
    background: #000;
    /* Isolation: module CSS cannot accidentally style .kiosk-container children */
    isolation: isolate;
}

.kiosk-scene[data-module-position="right"]  .kiosk-module-panel,
.kiosk-scene[data-module-position="left"]   .kiosk-module-panel {
    width: var(--module-size, 30%);
    height: 100%;
}

.kiosk-scene[data-module-position="bottom"] .kiosk-module-panel,
.kiosk-scene[data-module-position="top"]    .kiosk-module-panel {
    width: 100%;
    height: var(--module-size, 30%);
}

/* Module content wrapper — fills the panel */
.kiosk-module-content {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}


.kiosk-slideshow {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
    background: #000;
    overflow: hidden;
}

.kiosk-slideshow.showing-selector {
    overflow-y: auto;
}

.kiosk-slideshow.showing-selector .slideshow-container {
    position: relative;
    inset: auto;
    width: 100%;
    height: 100%;
    min-height: 100%;
}

.kiosk-slideshow.showing-selector .group-selector {
    min-height: 100%;
    height: 100%;
}

.slideshow-container {
    position: absolute;
    inset: 0;
}

/* Slide media (billeder + videoer) */
.slideshow-container .slide-media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: translate3d(0, 0, 0);
    z-index: 0;
    border-radius: 0;
    pointer-events: none;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.slideshow-container .slide-media.active {
    opacity: 1;
    z-index: 1;
}

.slideshow-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
}

.slideshow-placeholder-text {
    color: rgba(255,255,255,0.3);
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.slideshow-placeholder-subtext {
    color: rgba(255,255,255,0.5);
    font-size: 1.3rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: none;
}

/* Clock overlay */
.kiosk-clock {
    position: absolute;
    color: #fff;
    font-weight: 700;
    text-shadow: 0 2px 12px rgba(0,0,0,0.7);
    z-index: 5;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    user-select: none;
    max-width: calc(100vw - 4vw);
}

.kiosk-clock--top-left {
    top: 2vh;
    left: 2vw;
}

.kiosk-clock--top-right {
    top: 2vh;
    right: 2vw;
}

.kiosk-clock--bottom-left {
    bottom: 2vh;
    left: 2vw;
}

.kiosk-clock--bottom-right {
    bottom: 2vh;
    right: 2vw;
}

.kiosk-clock--center {
    top: 50%;
    left: 50%;
    text-align: center;
    max-width: calc(100vw - 8vw);
}

.kiosk-clock--small {
    font-size: 3vh;
}

.kiosk-clock--medium {
    font-size: 5vh;
}

.kiosk-clock--large {
    font-size: 7vh;
}

.kiosk-clock--custom {
    /* Size set via inline style */
}

/* Logo overlay */
.kiosk-logo {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    user-select: none;
    object-fit: contain;
}

.kiosk-logo--top-left {
    top: 2vh;
    left: 2vw;
}

.kiosk-logo--top-right {
    top: 2vh;
    right: 2vw;
}

.kiosk-logo--bottom-left {
    bottom: 2vh;
    left: 2vw;
}

.kiosk-logo--bottom-right {
    bottom: 2vh;
    right: 2vw;
}

.kiosk-logo--center {
    top: 50%;
    left: 50%;
}

.kiosk-logo--small {
    max-height: 6vh;
    max-width: 12vw;
}

.kiosk-logo--medium {
    max-height: 10vh;
    max-width: 18vw;
}

.kiosk-logo--large {
    max-height: 16vh;
    max-width: 25vw;
}

.kiosk-logo--custom {
    /* Size set via inline style */
}

/* Progress bar */
.slideshow-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 1.5vh;
    width: 0%;
    background: var(--kiosk-accent);
    z-index: 10;
    pointer-events: none;
}

/* === GROUP SELECTOR === */
.group-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    padding: 2rem;
    cursor: default;
}

.group-selector-title {
    color: rgba(255,255,255,0.85);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    letter-spacing: 0.02em;
}

.group-selector-loading,
.group-selector-empty {
    color: rgba(255,255,255,0.4);
    font-size: 1.5rem;
    font-weight: 500;
}

.group-selector-retry {
    margin-top: 1rem;
    font-size: 1.1rem;
    color: rgba(255,255,255,0.3);
    font-variant-numeric: tabular-nums;
}

.group-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    max-width: 1200px;
}

.group-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    padding: 0;
    width: 220px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
    color: #fff;
    font-family: inherit;
    font-size: inherit;
}

.group-tile:hover,
.group-tile:focus-visible {
    transform: scale(1.05);
    border-color: var(--kiosk-accent);
    box-shadow: 0 0 0 4px var(--kiosk-accent-soft);
    outline: none;
}

.group-tile-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background-size: cover;
    background-position: center;
    border-radius: 14px 14px 0 0;
}

.group-tile-name {
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0.75rem 1rem 0.25rem;
    text-align: center;
}

.group-tile-count {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
    padding: 0 1rem 0.75rem;
}

/* ===== PiP overlays ===== */
/* Iframes der "svæver" oven på .kiosk-scene. Position/size sættes inline via JS. */
.kiosk-pip-overlay {
    position: absolute;
    border: 0;
    background: transparent;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}
.kiosk-scene { position: relative; }

/* PiP-mode: iframen selv (kanalen der vises som overlay) — transparent baggrund
   så hovedkanalen kan ses igennem alt, hvad PiP-kanalen ikke selv tegner.
   Slides har deres egen slide_bg_color (sat inline af JS) — derfor !important. */
body.kiosk-pip-mode,
body.kiosk-pip-mode .kiosk-scene,
body.kiosk-pip-mode .kiosk-container,
body.kiosk-pip-mode .kiosk-slideshow,
body.kiosk-pip-mode .slideshow-container,
body.kiosk-pip-mode .slide-media,
body.kiosk-pip-mode .kiosk-module-panel {
    background: transparent !important;
    background-color: transparent !important;
}
body.kiosk-pip-mode .kiosk-pip-overlay {
    /* Undgå nested overlays — JS skipper allerede, men dobbeltsikring. */
    display: none !important;
}

