:root {
    --bg-dark: #0a0f1c;
    --bg-panel: #161b2e;
    --accent: #FFD700;
    --text: #ffffff;
    --danger: #ff4444;
    --success: #44FF44;
    --sidebar-width: 320px;
    --activity-bar-width: 60px;
}

body {
    font-family: 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text);
    margin: 0;
    overflow: hidden;
}

/* --- LANDING PAGE --- */
.landing-body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1a2236 0%, #0a0f1c 100%);
    height: 100vh;
    width: 100vw;
}

.landing-card {
    background: var(--bg-panel);
    padding: 50px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid rgba(255, 215, 0, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    width: 300px;
    max-width: 90%;
}

.logo-text {
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 10px;
    margin-top: 0;
}

.input-group input {
    width: 100%;
    padding: 15px;
    font-size: 24px;
    text-align: center;
    border-radius: 8px;
    border: 2px solid #333;
    background: #000;
    color: white;
    font-family: monospace;
    letter-spacing: 3px;
    box-sizing: border-box;
    outline: none;
    margin-bottom: 10px;
}

.input-group input:focus {
    border-color: var(--accent);
}

.btn-primary {
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    background: var(--accent);
    color: #000;
    border: none;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    font-size: 16px;
}

.btn-primary:hover {
    background: #ffea70;
}


/* --- WORKSPACE HEADER --- */
.top-header {
    height: 60px;
    background: var(--bg-panel);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid #333;
    z-index: 20;
}

.brand-title {
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 800;
    font-size: 20px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.session-code {
    font-family: monospace;
    font-size: 16px;
    font-weight: bold;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 4px 8px;
    border-radius: 4px;
}

.tag-live {
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    animation: pulse 2s infinite;
}

.btn-leave {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.btn-leave:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-leave.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: white;
}

/* --- MAIN LAYOUT --- */
.main-layout {
    display: flex;
    height: calc(100vh - 60px);
}

/* ACTIVITY BAR */
.activity-bar {
    width: var(--activity-bar-width);
    background: #000;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    gap: 20px;
    z-index: 15;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    color: #666;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: 0.2s;
}

.activity-icon:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.activity-icon.active {
    color: var(--accent);
    background: rgba(255, 215, 0, 0.1);
    border-left: 3px solid var(--accent);
}

/* SIDE PANEL */
.side-panel {
    width: var(--sidebar-width);
    background: var(--bg-panel);
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
}

.side-panel.collapsed {
    width: 0;
    overflow: hidden;
    border: none;
}

.panel-content {
    padding: 20px;
    display: none;
    overflow-y: auto;
    flex: 1;
}

.panel-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

.panel-header {
    font-size: 14px;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 20px;
    letter-spacing: 1px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

/* --- WORKSPACE AREA --- */
.workspace-area {
    flex: 1;
    background: #000;
    position: relative;
    display: flex;
    /* DESKTOP: Row layout (Video Left, Toolbar Right) */
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
    gap: 30px;
}

/* VIEWPORT WINDOW */
.viewport-window {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 80vh;
    /* Force 1:1 Aspect Ratio to match the app crop */
    aspect-ratio: 1/1;
    border: 1px solid #333;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    background: #111;
}

.transform-container {
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.1s linear;
    /* Smooth Zoom */
}

/* MEDIA ELEMENTS (Anti-Squish Logic) */
#remoteVideo,
#staticPhoto {
    width: 100%;
    height: 100%;
    /* This ensures the image/video fills the square box by cropping, not stretching */
    object-fit: cover;
    display: block;
    pointer-events: none;
    /* Allows clicks to pass through to canvas */
}

#annotationCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    touch-action: none;
}

/* --- TOOLBAR --- */
.toolbar-dock {
    background: var(--bg-panel);
    border: 1px solid #444;
    border-radius: 50px;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 20;
    flex-shrink: 0;
}

.toolbar-divider {
    width: 20px;
    height: 1px;
    background: #444;
    margin: 5px auto;
}

.tool-btn {
    background: transparent;
    border: none;
    color: #aaa;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: 0.2s;
    position: relative;
}

.tool-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.tool-btn.active {
    color: #000;
    background: var(--accent);
}

.count-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--accent);
    color: black;
    font-size: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 1px solid black;
}

/* --- CONTROLS & INPUTS --- */
input[type=range] {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
    margin-top: 5px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #ccc;
    font-size: 14px;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* UTILS */
.color-picker-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
}

.color-swatch.active {
    border-color: white;
    transform: scale(1.1);
}

.thickness-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.thickness-btn {
    height: 30px;
    flex: 1;
    background: #222;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thickness-btn.active {
    background: #444;
    border-color: var(--accent);
}

.dot-preview {
    background: #888;
    border-radius: 50%;
}

/* ROSTER STYLES */
.roster-list {
    background: #000;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px;
}

.roster-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #222;
}

.roster-item:last-child {
    border-bottom: none;
}

.btn-kick {
    background: #2a0f0f;
    color: #ffaaaa;
    border: 1px solid #ff4444;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-kick:hover {
    background: #ff4444;
    color: white;
}

/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--bg-panel);
    padding: 20px;
    border-radius: 12px;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 8px;
    object-fit: contain;
}

/* --- MOBILE / TABLET OVERRIDES --- */
@media (max-width: 900px) {
    .main-layout {
        flex-direction: column;
    }

    .activity-bar {
        width: 100%;
        height: 50px;
        flex-direction: row;
        justify-content: space-around;
        padding: 0;
        border-right: none;
        border-top: 1px solid #333;
        order: 3;
        background: #000;
    }

    .side-panel {
        width: 100%;
        height: 40vh;
        border-right: none;
        border-top: 1px solid #333;
        order: 2;
    }

    .side-panel.collapsed {
        height: 0;
    }

    .workspace-area {
        order: 1;
        padding: 10px;
        gap: 15px;
        flex-direction: column;
    }

    .viewport-window {
        max-width: 100%;
        aspect-ratio: 1/1;
        max-height: 50vh;
    }

    .toolbar-dock {
        flex-direction: row;
        padding: 10px 20px;
        width: 100%;
        max-width: 350px;
        justify-content: space-between;
    }

    .toolbar-divider {
        width: 1px;
        height: 20px;
        margin: auto 0;
    }
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}