/* Admin-paneel — eenvoudige, leesbare stijl. */
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: #f4f6f8;
    color: #1f2933;
    line-height: 1.5;
}

header.topbar {
    background: linear-gradient(90deg, #111826 0%, #1f2933 100%);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0 1.25rem;
    height: 60px;
    box-shadow: 0 1px 0 rgba(255,255,255,0.05), 0 2px 12px rgba(0,0,0,0.25);
    position: sticky; top: 0; z-index: 200;
}
header.topbar .brand { font-weight: 700; font-size: 1.05rem; color: #fff; text-decoration: none; display: flex; align-items: center; gap: 0.4rem; }
header.topbar nav { display: flex; gap: 0.35rem; flex: 1; flex-wrap: wrap; }
header.topbar nav a {
    color: #cbd2d9;
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
    font-size: 0.92rem;
    transition: background 0.15s, color 0.15s;
}
header.topbar nav a .nav-ico { font-size: 1.05rem; line-height: 1; }
header.topbar nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
header.topbar nav a.active { color: #fff; background: #3b82f6; }
.topbar .brand-logo { height: 38px; max-width: 180px; object-fit: contain; display: block; background: #fff; border-radius: 6px; padding: 3px 6px; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.user-menu { position: relative; }
.user-chip { display: inline-flex; align-items: center; gap: 0.5rem; color: #e4e7eb; font-size: 0.9rem;
    background: rgba(255,255,255,0.06); border: 0; cursor: pointer; padding: 0.3rem 0.6rem; border-radius: 999px; font: inherit; }
.user-chip:hover { background: rgba(255,255,255,0.12); }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background: #3b82f6; color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; flex: 0 0 auto; }
.user-dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px;
    background: #fff; color: #1f2933; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    padding: 0.85rem 1rem; display: none; z-index: 300;
}
.user-dropdown.open { display: block; }
.user-dropdown .ud-name { font-weight: 700; }
.user-dropdown .ud-role { color: #3b82f6; font-size: 0.82rem; font-weight: 600; }
.user-dropdown .ud-school { font-weight: 600; margin-top: 0.1rem; }
.user-dropdown .ud-addr { color: #52606d; font-size: 0.85rem; }
.user-dropdown .ud-sep { border-top: 1px solid #eef0f2; margin: 0.6rem 0; }
.user-dropdown .ud-logout { color: #c92a2a; text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.user-dropdown .ud-logout:hover { text-decoration: underline; }
@media (max-width: 700px) { header.topbar nav a .nav-lbl { display: none; } .user-chip-name { display: none; } }

main { max-width: 1000px; margin: 1.5rem auto; padding: 0 1.25rem; }
main.wide { max-width: 1600px; }
h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.75rem; }

.card {
    background: #fff;
    border: 1px solid #e4e7eb;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid #e4e7eb; vertical-align: middle; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: #7b8794; }

label { display: block; font-size: 0.85rem; color: #52606d; margin: 0.5rem 0 0.2rem; }
input[type=text], input[type=password], input[type=email], input[type=url],
input[type=number], input[type=date], input[type=time], select, textarea {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid #cbd2d9;
    border-radius: 6px;
    font: inherit;
}
textarea { min-height: 80px; resize: vertical; }

.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 160px; }

button, .btn {
    display: inline-block;
    background: #3b82f6;
    color: #fff;
    border: 0;
    border-radius: 6px;
    padding: 0.5rem 0.9rem;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}
button:hover, .btn:hover { background: #2f6fd6; }
button.secondary, .btn.secondary { background: #e4e7eb; color: #1f2933; }
button.danger, .btn.danger { background: #e12d39; }
button.small, .btn.small { padding: 0.25rem 0.5rem; font-size: 0.85rem; }

.flash { background: #d3f9d8; border: 1px solid #69db7c; color: #2b8a3e; padding: 0.6rem 0.9rem; border-radius: 6px; margin-bottom: 1rem; }
.muted { color: #7b8794; font-size: 0.9rem; }
.pill { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.75rem; }
.pill.on { background: #d3f9d8; color: #2b8a3e; }
.pill.off { background: #ffe3e3; color: #c92a2a; }
.pill.pending { background: #fff3bf; color: #a87b00; }
.thumb { width: 64px; height: 40px; object-fit: cover; border-radius: 4px; background: #e4e7eb; }

.login-wrap { max-width: 340px; margin: 8vh auto; }
.login-or { display: flex; align-items: center; text-align: center; color: #9aa5b1; font-size: 0.85rem; margin: 1rem 0; }
.login-or::before, .login-or::after { content: ""; flex: 1; border-top: 1px solid #e4e7eb; }
.login-or span { padding: 0 0.75rem; }
.btn-google {
    display: flex; align-items: center; justify-content: center; gap: 0.6rem;
    width: 100%; padding: 0.6rem 0.9rem;
    background: #fff; color: #3c4043; border: 1px solid #dadce0; border-radius: 8px;
    font-family: "Roboto", system-ui, sans-serif; font-size: 0.95rem; font-weight: 600;
    text-decoration: none; cursor: pointer; transition: background 0.15s, box-shadow 0.15s;
}
.btn-google:hover { background: #f7f8f8; box-shadow: 0 1px 3px rgba(60,64,67,0.15); }
.btn-google svg { flex: 0 0 auto; }

/* --- Visuele layout-editor (schermvullende modal) --- */
.le-modal { position: fixed; inset: 0; z-index: 1000; background: #1f2933; display: none; flex-direction: column; }
.le-modal.open { display: flex; }
.le-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1rem; background: #111826; color: #fff; flex-wrap: wrap; }
.le-bar .sep { flex: 1; }
.le-bar-add { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; }
.le-body { flex: 1; display: flex; min-height: 0; }
.le-stagewrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; overflow: auto; }
.le-side { width: 340px; flex: 0 0 340px; background: #f4f6f8; color: #1f2933; overflow: auto; padding: 1rem; border-left: 1px solid #000; }
.le-zonelist-wrap { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.75rem; }
#le-zonelist { display: inline-flex; gap: 0.35rem; flex-wrap: wrap; }

#le-canvas {
    position: relative;
    width: min(100%, calc((100vh - 150px) * 16 / 9));
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    overflow: hidden;
    user-select: none;
    touch-action: none;
}
.le-zone {
    position: absolute;
    background: rgba(59,130,246,0.18);
    border: 1px solid #3b82f6;
    color: #fff;
    cursor: move;
    box-sizing: border-box;
    overflow: hidden;
    touch-action: none;
}
.le-zone.sel { border-color: #fbbf24; box-shadow: inset 0 0 0 2px rgba(251,191,36,0.7); }
.le-zone .le-label { font-size: 0.72rem; padding: 2px 5px; display: inline-block; background: rgba(0,0,0,0.4); pointer-events: none; }
.le-zone .le-handle {
    position: absolute; right: -1px; bottom: -1px; width: 18px; height: 18px;
    background: #fbbf24; cursor: se-resize; border-top-left-radius: 4px;
}
#le-props h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.le-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 0.75rem; }
#le-props input[type=color] { width: 48px; height: 32px; padding: 2px; vertical-align: middle; }
button.saved { background: #2b8a3e; }

/* --- Schermen: modern raster --- */
.page-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; flex: 1; }
.head-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.inline-form { display: flex; gap: 0.4rem; align-items: center; }
.inline-form input { padding: 0.4rem 0.6rem; }
.section-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: #7b8794; margin: 1.25rem 0 0.6rem; }

.screen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 1.25rem; }
.screen-tile {
    background: #fff; border: 1px solid #e4e7eb; border-radius: 12px; overflow: hidden;
    display: flex; flex-direction: column; box-shadow: 0 1px 3px rgba(16,24,40,0.06);
    transition: box-shadow 0.15s, transform 0.15s;
}
.screen-tile:hover { box-shadow: 0 6px 20px rgba(16,24,40,0.12); transform: translateY(-1px); }
/* Melding gekoppeld aan één schermkaart. */
.card-flash {
    margin: 0; border-radius: 0; border: 0; border-bottom: 1px solid #69db7c;
    font-size: 0.85rem; line-height: 1.35; padding: 0.55rem 0.8rem;
    white-space: normal; overflow-wrap: anywhere;
    transition: opacity 0.6s ease;
}
.card-flash.fade { opacity: 0; }
.screen-tile.flash-target { box-shadow: 0 0 0 2px #69db7c, 0 6px 20px rgba(16,24,40,0.12); transition: box-shadow 0.6s ease; }
.tile-pending { border-color: #fcc419; }

.st-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 0.9rem; }
.st-name { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #cbd2d9; flex: 0 0 auto; }
.status-dot.on { background: #37b24d; box-shadow: 0 0 0 3px rgba(55,178,77,0.18); }
.status-dot.off { background: #e03131; box-shadow: 0 0 0 3px rgba(224,49,49,0.15); }
.status-dot.pending { background: #f59f00; box-shadow: 0 0 0 3px rgba(245,159,0,0.18); }

.st-thumb {
    display: block; aspect-ratio: 16 / 9; background: #0b1220;
    display: flex; align-items: center; justify-content: center; position: relative;
}
.st-thumb img { width: 100%; height: 100%; object-fit: cover; }
.st-thumb.is-off img, .dt-thumb.is-off img { filter: grayscale(1) brightness(0.4); }
.st-thumb .placeholder { font-size: 2.2rem; opacity: 0.5; }
/* Overlay wanneer het scherm uit (hoort te) staan. */
.st-off {
    position: absolute; inset: 0; z-index: 2;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.15rem; background: rgba(11, 18, 32, 0.55);
    color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: 0.02em;
}
.st-off .st-off-ic { font-size: 1.8rem; line-height: 1; }
.st-off small { font-weight: 500; font-size: 0.72rem; opacity: 0.85; text-transform: uppercase; }

/* Uitschakelmethode: lijst met selectievakjes (combinaties mogelijk). */
.pm-form { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.5rem; }
.pm-check { display: flex; align-items: center; gap: 0.45rem; margin: 0; font-weight: 500; cursor: pointer; }

/* Badge wanneer er een tijdelijk evenement actief is op het scherm. */
.ev-badge {
    position: absolute; top: 6px; left: 6px; z-index: 3;
    display: inline-flex; align-items: center; gap: 0.25rem;
    max-width: calc(100% - 12px); box-sizing: border-box;
    padding: 0.12rem 0.5rem; border-radius: 999px;
    background: #f3d9fa; color: #862e9c; border: 1px solid #eebefa;
    font-size: 0.72rem; font-weight: 700; line-height: 1.4;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ev-badge[hidden] { display: none; }
.ev-badge .ev-name { overflow: hidden; text-overflow: ellipsis; }
/* Evenementnaam in de meta-/dashboardtekst. */
.ev-row[hidden] { display: none; }
.ev-row strong, .dt-event { color: #862e9c !important; font-weight: 700; }

.st-body { padding: 0.5rem 0.9rem 0.75rem; text-align: center; }
.code-big { font-size: 1.8rem; font-weight: 700; letter-spacing: 0.18em; }
.st-sub { font-size: 0.8rem; color: #7b8794; }

.st-meta { padding: 0.6rem 0.9rem; display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; }
.st-meta .row2 { display: flex; justify-content: space-between; gap: 0.5rem; color: #52606d; }
.st-meta .row2 strong { color: #1f2933; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.st-actions { display: flex; gap: 0.35rem; padding: 0 0.9rem 0.75rem; flex-wrap: wrap; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border: 1px solid #e4e7eb; border-radius: 8px;
    background: #f4f6f8; cursor: pointer; font-size: 1rem; text-decoration: none; color: #1f2933;
}
.icon-btn:hover { background: #e8edf2; }
.icon-btn.danger { background: #fff0f0; border-color: #ffc9c9; color: #c92a2a; }
.icon-btn.active { background: #d3f9d8; border-color: #69db7c; box-shadow: inset 0 0 0 1px #69db7c; }

.st-details { border-top: 1px solid #eef0f2; }
.st-details > summary {
    cursor: pointer; padding: 0.6rem 0.9rem; font-size: 0.85rem; color: #3b82f6;
    list-style: none; user-select: none;
}
.st-details > summary::-webkit-details-marker { display: none; }
.st-details > summary::before { content: '⚙ '; }
.st-details[open] > summary { font-weight: 600; }
.st-settings { padding: 0 0.9rem 0.9rem; }
.st-settings label { margin-top: 0.5rem; }
.st-more { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem; margin-top: 0.4rem; }
.st-more form { margin: 0; }
.st-more form > button { width: 100%; }

/* --- Slideshow-editor --- */
.slide-list { display: flex; flex-direction: column; gap: 0.4rem; }
.slide-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem; border: 1px solid #eef0f2; border-radius: 8px; background: #fff; }
.slide-nr { width: 1.6rem; text-align: center; color: #7b8794; font-size: 0.85rem; }
.slide-thumb { width: 72px; height: 44px; border-radius: 6px; background: #e4e7eb; display: flex; align-items: center; justify-content: center; overflow: hidden; flex: 0 0 auto; }
.slide-thumb img { width: 100%; height: 100%; object-fit: cover; }
.slide-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide-actions { display: flex; gap: 0.3rem; align-items: center; }
.slide-dur { display: inline-flex; align-items: center; gap: 0.3rem; color: #687078; font-size: 0.9rem; white-space: nowrap; flex: 0 0 auto; }

/* --- Dashboard --- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat-card {
    background: #fff; border: 1px solid #e4e7eb; border-radius: 12px; padding: 1.1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(16,24,40,0.06); text-decoration: none; color: inherit; display: block;
    transition: box-shadow 0.15s, transform 0.15s;
}
.stat-card:hover { box-shadow: 0 6px 20px rgba(16,24,40,0.12); transform: translateY(-1px); }
.stat-card .num { font-size: 2.2rem; font-weight: 700; line-height: 1; color: #1f2933; }
.stat-card .num-of { font-size: 1.1rem; color: #9aa5b1; font-weight: 600; }
.stat-card .lbl { color: #52606d; font-size: 0.9rem; margin-top: 0.35rem; }
.stat-card .sub { font-size: 0.8rem; margin-top: 0.25rem; }
.stat-card .sub.warn { color: #a87b00; }

.dash-tile {
    display: flex; flex-direction: column; background: #fff; border: 1px solid #e4e7eb;
    border-radius: 12px; overflow: hidden; text-decoration: none; color: inherit;
    box-shadow: 0 1px 3px rgba(16,24,40,0.06); transition: box-shadow 0.15s, transform 0.15s;
}
.dash-tile:hover { box-shadow: 0 6px 20px rgba(16,24,40,0.12); transform: translateY(-1px); }
.dt-thumb { position: relative; aspect-ratio: 16/9; background: #0b1220; display: flex; align-items: center; justify-content: center; }
.dt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dt-thumb .placeholder { font-size: 2rem; opacity: 0.5; }
.dt-status { position: absolute; top: 8px; right: 8px; width: 12px; height: 12px; }
.dt-body { padding: 0.7rem 0.9rem; }
.dt-name { font-weight: 600; }
.dt-content { color: #52606d; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-meta { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.45rem; font-size: 0.8rem; color: #7b8794; align-items: center; }
.dt-state { font-weight: 600; }
.dt-state.on { color: #2b8a3e; } .dt-state.off { color: #c92a2a; } .dt-state.pending { color: #a87b00; }
.dt-meta .wifi.good { color: #2b8a3e; } .dt-meta .wifi.ok { color: #a87b00; } .dt-meta .wifi.weak { color: #c92a2a; }

.status-list { display: flex; flex-direction: column; }
.status-row {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.25rem;
    border-bottom: 1px solid #f0f2f4; text-decoration: none; color: inherit;
}
.status-row:last-child { border-bottom: 0; }
.status-row:hover { background: #f8fafc; }
.status-row .sr-name { font-weight: 600; flex: 0 0 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-row .sr-content { flex: 1; color: #52606d; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-row .sr-meta { color: #7b8794; font-size: 0.85rem; flex: 0 0 auto; min-width: 90px; text-align: right; }
@media (max-width: 640px) {
    .status-row .sr-content, .status-row .sr-meta:nth-child(n+4) { display: none; }
}
