/* Pre-join screen */

:root {
    --pj-bg: #0b0f1a;
    --pj-panel: #121826;
    --pj-panel-border: rgba(148, 163, 184, 0.12);
    --pj-text: #f1f5f9;
    --pj-muted: #94a3b8;
    --pj-dim: #64748b;
    --pj-accent: #6366f1;
    --pj-accent-2: #7c3aed;
    --pj-good: #34d399;
    --pj-radius: 16px;
    --pj-gap: 24px;
}

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

body.pj-page {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--pj-bg);
    color: var(--pj-text);
    line-height: 1.5;
}

.pj-header {
    padding: 20px clamp(20px, 4vw, 40px);
}

.pj-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--pj-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.0625rem;
}

.pj-main {
    padding: 0 clamp(20px, 4vw, 40px) 48px;
    max-width: 1320px;
    margin: 0 auto;
}

.pj-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr 0.95fr;
    gap: var(--pj-gap);
    align-items: stretch;
}

.pj-panel {
    background: var(--pj-panel);
    border: 1px solid var(--pj-panel-border);
    border-radius: var(--pj-radius);
    padding: 28px;
    display: flex;
    flex-direction: column;
    min-height: 520px;
}

.pj-panel-title {
    margin: 0 0 24px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Preview column */
.pj-panel-preview {
    padding: 28px;
}

.pj-preview-frame {
    position: relative;
    background: #0c1018;
    border: 1px solid var(--pj-panel-border);
    border-radius: 12px;
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    isolation: isolate;
}

.pj-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 2;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--pj-muted);
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--pj-panel-border);
    border-radius: 9999px;
    padding: 6px 12px;
}

.pj-preview-media {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    background: #080b12;
    overflow: hidden;
}

.pj-preview-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.pj-preview-video.mirror {
    transform: scaleX(-1);
}

.pj-preview-placeholder {
    position: relative;
    z-index: 0;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 2px solid rgba(129, 140, 248, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pj-muted);
    flex-shrink: 0;
}

.pj-preview-silhouette {
    width: 40px;
    height: 40px;
    display: block;
}

.pj-preview-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.25);
}

.pj-ctrl {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--pj-panel-border);
    background: #1a2233;
    color: var(--pj-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.0625rem;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.pj-ctrl.is-on {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(129, 140, 248, 0.45);
    color: #c4b5fd;
}

.pj-ctrl:hover {
    border-color: rgba(148, 163, 184, 0.35);
}

.pj-preview-caption {
    margin: 20px 0 0;
    font-size: 0.875rem;
    color: var(--pj-muted);
    line-height: 1.65;
    flex-shrink: 0;
}

/* Setup form */
.pj-panel-setup .pj-form {
    flex: 1;
}

.pj-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pj-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pj-field label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--pj-muted);
}

.pj-input,
.pj-select {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--pj-panel-border);
    background: #0c1018;
    color: var(--pj-text);
    font-size: 0.9375rem;
    font-family: inherit;
}

.pj-input-readonly {
    color: #c4b5fd;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pj-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.pj-input:focus,
.pj-select:focus {
    outline: none;
    border-color: rgba(129, 140, 248, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Join column */
.pj-panel-join .pj-room-summary {
    margin-bottom: 24px;
}

.pj-panel-join .pj-status-list {
    flex: 1;
}

.pj-panel-join .pj-btn-primary {
    margin-top: auto;
}

.pj-room-summary {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.pj-room-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.14);
    color: var(--pj-accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.pj-participants-text {
    margin: 0;
    font-size: 0.875rem;
    color: var(--pj-muted);
    line-height: 1.55;
    padding-top: 4px;
}

.pj-participants-text strong {
    display: block;
    margin-top: 4px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--pj-text);
    letter-spacing: 0.04em;
}

.pj-status-list {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pj-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--pj-panel-border);
    background: #0c1018;
    font-size: 0.8125rem;
}

.pj-status-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--pj-muted);
}

.pj-status-label i {
    color: var(--pj-dim);
    width: 1rem;
    text-align: center;
}

.pj-status-value {
    font-weight: 600;
}

.pj-status-value.is-good {
    color: var(--pj-good);
}

.pj-btn-primary {
    width: 100%;
    height: 52px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--pj-accent) 0%, var(--pj-accent-2) 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pj-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.45);
}

.pj-btn-link {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--pj-muted);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.pj-btn-link:hover {
    color: var(--pj-text);
}

@media (max-width: 1100px) {
    .pj-grid {
        grid-template-columns: 1fr 1fr;
    }

    .pj-panel-preview {
        grid-column: 1 / -1;
    }

    .pj-panel {
        min-height: 0;
    }
}

@media (max-width: 720px) {
    .pj-grid {
        grid-template-columns: 1fr;
    }

    .pj-panel {
        padding: 22px;
        min-height: 0;
    }

    .pj-preview-frame {
        min-height: 240px;
    }
}
