/*
 * Content Studio.
 *
 * The chrome is deliberately neutral — near-black, one neutral accent — so the
 * venue brand on the canvas is the only strong colour on screen. A lime UI
 * next to a lime overlay makes it impossible to judge the overlay.
 *
 * Brand colours arrive as --cs-b-* custom properties, set on #cs-app by the
 * script when a room is chosen, and are used only for the preview surfaces.
 */

.cs-wrap {
	--cs-bg: #0d0d0f;
	--cs-panel: #17171a;
	--cs-panel-2: #1f1f24;
	--cs-line: #2c2c33;
	--cs-ink: #f2f2f0;
	--cs-dim: #9b9ba4;
	--cs-ui: #6f7bff;
	--cs-ok: #35c07a;
	--cs-bad: #ff6b5e;
	--cs-r: 14px;

	/* Overwritten per brand. */
	--cs-b-accent: #6f7bff;
	--cs-b-ground: #111;
	--cs-b-ink: #fff;
	--cs-b-on-accent: #111;

	position: relative;
	margin: 0 0 0 -20px;
	min-height: calc(100vh - 32px);
	background: var(--cs-bg);
	color: var(--cs-ink);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
	-webkit-font-smoothing: antialiased;
}
.cs-wrap *, .cs-wrap *::before, .cs-wrap *::after { box-sizing: border-box; }
.cs-wrap button, .cs-wrap input, .cs-wrap select { font: inherit; color: inherit; }

/* ---------- top bar ---------- */
.cs-top {
	display: flex; align-items: center; justify-content: space-between; gap: 14px;
	padding: 14px 22px; border-bottom: 1px solid var(--cs-line);
	background: rgba(13,13,15,.92); position: sticky; top: 32px; z-index: 30;
	backdrop-filter: blur(10px);
}
.cs-top__left, .cs-top__right { display: flex; align-items: center; gap: 12px; }
.cs-mark { font-weight: 800; letter-spacing: 2.5px; font-size: 12px; color: var(--cs-dim); }
.cs-title { font-size: 15px; font-weight: 650; }
.cs-titlefield {
	background: var(--cs-panel); border: 1px solid var(--cs-line); border-radius: 9px;
	padding: 7px 11px; min-width: 190px; outline: none;
}
.cs-titlefield:focus { border-color: var(--cs-ui); }
.cs-save { font-size: 12px; color: var(--cs-dim); min-width: 62px; }

.cs-btn {
	border: 1px solid var(--cs-line); background: var(--cs-panel); border-radius: 10px;
	padding: 8px 16px; cursor: pointer; font-weight: 600; font-size: 13px;
	transition: transform .08s ease, background .15s ease, opacity .15s ease;
}
.cs-btn:hover:not(:disabled) { background: var(--cs-panel-2); }
.cs-btn:active:not(:disabled) { transform: translateY(1px); }
.cs-btn:disabled { opacity: .4; cursor: not-allowed; }
.cs-btn--primary { background: var(--cs-ui); border-color: var(--cs-ui); color: #fff; }
.cs-btn--primary:hover:not(:disabled) { filter: brightness(1.1); background: var(--cs-ui); }
.cs-btn--ghost { background: transparent; }

/* ---------- pick / upload stages ---------- */
.cs-pick { max-width: 860px; margin: 0 auto; padding: 56px 22px 80px; text-align: center; }
.cs-pick__h { font-size: 30px; font-weight: 750; margin: 0 0 8px; letter-spacing: -.02em; color: var(--cs-ink); }
.cs-pick__p { color: var(--cs-dim); margin: 0 0 30px; font-size: 14.5px; }

.cs-brands { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.cs-brandcard {
	position: relative; border: 1px solid var(--cs-line); border-radius: 18px; padding: 26px 20px;
	cursor: pointer; text-align: left; overflow: hidden; min-height: 168px;
	display: flex; flex-direction: column; justify-content: flex-end;
	transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.cs-brandcard:hover { transform: translateY(-3px); box-shadow: 0 14px 40px rgba(0,0,0,.5); }
.cs-brandcard:focus-visible { outline: 2px solid var(--cs-ui); outline-offset: 3px; }
.cs-brandcard__n { font-size: 26px; line-height: 1; margin: 0 0 6px; }
.cs-brandcard__t { font-size: 12px; opacity: .8; letter-spacing: .08em; text-transform: uppercase; }
.cs-brandcard__dot { position: absolute; top: 18px; right: 18px; width: 14px; height: 14px; border-radius: 50%; }

.cs-drop {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
	border: 2px dashed var(--cs-line); border-radius: 18px; padding: 52px 20px; cursor: pointer;
	background: var(--cs-panel); transition: border-color .15s ease, background .15s ease;
}
.cs-drop:hover, .cs-drop.is-over { border-color: var(--cs-ui); background: var(--cs-panel-2); }
.cs-drop__icon { color: var(--cs-dim); }
.cs-drop__t { font-weight: 650; font-size: 15px; }
.cs-drop__s { color: var(--cs-dim); font-size: 13px; }
.cs-drop--sm { padding: 20px; border-radius: 12px; }

.cs-prog { margin-top: 18px; }
.cs-prog__bar { height: 6px; border-radius: 99px; background: var(--cs-panel-2); overflow: hidden; }
.cs-prog__bar i { display: block; height: 100%; width: 0; background: var(--cs-ui); border-radius: 99px; transition: width .2s ease; }
.cs-prog__bar--indet i { width: 35% !important; animation: cs-indet 1.25s ease-in-out infinite; }
@keyframes cs-indet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.cs-prog__t { font-size: 12.5px; color: var(--cs-dim); margin-top: 8px; }
.cs-err { color: var(--cs-bad); font-size: 13.5px; margin-top: 14px; }
.cs-linkback { background: none; border: 0; color: var(--cs-dim); cursor: pointer; margin-top: 26px; font-size: 13px; }
.cs-linkback:hover { color: var(--cs-ink); }

.cs-gaps {
	margin-top: 26px; text-align: left; border: 1px solid #5a4a1e; background: #221d10;
	border-radius: 12px; padding: 14px 16px; font-size: 13px; color: #e5cd8a;
}
.cs-gaps b { display: block; margin-bottom: 5px; }

/* ---------- editor ---------- */
.cs-editor { display: grid; grid-template-columns: minmax(0,1fr) 370px; gap: 0; align-items: start; }
.cs-editor__main { padding: 20px 22px 40px; min-width: 0; }

.cs-monitor { display: flex; justify-content: center; }
.cs-frame {
	position: relative; background: #000; border-radius: var(--cs-r); overflow: hidden;
	width: min(100%, 420px); aspect-ratio: 9 / 16; box-shadow: 0 20px 60px rgba(0,0,0,.55);
	transition: aspect-ratio .2s ease;
}
.cs-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.cs-frame.is-fit video { object-fit: contain; background: var(--cs-b-ground); }
.cs-overlays { position: absolute; inset: 0; pointer-events: none; }

.cs-ov {
	position: absolute; left: 0; right: 0; padding: 0 6.5%;
	display: flex; flex-direction: column; opacity: 0; transition: opacity .18s ease;
}
.cs-ov.is-vis { opacity: 1; }
.cs-ov__inner { display: inline-block; }
.cs-ov__txt { margin: 0; white-space: pre-wrap; overflow-wrap: break-word; }
.cs-ov__rule { height: 3px; width: 8.3%; margin: 0 auto .5em; background: var(--cs-b-accent); }

.cs-safe { position: absolute; inset: 0; pointer-events: none; }
.cs-safe i {
	position: absolute; left: 0; right: 0; background: rgba(255,80,80,.11);
	border-color: rgba(255,80,80,.45); border-style: dashed; border-width: 0;
}
.cs-safe__t { top: 0; border-bottom-width: 1px; }
.cs-safe__b { bottom: 0; border-top-width: 1px; }
.cs-logo { position: absolute; pointer-events: none; }

.cs-transport { display: flex; align-items: center; gap: 14px; margin: 16px auto 0; max-width: 760px; }
.cs-play {
	width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--cs-line);
	background: var(--cs-panel); display: grid; place-items: center; cursor: pointer; flex: none;
}
.cs-play:hover { background: var(--cs-panel-2); }
.cs-time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--cs-dim); min-width: 92px; }
.cs-loop { font-size: 12.5px; color: var(--cs-dim); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.cs-flex { flex: 1; }

/* timeline */
.cs-timeline {
	position: relative; margin: 14px auto 0; max-width: 760px; height: 72px;
	border-radius: 10px; background: var(--cs-panel); border: 1px solid var(--cs-line);
	overflow: hidden; touch-action: none; user-select: none;
}
.cs-strip { position: absolute; inset: 0; display: flex; }
.cs-strip img, .cs-strip canvas { height: 100%; flex: 1 1 0; min-width: 0; object-fit: cover; display: block; }
.cs-strip.is-empty::after {
	content: "building filmstrip…"; position: absolute; inset: 0; display: grid; place-items: center;
	font-size: 12px; color: var(--cs-dim);
}
.cs-sel { position: absolute; top: 0; bottom: 0; border: 2px solid var(--cs-ui); border-radius: 8px; box-shadow: 0 0 0 9999px rgba(8,8,10,.6); }
.cs-handle {
	position: absolute; top: 50%; transform: translateY(-50%); width: 26px; height: 100%;
	cursor: ew-resize; display: grid; place-items: center; touch-action: none;
}
.cs-handle::after {
	content: ""; width: 7px; height: 42%; border-radius: 4px; background: var(--cs-ui);
	box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.cs-handle--l { left: -14px; }
.cs-handle--r { right: -14px; }
.cs-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; pointer-events: none; box-shadow: 0 0 6px rgba(255,255,255,.7); }

.cs-trimbar { max-width: 760px; margin: 14px auto 0; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.cs-trimbar__g { display: flex; gap: 10px; }
.cs-trimbar__g label { font-size: 11.5px; color: var(--cs-dim); display: flex; flex-direction: column; gap: 4px; }
.cs-trimbar__g input {
	width: 88px; background: var(--cs-panel); border: 1px solid var(--cs-line);
	border-radius: 8px; padding: 7px 9px; outline: none;
}
.cs-trimbar__g input:focus { border-color: var(--cs-ui); }
.cs-trimbar__meta { margin-left: auto; font-size: 12px; color: var(--cs-dim); }
.cs-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cs-chip {
	border: 1px solid var(--cs-line); background: var(--cs-panel); border-radius: 99px;
	padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.cs-chip:hover { background: var(--cs-panel-2); }
.cs-chip.is-on { background: var(--cs-ui); border-color: var(--cs-ui); color: #fff; }

/* ---------- side panel ---------- */
.cs-panel {
	position: sticky; top: 94px; height: calc(100vh - 126px); overflow-y: auto;
	border-left: 1px solid var(--cs-line); background: var(--cs-panel); padding: 0 0 40px;
}
.cs-tabs { display: flex; position: sticky; top: 0; background: var(--cs-panel); border-bottom: 1px solid var(--cs-line); z-index: 2; }
.cs-tab { flex: 1; background: none; border: 0; padding: 14px 6px; cursor: pointer; color: var(--cs-dim); font-size: 13px; font-weight: 600; border-bottom: 2px solid transparent; }
.cs-tab.is-on { color: var(--cs-ink); border-bottom-color: var(--cs-ui); }
.cs-tabpane { display: none; padding: 18px; }
.cs-tabpane.is-on { display: block; }

.cs-addrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.cs-addpreset {
	border: 1px solid var(--cs-line); background: var(--cs-panel-2); border-radius: 11px;
	padding: 11px 10px; cursor: pointer; text-align: left;
}
.cs-addpreset:hover { border-color: var(--cs-ui); }
.cs-addpreset b { display: block; font-size: 12.5px; margin-bottom: 3px; }
.cs-addpreset span { font-size: 11px; color: var(--cs-dim); line-height: 1.35; display: block; }

.cs-ovcard { border: 1px solid var(--cs-line); border-radius: 12px; padding: 12px; margin-bottom: 11px; background: var(--cs-panel-2); }
.cs-ovcard__top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.cs-ovcard__n { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--cs-dim); flex: 1; }
.cs-ovcard__x { background: none; border: 0; color: var(--cs-dim); cursor: pointer; font-size: 17px; line-height: 1; padding: 0 3px; }
.cs-ovcard__x:hover { color: var(--cs-bad); }
.cs-ovcard textarea {
	width: 100%; min-height: 58px; resize: vertical; background: var(--cs-bg);
	border: 1px solid var(--cs-line); border-radius: 9px; padding: 9px; outline: none; line-height: 1.35;
}
.cs-ovcard textarea:focus { border-color: var(--cs-ui); }
.cs-row { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.cs-row label { font-size: 11px; color: var(--cs-dim); display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 78px; }
.cs-row input[type=number], .cs-select, .cs-row select {
	background: var(--cs-bg); border: 1px solid var(--cs-line); border-radius: 8px; padding: 6px 8px; outline: none; width: 100%;
}
.cs-select { padding: 9px 10px; }
.cs-styles { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.cs-sw { width: 26px; height: 26px; border-radius: 7px; border: 2px solid transparent; cursor: pointer; }
.cs-sw.is-on { border-color: #fff; }

.cs-field { margin-bottom: 15px; }
.cs-field2 { display: flex; gap: 10px; margin-bottom: 15px; }
.cs-field2 .cs-lab { flex: 1; }
.cs-lab { display: block; font-size: 11.5px; color: var(--cs-dim); margin-bottom: 6px; }
.cs-lab b { color: var(--cs-ink); font-variant-numeric: tabular-nums; }
.cs-lab input[type=number] { width: 100%; background: var(--cs-bg); border: 1px solid var(--cs-line); border-radius: 8px; padding: 7px 9px; margin-top: 4px; }
.cs-wrap input[type=range] { width: 100%; accent-color: var(--cs-ui); }

.cs-seg { display: flex; gap: 6px; margin-bottom: 15px; flex-wrap: wrap; }
.cs-segbtn { flex: 1; min-width: 74px; border: 1px solid var(--cs-line); background: var(--cs-panel-2); border-radius: 9px; padding: 9px 6px; cursor: pointer; font-size: 12.5px; }
.cs-segbtn.is-on { background: var(--cs-ui); border-color: var(--cs-ui); color: #fff; }

.cs-formats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 15px; }
.cs-fmt { border: 1px solid var(--cs-line); background: var(--cs-panel-2); border-radius: 10px; padding: 10px; cursor: pointer; text-align: left; }
.cs-fmt.is-on { border-color: var(--cs-ui); }
.cs-fmt b { display: block; font-size: 12.5px; }
.cs-fmt span { font-size: 10.5px; color: var(--cs-dim); }

.cs-check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 12px; cursor: pointer; }
.cs-opt { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.cs-swatches { display: flex; gap: 6px; margin: 14px 0; flex-wrap: wrap; }
.cs-swatches i { width: 30px; height: 30px; border-radius: 8px; border: 1px solid rgba(255,255,255,.14); }
.cs-hint { font-size: 11.5px; color: var(--cs-dim); line-height: 1.5; margin: 12px 0 0; }

/* ---------- modals ---------- */
.cs-modal { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: grid; place-items: center; z-index: 100000; padding: 20px; }
.cs-modal__box { background: var(--cs-panel); border: 1px solid var(--cs-line); border-radius: 18px; padding: 24px; width: min(520px, 100%); max-height: 88vh; overflow: auto; }
.cs-modal__box h2 { margin: 0 0 14px; font-size: 18px; }
.cs-modal__t { font-size: 13px; color: var(--cs-dim); margin: 12px 0 0; }
.cs-modal__row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
#cs-result { width: 100%; max-height: 52vh; border-radius: 12px; margin-top: 14px; background: #000; }

.cs-draft { display: flex; align-items: center; gap: 12px; padding: 11px; border: 1px solid var(--cs-line); border-radius: 11px; margin-bottom: 8px; }
.cs-draft b { flex: 1; font-size: 13.5px; font-weight: 600; }
.cs-draft span { font-size: 11.5px; color: var(--cs-dim); }

.cs-toast {
	position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
	background: var(--cs-panel-2); border: 1px solid var(--cs-line); border-radius: 11px;
	padding: 11px 18px; font-size: 13px; z-index: 100001; box-shadow: 0 10px 34px rgba(0,0,0,.5);
}
.cs-toast.is-bad { border-color: var(--cs-bad); color: #ffd9d5; }

/* ---------- mobile ----------
 * The brief asks for this to work on an iPhone, which means the timeline has
 * to be thumb-draggable and nothing may depend on hover. Handles grow, the
 * panel stops being a sidebar and becomes a sheet under the video.
 */
@media (max-width: 960px) {
	.cs-wrap { margin-left: -10px; }
	.cs-editor { grid-template-columns: 1fr; }
	.cs-editor__main { padding: 14px 12px 24px; }
	.cs-panel { position: static; height: auto; border-left: 0; border-top: 1px solid var(--cs-line); }
	.cs-frame { width: min(100%, 330px); }
	.cs-timeline { height: 84px; }
	.cs-handle { width: 40px; }
	.cs-handle--l { left: -20px; }
	.cs-handle--r { right: -20px; }
	.cs-handle::after { width: 9px; height: 46%; }
	.cs-top { flex-wrap: wrap; gap: 9px; padding: 11px 13px; top: 46px; }
	.cs-titlefield { min-width: 0; flex: 1; }
	.cs-pick { padding: 32px 14px 60px; }
	.cs-pick__h { font-size: 23px; }
	.cs-trimbar__g input { width: 74px; }
	.cs-addrow { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
	.cs-wrap *, .cs-wrap *::before { transition: none !important; animation: none !important; }
}
