/* S4 Remote — Dark Theme */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Ensure hidden attribute works even when CSS sets display explicitly */
[hidden] {
    display: none !important;
}

:root {
    --bg: #0e0e10;
    --surface: #1a1a1f;
    --surface-hover: #24242b;
    --border: #2a2a33;
    --text: #e0e0e6;
    --text-dim: #8888a0;
    --accent: #5b8def;
    --accent-hover: #4a7de0;
    --danger: #e05555;
    --danger-hover: #d04444;
    --error: #ff6b6b;
    --success: #4ecb71;
    --radius: 8px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: "SF Mono", "Cascadia Code", "Consolas", monospace;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* Overlays (password, connecting) */

.overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    z-index: 100;
}

.overlay-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    min-width: 340px;
    max-width: 420px;
    text-align: center;
}

.overlay-card h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.overlay-card p {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 20px;
}

#session-id-display {
    font-family: var(--mono);
    color: var(--accent);
}

/* Forms */

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    font-family: var(--mono);
    outline: none;
    transition: border-color 0.15s;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--accent);
}

button, .toolbar-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

button:hover, .toolbar-btn:hover {
    background: var(--accent-hover);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

form button {
    width: 100%;
    margin-top: 12px;
}

.error {
    color: var(--error);
    font-size: 13px;
    margin-top: 12px;
}

/* Spinner */

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Landing page */

.landing {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.landing-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    min-width: 380px;
    text-align: center;
}

.landing-card h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.landing-card p {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 20px;
}

/* Video viewer */

#viewer {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

#remote-video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #000;
}

/* Toolbar */

#toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(14, 14, 16, 0.85);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    font-size: 13px;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.2s;
}

#viewer:hover #toolbar,
#toolbar:hover {
    opacity: 1;
}

.toolbar-item {
    color: var(--text-dim);
    font-family: var(--mono);
    font-size: 12px;
}

.toolbar-btn {
    padding: 6px 14px;
    font-size: 12px;
    margin-left: auto;
}

.toolbar-btn + .toolbar-btn {
    margin-left: 0;
}

.toolbar-btn-danger {
    background: var(--danger);
}

.toolbar-btn-danger:hover {
    background: var(--danger-hover);
}

/* Status dot */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.connected { background: var(--success); }
.status-dot.connecting { background: #f0ad4e; }
.status-dot.disconnected { background: var(--danger); }
