/**
 * html5RemoteControl - App styles (dark steel theme)
 * Version: 2.0.1
 * Date Modified: 2026-07-24
 * Author: Doug Hesseltine
 * Copyright: Technologist.services 2026
 */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500;600&family=Outfit:wght@400;500;600;700&family=Syne:wght@700;800&display=swap');

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --void: #07080a;
    --charcoal: #101217;
    --panel: #161920;
    --panel-edge: rgba(197, 203, 211, 0.14);
    --silver: #c5cbd3;
    --steel: #8b939e;
    --frost: #e8eaed;
    --muted: #6b7380;
    --signal: #4aa3f0;
    --signal-hover: #6bb4f5;
    --signal-dim: rgba(74, 163, 240, 0.14);
    --live: #3ecf9a;
    --live-dim: rgba(62, 207, 154, 0.12);
    --warn: #e0a54a;
    --warn-dim: rgba(224, 165, 74, 0.12);
    --danger: #e85d5d;
    --danger-dim: rgba(232, 93, 93, 0.12);
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    --font-display: 'Syne', sans-serif;
    --font-body: 'Outfit', sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

html {
    color-scheme: dark;
}

body {
    font-family: var(--font-body);
    background: var(--void);
    color: var(--frost);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    position: relative;
    overflow-x: hidden;
}

/* Ambient stage — silver wash, no purple */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(ellipse 90% 60% at 15% -10%, rgba(180, 190, 205, 0.16), transparent 55%),
        radial-gradient(ellipse 70% 50% at 95% 10%, rgba(74, 163, 240, 0.08), transparent 50%),
        radial-gradient(ellipse 60% 40% at 50% 100%, rgba(120, 130, 145, 0.1), transparent 55%),
        linear-gradient(180deg, #0c0e12 0%, var(--void) 45%, #050607 100%);
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(197, 203, 211, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(197, 203, 211, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 20%, transparent 75%);
    pointer-events: none;
}

a {
    color: var(--signal);
    text-decoration: none;
}

a:hover {
    color: var(--signal-hover);
    text-decoration: underline;
}

/* ===== Header chrome ===== */
header.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.1rem 1.75rem;
    border-bottom: 1px solid var(--panel-edge);
    background: rgba(16, 18, 23, 0.72);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 50;
    animation: headerIn 0.55s ease-out;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.brand-mark {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 11px;
    background: linear-gradient(145deg, #2a2e38 0%, #14161c 100%);
    border: 1px solid rgba(197, 203, 211, 0.28);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 8px 20px rgba(0, 0, 0, 0.35);
    display: grid;
    place-items: center;
    position: relative;
}

.brand-mark::before {
    content: '';
    width: 22px;
    height: 14px;
    border: 2px solid var(--silver);
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(74, 163, 240, 0.25);
}

.brand-mark::after {
    content: '';
    position: absolute;
    bottom: 7px;
    width: 8px;
    height: 3px;
    background: var(--steel);
    border-radius: 1px;
}

.brand-text h1 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--frost);
    line-height: 1.1;
}

.brand-text p {
    font-size: 0.8rem;
    color: var(--steel);
    margin-top: 0.15rem;
}

.header-meta {
    font-size: 0.78rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

.header-meta span {
    color: var(--live);
}

/* ===== Main ===== */
main.container {
    flex: 1;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 1.5rem;
    max-width: 1180px;
    width: 100%;
    margin: 1.75rem auto 2rem;
    padding: 0 1.25rem;
    align-items: start;
}

main.container.viewer-only {
    grid-template-columns: 1fr;
    max-width: 560px;
}

.panel {
    background: linear-gradient(165deg, rgba(28, 32, 40, 0.95) 0%, rgba(18, 20, 26, 0.98) 100%);
    border: 1px solid var(--panel-edge);
    border-radius: var(--radius);
    padding: 1.6rem 1.7rem 1.75rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    animation: panelIn 0.65s ease-out both;
}

#viewerPanel {
    animation-delay: 0.08s;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(197, 203, 211, 0.45), transparent);
    pointer-events: none;
}

.panel-kicker {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--steel);
}

.panel h2 {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--frost);
    line-height: 1.15;
    margin: 0;
}

.help-text {
    color: var(--steel);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.panel-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(197, 203, 211, 0.08);
    margin-bottom: 0.15rem;
}

/* ===== Sharer guide ===== */
.sharer-guide {
    background: rgba(10, 12, 16, 0.55);
    border: 1px solid rgba(197, 203, 211, 0.1);
    border-radius: var(--radius-sm);
    padding: 1.1rem 1.2rem 1.2rem;
    margin-top: 0.5rem;
}

.guide-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--frost);
    margin-bottom: 0.65rem;
}

.guide-steps,
.guide-access-list {
    margin: 0 0 0 1.1rem;
    padding: 0;
    color: var(--silver);
    font-size: 0.9rem;
    line-height: 1.55;
}

.guide-steps li,
.guide-access-list li {
    margin-bottom: 0.5rem;
}

.guide-steps li:last-child,
.guide-access-list li:last-child {
    margin-bottom: 0;
}

.guide-access {
    border-top: 1px solid rgba(197, 203, 211, 0.1);
    padding-top: 1rem;
    margin-top: 1rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    text-align: center;
    text-decoration: none !important;
    line-height: 1.2;
    white-space: nowrap;
}

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

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(180deg, var(--signal-hover) 0%, var(--signal) 100%);
    color: #061018 !important;
    box-shadow: 0 8px 24px rgba(74, 163, 240, 0.28);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #7dc0f8 0%, var(--signal-hover) 100%);
}

.btn-secondary {
    background: rgba(197, 203, 211, 0.08);
    color: var(--frost) !important;
    border-color: rgba(197, 203, 211, 0.22);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(197, 203, 211, 0.14);
    border-color: rgba(197, 203, 211, 0.35);
}

.btn-success {
    background: var(--live);
    color: #04140f !important;
}

.btn-danger {
    background: rgba(232, 93, 93, 0.15);
    color: #ffb4b4 !important;
    border-color: rgba(232, 93, 93, 0.35);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(232, 93, 93, 0.28);
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 0.25rem;
}

/* ===== Code display ===== */
.code-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    margin: 0.5rem 0;
    padding: 1.5rem 1.25rem;
    background: rgba(0, 0, 0, 0.35);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(74, 163, 240, 0.25);
    box-shadow: inset 0 0 40px rgba(74, 163, 240, 0.06);
}

.code-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--steel);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.code {
    font-family: var(--font-mono);
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--frost);
    user-select: all;
    text-shadow: 0 0 24px rgba(74, 163, 240, 0.35);
}

.code-instructions {
    text-align: center;
    margin: 0.25rem 0 0;
    color: var(--silver);
    font-size: 0.92rem;
}

.code-instructions p {
    margin-bottom: 0.45rem;
}

.expires {
    font-weight: 600;
    color: var(--warn);
}

/* ===== Forms ===== */
.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field-label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.input-group {
    display: flex;
    gap: 0.6rem;
    align-items: stretch;
}

.field-stack {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 0.95rem;
    font-size: 1rem;
    font-family: var(--font-body);
    font-weight: 500;
    color: var(--frost);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(197, 203, 211, 0.18);
    border-radius: var(--radius-sm);
    letter-spacing: normal;
    text-transform: none;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder {
    color: var(--muted);
    letter-spacing: normal;
    text-transform: none;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(74, 163, 240, 0.65);
    box-shadow: 0 0 0 3px var(--signal-dim);
}

input.code-field {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    text-align: center;
    letter-spacing: 0.08em;
    text-transform: lowercase;
}

/* ===== Auth gate (viewer) ===== */
.viewer-auth-gate {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1.15rem 1.2rem;
    background: rgba(0, 0, 0, 0.28);
    border: 1px dashed rgba(197, 203, 211, 0.22);
    border-radius: var(--radius-sm);
}

.viewer-auth-gate p {
    margin: 0;
    color: var(--silver);
    font-size: 0.98rem;
    line-height: 1.45;
}

.viewer-auth-gate .btn-row {
    margin-top: 0;
}

.viewer-auth-user {
    font-size: 0.85rem;
    color: var(--steel);
    padding: 0.55rem 0.75rem;
    background: rgba(197, 203, 211, 0.06);
    border-radius: 8px;
    border: 1px solid rgba(197, 203, 211, 0.1);
}

.viewer-auth-user a {
    font-weight: 600;
}

/* ===== Status boxes ===== */
.status-box {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-sm);
    margin: 0.25rem 0;
    text-align: center;
}

.status-icon {
    font-size: 1.75rem;
    margin-bottom: 0.4rem;
    line-height: 1;
}

.status-message {
    font-size: 1.05rem;
    font-weight: 600;
}

.status-success {
    background: var(--live-dim);
    color: var(--live);
    border: 1px solid rgba(62, 207, 154, 0.35);
}

.status-warning {
    background: var(--warn-dim);
    color: var(--warn);
    border: 1px solid rgba(224, 165, 74, 0.35);
}

.status-error {
    background: var(--danger-dim);
    color: #ffb4b4;
    border: 1px solid rgba(232, 93, 93, 0.35);
}

.connection-status {
    padding: 0.85rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 500;
    color: var(--steel);
    border: 1px solid rgba(197, 203, 211, 0.1);
}

.video-container {
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: 0.25rem 0;
    position: relative;
    border: 1px solid rgba(197, 203, 211, 0.12);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

video {
    width: 100%;
    height: auto;
    display: block;
    min-height: 280px;
    object-fit: contain;
}

.viewer-controls {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.viewer-controls .btn {
    flex: 1;
    min-width: 120px;
}

/* Cursor overlay */
.cursor-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
}

.cursor-overlay .cursor-circle {
    position: absolute;
    width: 40px;
    height: 40px;
    margin-left: -20px;
    margin-top: -20px;
    border: 3px solid rgba(62, 207, 154, 0.9);
    border-radius: 50%;
    background: rgba(62, 207, 154, 0.15);
    box-shadow: 0 0 12px rgba(62, 207, 154, 0.45);
    transition: left 0.05s ease-out, top 0.05s ease-out;
}

.hidden {
    display: none !important;
}

/* Status ticker */
.status-ticker {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(7, 8, 10, 0.92);
    color: var(--frost);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    z-index: 1000;
    border-top: 1px solid rgba(74, 163, 240, 0.35);
    backdrop-filter: blur(10px);
}

.ticker-content {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#tickerStatus {
    font-size: 0.6rem;
    animation: pulse 2s infinite;
}

#tickerStatus.status-connected { color: var(--live); }
#tickerStatus.status-connecting { color: var(--warn); }
#tickerStatus.status-error { color: var(--danger); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

@keyframes headerIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}

@keyframes panelIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Footer */
footer.app-footer {
    text-align: center;
    padding: 1.25rem 1rem 1.5rem;
    color: var(--muted);
    font-size: 0.85rem;
    border-top: 1px solid rgba(197, 203, 211, 0.08);
}

/* Responsive */
@media (max-width: 960px) {
    main.container {
        grid-template-columns: 1fr;
        gap: 1.15rem;
    }

    header.app-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem 1.15rem;
    }

    .header-meta {
        display: none;
    }
}

@media (max-width: 560px) {
    .panel {
        padding: 1.2rem;
    }

    .input-group {
        flex-direction: column;
    }

    .btn-row .btn {
        flex: 1 1 auto;
    }
}
