/* =====================================================================
 * HelperPwa-specific overrides on top of Wiki.Web.Shared's tokens + app.css.
 * Mobile-first: 360 px works; nothing here breaks above 768 px.
 *
 * Layout: a bottom tab-bar replaces AdminPortal's side-nav. The "wk-helper"
 * grid sits above the OS soft-keyboard so the bottom tab-bar is always reachable.
 * ===================================================================== */

.wk-helper {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
    /* safe-area for iOS notch / Android gesture bar */
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.wk-helper__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--wk-border);
    background: var(--wk-surface-1);
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Lockup + build stamp. Family lockup spec: both words 800 at ~1.05rem,
   hub link hovers to accent, ▸ separator accent-coloured at .85em. The build
   stamp is deliberately a separate muted element OUTSIDE the lockup text. */
.wk-helper__identity {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    min-width: 0;
}

.wk-helper__brand {
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    color: var(--wk-ink-strong);
}

.wk-helper__brand a { color: inherit; text-decoration: none; }
.wk-helper__brand a:hover, .wk-helper__brand a:focus { color: var(--wk-accent); text-decoration: none; }

.wk-helper__sep { color: var(--wk-accent); font-size: 0.85em; }

.wk-helper__build {
    color: var(--ml-text-muted, #707070);
    font-size: .68rem;
    font-family: var(--wk-font-mono, ui-monospace, monospace);
    white-space: nowrap;
}
.wk-helper__meta { display: flex; align-items: center; gap: .6rem; margin-left: auto; }

.wk-helper__main {
    padding: 1rem;
    max-width: var(--wk-maxw);
    width: 100%;
    margin: 0 auto;
}

.wk-helper__tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border-top: 1px solid var(--wk-border);
    background: var(--wk-surface-1);
    position: sticky;
    bottom: 0;
}

.wk-helper__tab {
    min-height: var(--wk-hit);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    padding: 0.45rem 0.25rem;
    color: var(--wk-ink-muted);
    text-decoration: none;
    font-size: var(--wk-fs-xs);
}

.wk-helper__tab span:first-child {
    font-size: 1.1rem;
    line-height: 1;
}

/* The Sign-out tab is a <button>, not a NavLink — strip the UA button chrome so it
   renders identically to its anchor siblings. */
button.wk-helper__tab {
    background: none;
    border: 0;
    font-family: inherit;
    font-size: var(--wk-fs-xs);
    cursor: pointer;
}

.wk-helper__tab:hover { background: var(--wk-surface-2); }
.wk-helper__tab.active { background: var(--wk-accent-tint); color: var(--wk-ink-strong); font-weight: 600; }
.wk-helper__tab.active span:first-child { color: var(--wk-accent); }
.wk-helper__tab:focus-visible { outline: none; box-shadow: var(--wk-focus-ring); }

/* ---- Availability toggle ----------------------------------------- */

/* base.css (Web.Shared master) now ships its own checkbox-as-switch .wk-toggle
   (Phase 6.5, hidden input + .wk-toggle__track). HelperPwa's availability toggle
   predates it and uses different markup (visible styled checkbox + text label),
   so the width/height/opacity the master sets are explicitly reset here. */
.wk-toggle {
    position: static;
    width: auto;
    height: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: var(--wk-hit);
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--wk-border);
    border-radius: var(--wk-radius);
    background: var(--wk-bg);
    cursor: pointer;
}

.wk-toggle input[type=checkbox] {
    appearance: none;
    opacity: 1;
    width: 38px;
    height: 22px;
    border-radius: 999px;
    background: var(--wk-surface-2);
    position: relative;
    transition: background 120ms ease;
    cursor: pointer;
    border: 1px solid var(--wk-border);
}

.wk-toggle input[type=checkbox]:checked { background: var(--wk-ok); border-color: var(--wk-ok); }

.wk-toggle input[type=checkbox]::after {
    content: "";
    position: absolute;
    top: 1px; left: 1px;
    width: 18px; height: 18px;
    background: var(--wk-bg);
    border-radius: 50%;
    transition: transform 120ms ease;
}

.wk-toggle input[type=checkbox]:checked::after { transform: translateX(16px); }
.wk-toggle input[type=checkbox]:focus-visible { outline: none; box-shadow: var(--wk-focus-ring); }

/* ---- Inbox list -------------------------------------------------- */

.wk-inbox {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.wk-inbox__row {
    background: var(--wk-surface-1);
    border: 1px solid var(--wk-border);
    border-radius: var(--wk-radius-lg);
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: var(--wk-shadow-1);
}

.wk-inbox__meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    color: var(--wk-ink-muted);
    font-size: var(--wk-fs-sm);
}

.wk-inbox__tenant { color: var(--wk-ink); font-weight: 600; }
.wk-inbox__q { color: var(--wk-ink); line-height: 1.4; }

.wk-inbox__cta {
    display: flex;
    gap: 0.5rem;
}

.wk-inbox__cta .wk-btn { flex: 1; }

/* ---- Skills list -------------------------------------------------- */

.wk-skills {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    display: grid;
    gap: 0.25rem;
}

.wk-skill {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: var(--wk-hit);
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    border-radius: var(--wk-radius-sm);
}

.wk-skill:hover { background: var(--wk-surface-2); }

.wk-skill input[type=checkbox] {
    appearance: none;
    width: 22px;
    height: 22px;
    border: 1px solid var(--wk-border);
    border-radius: 4px;
    background: var(--wk-bg);
    position: relative;
    cursor: pointer;
}

.wk-skill input[type=checkbox]:checked {
    background: var(--wk-accent);
    border-color: var(--wk-accent);
}

.wk-skill input[type=checkbox]:checked::after {
    content: "";
    position: absolute;
    inset: 3px 0 0 6px;
    width: 7px; height: 12px;
    border-right: 2px solid var(--wk-accent-ink);
    border-bottom: 2px solid var(--wk-accent-ink);
    transform: rotate(45deg);
}

.wk-skill input[type=checkbox]:focus-visible { outline: none; box-shadow: var(--wk-focus-ring); }

/* ---- Call view ---------------------------------------------------- */

.wk-call {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    background: #000;
    border-radius: var(--wk-radius-lg);
    overflow: hidden;
    border: 1px solid var(--wk-border);
}

.wk-call__remote { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.wk-call__remote video,
.wk-call__remote audio { width: 100%; height: 100%; object-fit: cover; }

.wk-call__local {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    width: 30%;
    max-width: 140px;
    aspect-ratio: 3 / 4;
    background: #111;
    border: 2px solid var(--wk-surface-2);
    border-radius: var(--wk-radius);
    overflow: hidden;
}

.wk-call__local video { width: 100%; height: 100%; object-fit: cover; }

.wk-call__actions {
    margin-top: 1rem;
    display: flex;
    align-items: center;
}

/* ---- Video call UI (matches Agent /v page) ----------------------- */
.wk-vc__stage {
    position: fixed; inset: 0; background: #000; overflow: hidden;
    border: 2px solid rgba(255,255,255,0.28); border-radius: 10px;
}
.wk-vc__view { position: absolute; background: #000; overflow: hidden; }
.wk-vc__view video, .wk-vc__view audio, .wk-vc__view img { width: 100%; height: 100%; object-fit: cover; background: #000; }
/* A shared screen or screenshot must never be cropped — letterbox it instead. */
.wk-vc__view--screen video, .wk-vc__view--screen img { object-fit: contain; }
.wk-vc__view--main { inset: 0; }
.wk-vc__view--pip {
    width: 30%; max-width: 220px; aspect-ratio: 3 / 4; right: 14px; bottom: 84px;
    border-radius: 12px; border: 1px solid rgba(255,255,255,0.22);
    box-shadow: 0 6px 22px rgba(0,0,0,0.5); cursor: pointer; z-index: 4;
}
/* Third pane (a share is up): park it in the opposite corner so the tiles never overlap. */
.wk-vc__view--pip2 {
    width: 30%; max-width: 220px; aspect-ratio: 3 / 4; right: 14px; top: 14px;
    border-radius: 12px; border: 1px solid rgba(255,255,255,0.22);
    box-shadow: 0 6px 22px rgba(0,0,0,0.5); cursor: pointer; z-index: 4;
}
.wk-vc__view--hidden { display: none !important; }
/* Caption on the screen pane so it's obvious whose screen this is. */
.wk-vc__tag {
    position: absolute; top: 8px; left: 8px; z-index: 5; pointer-events: none;
    background: rgba(0,0,0,0.55); color: #fff; font-size: 12px; font-weight: 600;
    padding: 4px 9px; border-radius: 999px;
}
.wk-vc__bar {
    position: absolute; left: 0; right: 0; bottom: 16px; z-index: 6;
    display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 0 12px;
}
.wk-vc__bar button {
    -webkit-appearance: none; appearance: none; border: 0; cursor: pointer;
    min-height: 48px; min-width: 48px; padding: 0 16px; border-radius: 999px;
    font-size: 14px; font-weight: 600; color: #fff; background: rgba(28,32,40,0.82);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.wk-vc__bar button.active { background: var(--wk-orange, #FF5432); }
.wk-vc__bar button.danger { background: #c0392b; }
.wk-vc__toast {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6;
    background: rgba(0,0,0,0.6); color: #fff; font-size: 13px; padding: 6px 12px; border-radius: 999px;
}

/* ---- Wide-screen niceties (tablet, desktop preview) -------------- */

@media (min-width: 720px) {
    .wk-helper__tabs {
        grid-template-columns: repeat(5, minmax(128px, 1fr));
        max-width: 720px;
        margin: 0 auto;
        width: 100%;
        border-top: 1px solid var(--wk-border);
    }
    .wk-call { aspect-ratio: 16 / 9; }
}

/* ---- Motion (mirror base.css: all motion is reduced-motion aware) -- */

@media (prefers-reduced-motion: no-preference) {
    .wk-helper__tab { transition: background-color 0.15s ease, color 0.15s ease; }
}

@media (prefers-reduced-motion: reduce) {
    .wk-toggle input[type=checkbox],
    .wk-toggle input[type=checkbox]::after { transition: none; }
}
