:root {
    --bg-main: #090c16;
    --panel-bg: rgba(30, 41, 59, 0.4);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --color-primary: #6366f1;
    --color-primary-hover: #4f46e5;
    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ambient Background Lights */
.ambient-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.6;
}

.glow-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0) 70%);
    top: -100px;
    left: -100px;
}

.glow-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, rgba(168, 85, 247, 0) 70%);
    bottom: -150px;
    right: -150px;
}

/* Main Container */
.app-container {
    width: 100vw;
    height: 100vh;
    padding: 0;
    z-index: 1;
}

/* Mockup Glass Panel */
.glass-window {
    width: 100%;
    height: 100%;
    background: var(--panel-bg);
    border: none;
    border-radius: 0;
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Navigation Header */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 36px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(15, 23, 42, 0.2);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    color: var(--color-primary);
    width: 28px;
    height: 28px;
}

.logo-text {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(to right, #ffffff, #c7d2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-tabs {
    display: flex;
    gap: 28px;
}

.nav-tab {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.nav-tab i {
    width: 18px;
    height: 18px;
}

.nav-tab:hover {
    color: var(--text-primary);
}

.nav-tab.active {
    color: var(--text-primary);
    border-bottom-color: #818cf8;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.notification-dot {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 6px;
    height: 6px;
    background-color: var(--color-danger);
    border-radius: 50%;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.profile-arrow {
    color: var(--text-secondary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Workspace Frame */
.video-workspace {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
}

/* Video Grid and Layout */
.video-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #060913;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

/* 50/50 Dual Equal Grid (Side-by-Side View) */
.video-grid.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 48px;
    align-content: center;
    justify-content: center;
}

.video-grid.grid-layout .remote-wrapper,
.video-grid.grid-layout .local-wrapper {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    bottom: auto !important;
    right: auto !important;
    width: 100% !important;
    height: auto !important;
    max-width: 540px;
    aspect-ratio: 16/9;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.08);
    cursor: default !important;
    transition: none !important;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background: #060913;
}

#remoteVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* PIP Local Video Wrapper */
.local-wrapper {
    position: absolute;
    bottom: 32px;
    right: 32px;
    width: 280px;
    aspect-ratio: 16/9;
    z-index: 20;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: #111827;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
}

.local-wrapper:hover {
    transform: scale(1.03);
    border-color: var(--color-primary);
}

.local-wrapper:active {
    cursor: grabbing;
}

#localVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

/* Overlays on videos */
.video-overlay-info {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 5;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 8px;
}

.peer-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Animated Glow Ring */
.waiting-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    z-index: 10;
    pointer-events: none;
    transition: all 0.5s ease;
}

/* Outer Glow Ring container */
.glow-ring {
    position: relative;
    width: 350px;
    height: 350px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

/* Soft background ambient glow */
.glow-ring::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #00f2fe, #4facfe, #9b51e0, #d946ef, #00f2fe);
    z-index: -2;
    filter: blur(40px);
    opacity: 0.6;
    animation: rotateConic 10s linear infinite;
}

/* Overlapping Arc Styles */
.ring-arc {
    position: absolute;
    border-radius: 50%;
    background: transparent;
    pointer-events: none;
    z-index: 1;
}

/* Arc 1: Cyan, slightly oval, rotates clockwise */
.arc-1 {
    width: 346px;
    height: 338px;
    border: 2px solid transparent;
    border-top: 3px solid #00f2fe;
    border-left: 2px solid rgba(0, 242, 254, 0.1);
    box-shadow: 0 -4px 12px rgba(0, 242, 254, 0.2);
    animation: spinClockwise 5s linear infinite;
}

/* Arc 2: Blue, slightly oval, rotates counter-clockwise */
.arc-2 {
    width: 338px;
    height: 346px;
    border: 2px solid transparent;
    border-right: 3px solid #4facfe;
    border-top: 2px solid rgba(79, 172, 254, 0.1);
    box-shadow: 4px 0 12px rgba(79, 172, 254, 0.2);
    animation: spinCounterClockwise 7s linear infinite;
}

/* Arc 3: Purple, slightly oval, rotates clockwise */
.arc-3 {
    width: 342px;
    height: 340px;
    border: 2px solid transparent;
    border-bottom: 3px solid #9b51e0;
    border-right: 2px solid rgba(155, 81, 224, 0.1);
    box-shadow: 0 4px 12px rgba(155, 81, 224, 0.2);
    animation: spinClockwise 10s linear infinite;
}

/* Arc 4: Pink/Magenta, slightly oval, rotates counter-clockwise */
.arc-4 {
    width: 340px;
    height: 342px;
    border: 2px solid transparent;
    border-left: 3px solid #d946ef;
    border-bottom: 2px solid rgba(217, 70, 239, 0.1);
    box-shadow: -4px 0 12px rgba(217, 70, 239, 0.2);
    animation: spinCounterClockwise 13s linear infinite;
}

@keyframes spinClockwise {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spinCounterClockwise {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}

@keyframes rotateConic {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Solid Masking Core Container */
.ring-core {
    width: 326px;
    height: 326px;
    border-radius: 50%;
    background: #0d1222;
    z-index: 5;
    box-shadow: inset 0 0 30px rgba(99, 102, 241, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 28px;
}

#waitingStatusText {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-primary);
    margin-bottom: 20px;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.1);
}

.pulse-signal-wrapper {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    animation: pulseScale 2s infinite ease-in-out;
}

.pulse-icon {
    width: 24px;
    height: 24px;
    color: #60a5fa;
}

@keyframes pulseScale {
    0% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.3); }
    50% { transform: scale(1.05); opacity: 1; box-shadow: 0 0 0 12px rgba(99, 102, 241, 0); }
    100% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.waiting-room-id {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.04);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Copy Link Area */
.copy-link-container {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--panel-border);
    padding: 10px 20px;
    border-radius: 9999px;
    backdrop-filter: blur(8px);
    pointer-events: auto;
}

.invite-msg {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.copy-link-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 9999px;
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 6px 16px;
    transition: all 0.2s ease;
}

.copy-link-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

/* Floating Join Settings Card (Docked Bottom-Left) */
.join-card {
    position: absolute;
    bottom: 32px;
    left: 32px;
    width: 320px;
    background: rgba(30, 41, 59, 0.45);
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    padding: 28px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 100;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.join-card.slide-out {
    transform: translateX(-380px);
    opacity: 0;
    pointer-events: none;
}

.card-field {
    margin-bottom: 20px;
}

.field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.field-header .input-label {
    margin-bottom: 0;
}

.generate-room-btn {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    color: #818cf8;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 3px 9px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
}

.generate-room-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
    color: #c7d2fe;
    transform: translateY(-1px);
}

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

.btn-mini-icon {
    width: 12px;
    height: 12px;
}

.input-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: block;
}

.join-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.join-input-group input {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 44px 14px 18px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

.join-input-group input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.join-input-group input:focus {
    border-color: var(--color-primary);
    background: rgba(15, 23, 42, 0.7);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.join-input-icon {
    position: absolute;
    right: 16px;
    color: var(--text-secondary);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.join-btn-gradient {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 14px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.join-btn-gradient:hover {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.5);
    transform: translateY(-1px);
}

.join-btn-gradient:active {
    transform: translateY(1px);
}

/* Floating Call Controls Bar (Bottom Center in Video Mode) */
.controls-bar {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 28px;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--panel-border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    z-index: 100;
    transition: left 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                bottom 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                padding 0.35s ease,
                gap 0.35s ease,
                background 0.3s ease,
                box-shadow 0.35s ease;
}

/* Whiteboard Docked Mode: Smooth Transformation to Side */
.controls-bar.whiteboard-docked {
    left: 28px;
    bottom: 24px;
    transform: translateX(0);
    padding: 8px 14px;
    gap: 10px;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
}

/* Docked to Right Side (User preference flip) */
.controls-bar.whiteboard-docked.dock-right {
    left: calc(100% - 28px);
    transform: translateX(-100%);
}

.controls-bar.whiteboard-docked .control-btn {
    width: 40px;
    height: 40px;
}

.controls-bar.whiteboard-docked .control-btn i {
    width: 18px;
    height: 18px;
}

.dock-side-btn {
    display: none;
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
}

.controls-bar.whiteboard-docked .dock-side-btn {
    display: flex;
}

.controls-bar.whiteboard-docked .dock-side-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    color: #ffffff;
}

.control-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.control-btn i {
    width: 20px;
    height: 20px;
}

.control-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--color-primary);
    transform: scale(1.08);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.active {
    background: var(--color-danger);
    border-color: var(--color-danger);
}

.control-btn.active:hover {
    background: var(--color-danger-hover);
    border-color: var(--color-danger-hover);
}

.control-btn.btn-danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
}

.control-btn.btn-danger:hover {
    background: var(--color-danger-hover);
    border-color: var(--color-danger-hover);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

/* Connection Status Badge (Anchor to Top Right inside workspace) */
.status-badge {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 500;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(8px);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-badge.disconnected .status-dot {
    background-color: var(--color-danger);
    box-shadow: 0 0 8px var(--color-danger);
}

.status-badge.connecting .status-dot {
    background-color: var(--color-warning);
    box-shadow: 0 0 8px var(--color-warning);
    animation: pulseBreathe 1.5s infinite alternate;
}

.status-badge.connected .status-dot {
    background-color: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
}

@keyframes pulseBreathe {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* Responsive Scaling */
@media (max-width: 992px) {
    .app-container {
        height: 90vh;
        padding: 0 16px;
    }
    
    .nav-tabs {
        display: none; /* Hide middle links on smaller tablets */
    }
}

@media (max-width: 768px) {
    .top-bar {
        padding: 16px 24px;
    }

    .waiting-container {
        transform: translate(-50%, -55%) scale(0.85);
    }

    .join-card {
        width: calc(100% - 48px);
        left: 24px;
        bottom: 24px;
        padding: 20px;
    }
    
    .join-card.slide-out {
        transform: translateY(350px);
        opacity: 0;
    }

    .local-wrapper {
        width: 150px;
        bottom: 120px;
        right: 24px;
    }
}

/* Placeholder inside local video (when camera off) */
.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #111827;
    z-index: 10;
}

.avatar-icon {
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
}

/* General Utilities */
.hidden {
    display: none !important;
}

/* ==========================================================================
   Video Quality Preset Selector & GPU Video Rendering
   ========================================================================== */
.quality-selector-container {
    position: relative;
    display: inline-block;
}

.quality-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.78rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
}

.quality-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.45);
    color: #c7d2fe;
    transform: translateY(-1px);
}

.quality-icon {
    width: 14px;
    height: 14px;
    color: var(--color-primary);
}

.quality-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 6px;
    z-index: 1000;
    box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.6);
    animation: fadeInMenu 0.15s ease-out;
}

@keyframes fadeInMenu {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.quality-item {
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: all 0.15s ease;
}

.quality-item:hover {
    background: rgba(99, 102, 241, 0.18);
}

.quality-item.active {
    background: rgba(99, 102, 241, 0.25);
    border-left: 3px solid var(--color-primary);
}

.quality-item .q-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.quality-item .q-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* GPU Hardware Video Rendering Enhancement */
video {
    image-rendering: -webkit-optimize-contrast;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ==========================================================================
   Collaborative Real-Time Whiteboard (P2P DataChannel)
/* ==========================================================================
   Excalidraw-Style Collaborative Whiteboard (Pure White Canvas & Dot Grid)
   ========================================================================== */
.whiteboard-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    background-color: #ffffff;
    background-image: radial-gradient(#cbd5e1 1.2px, transparent 1.2px);
    background-size: 20px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: wbSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes wbSlideIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.whiteboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.wb-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wb-title-icon {
    width: 18px;
    height: 18px;
    color: var(--color-primary);
}

.wb-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.wb-badge {
    background: #ecfdf5;
    color: #059669;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid #a7f3d0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Room Link & Code Badge in Whiteboard Header */
.wb-room-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 3px 10px;
    margin-left: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    color: #334155;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    outline: none;
}

.wb-room-pill:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #0f172a;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.wb-room-pill:active {
    transform: translateY(0);
}

.wb-room-pill.copied {
    background: #ecfdf5;
    border-color: #10b981;
    color: #047857;
}

.wb-room-icon {
    width: 13px;
    height: 13px;
    color: #64748b;
    transition: color 0.18s ease;
}

.wb-room-pill.copied .wb-room-icon {
    color: #047857;
}

.wb-room-prefix {
    font-weight: 700;
    font-size: 0.68rem;
    color: #64748b;
    letter-spacing: 0.04em;
}

.wb-room-pill.copied .wb-room-prefix {
    color: #059669;
}

.wb-room-code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: 0.02em;
}

.wb-copy-hint {
    font-size: 0.68rem;
    font-weight: 600;
    background: #e2e8f0;
    color: #475569;
    padding: 1px 6px;
    border-radius: 12px;
    margin-left: 4px;
    transition: all 0.18s ease;
}

.wb-room-pill:hover .wb-copy-hint {
    background: #3b82f6;
    color: #ffffff;
}

.wb-room-pill.copied .wb-copy-hint {
    background: #10b981;
    color: #ffffff;
}

.wb-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wb-action-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.wb-action-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.wb-action-btn svg {
    width: 16px;
    height: 16px;
}

.wb-close-btn:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #ef4444;
}

.wb-action-btn.export-success {
    background: #ecfdf5 !important;
    border-color: #10b981 !important;
    color: #047857 !important;
}

/* Whiteboard Export Toast Notification */
.wb-toast {
    position: fixed;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 10px 22px;
    border-radius: 30px;
    font-size: 0.86rem;
    font-weight: 600;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.65);
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.01em;
}

.wb-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.wb-toast svg {
    width: 16px;
    height: 16px;
    color: #10b981;
    flex-shrink: 0;
}

/* Floating Excalidraw Toolbar */
.whiteboard-toolbar {
    position: absolute;
    top: 68px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 60;
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    animation: toolbarFloat 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toolbarFloat {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.wb-tool-group,
.wb-fills {
    display: flex;
    align-items: center;
    gap: 4px;
}

.wb-tool-btn,
.wb-fill-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.wb-tool-btn:hover,
.wb-fill-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.wb-tool-btn.active,
.wb-fill-btn.active {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.15);
}

.wb-tool-btn svg,
.wb-fill-btn svg {
    width: 16px;
    height: 16px;
}

.wb-divider {
    width: 1px;
    height: 22px;
    background: #e2e8f0;
}

.wb-colors {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wb-color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wb-color-swatch:hover {
    transform: scale(1.15);
}

.wb-color-swatch.active {
    transform: scale(1.25);
    border-color: #ffffff;
    box-shadow: 0 0 0 2px #3b82f6;
}

.wb-sizes {
    display: flex;
    align-items: center;
    gap: 4px;
}

.wb-size-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.wb-size-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.wb-size-btn.active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}

/* Whiteboard Canvas Container & Layers */
.whiteboard-canvas-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    overflow: hidden;
}

#whiteboardCanvas,
#whiteboardPreviewCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

#whiteboardCanvas {
    pointer-events: none;
}

#whiteboardPreviewCanvas {
    pointer-events: auto;
}

/* Inline Text Editing Element */
.wb-text-input {
    position: absolute;
    z-index: 55;
    background: rgba(255, 255, 255, 0.95);
    border: 1.5px dashed #3b82f6;
    border-radius: 4px;
    outline: none;
    padding: 4px 6px;
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #1e1e1e;
    resize: none;
    min-width: 120px;
    min-height: 32px;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.2);
}

/* Active Whiteboard State: Docks Remote Video in Mini-PIP Window */
.whiteboard-active .remote-wrapper {
    position: absolute !important;
    top: 80px !important;
    right: 32px !important;
    width: 220px !important;
    height: 140px !important;
    z-index: 70 !important;
    border-radius: 16px !important;
    border: 2px solid rgba(99, 102, 241, 0.5) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
    overflow: hidden !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.whiteboard-active #localVideoWrapper {
    z-index: 71 !important;
}

#whiteboardBtn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.5);
}

#whiteboardBtn.active:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

/* Peer Active in Whiteboard Highlighter (Alerts other user when peer is on whiteboard) */
#whiteboardBtn.peer-active {
    background: rgba(14, 165, 233, 0.15) !important;
    border-color: #38bdf8 !important;
    color: #38bdf8 !important;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.4), 0 0 20px rgba(56, 189, 248, 0.7) !important;
    animation: wbPeerActiveGlow 2s infinite ease-in-out !important;
    position: relative;
}

#whiteboardBtn.peer-active::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 9px;
    height: 9px;
    background: #38bdf8;
    border: 2px solid #060913;
    border-radius: 50%;
    box-shadow: 0 0 8px #38bdf8;
    animation: wbPresencePipPulse 1.8s infinite;
}

@keyframes wbPeerActiveGlow {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3), 0 0 12px rgba(56, 189, 248, 0.4);
        border-color: #38bdf8;
    }
    50% {
        box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.6), 0 0 24px rgba(56, 189, 248, 0.85);
        border-color: #7dd3fc;
    }
}

@keyframes wbPresencePipPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.35);
        opacity: 0.75;
    }
}

#whiteboardBtn.pulse-notify {
    animation: wbPulse 1.5s infinite;
}

@keyframes wbPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

/* ==========================================================================
   Floating Feedback / Bug Trigger & Monetization Validation Modal
   ========================================================================== */

.feedback-float-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #f8fafc;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.feedback-float-btn:hover {
    transform: translateY(-2px);
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(99, 102, 241, 0.7);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.35), 0 0 0 1px rgba(99, 102, 241, 0.3);
}

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

.feedback-icon {
    font-size: 1.05rem;
    line-height: 1;
}

.feedback-text {
    white-space: nowrap;
}

/* Modal Backdrop */
.feedback-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 22, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.25s ease;
}

.feedback-modal-backdrop.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Feedback Modal Dialog */
.feedback-modal {
    background: rgba(17, 24, 39, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(99, 102, 241, 0.15);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: modalPopIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Header */
.feedback-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 16px;
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-title-icon {
    font-size: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 4px 0;
    letter-spacing: -0.01em;
}

.modal-subtitle {
    font-size: 0.82rem;
    color: #94a3b8;
    margin: 0;
    line-height: 1.35;
}

.modal-close-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.modal-close-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.modal-close-btn i {
    width: 16px;
    height: 16px;
}

/* Form Styles */
.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group.highlight-group {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 16px;
    padding: 14px;
}

.form-label {
    font-size: 0.86rem;
    font-weight: 600;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}

.q-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.25);
    color: #818cf8;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.q-badge.gold {
    background: rgba(245, 158, 11, 0.25);
    color: #fbbf24;
}

.price-pill {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #0f172a;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 9999px;
    margin-left: 2px;
}

.badge-optional {
    font-size: 0.7rem;
    font-weight: 400;
    color: #64748b;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
}

.form-input,
.form-textarea {
    width: 100%;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 10px 14px;
    color: #f8fafc;
    font-family: inherit;
    font-size: 0.86rem;
    transition: all 0.2s ease;
    outline: none;
    resize: vertical;
}

.form-input:focus,
.form-textarea:focus {
    border-color: #818cf8;
    background: rgba(15, 23, 42, 0.85);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #64748b;
}

/* Status Message */
.feedback-status-msg {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.84rem;
    font-weight: 500;
    text-align: center;
}

.feedback-status-msg.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.feedback-status-msg.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

/* Actions & Footer */
.feedback-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 6px;
}

.btn-submit-feedback {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    border: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.25s ease;
}

.btn-submit-feedback:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.55);
    filter: brightness(1.08);
}

.btn-submit-feedback:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-submit-feedback i {
    width: 16px;
    height: 16px;
}

@media (max-width: 640px) {
    .feedback-float-btn {
        bottom: 16px;
        right: 16px;
        padding: 8px 14px;
        font-size: 0.8rem;
    }
    .feedback-modal {
        padding: 20px;
        max-height: 92vh;
    }
}


