/* ========================================
   CHATROOM - Camfrog/Paltalk Style
   Video-First Chat Room Application
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Dark theme palette */
    --bg-base: #0a0a0f;
    --bg-primary: #12121a;
    --bg-secondary: #16161e;
    --bg-tertiary: #1c1c28;
    --bg-card: rgba(22, 22, 30, 0.95);
    --bg-hover: rgba(255, 255, 255, 0.04);
    --bg-active: rgba(108, 99, 255, 0.08);

    /* Text */
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #5a5a72;

    /* Accent */
    --accent: #6C63FF;
    --accent-dark: #5A52E0;
    --accent-light: #8B83FF;
    --accent-glow: rgba(108, 99, 255, 0.15);

    /* Borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(108, 99, 255, 0.3);

    /* Status colors */
    --success: #4ECDC4;
    --danger: #FF6B6B;
    --warning: #FFD93D;
    --live-red: #FF3B3B;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(108, 99, 255, 0.08);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: all 0.2s ease;
}

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

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
}

/* Background gradient */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(108, 99, 255, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(78, 205, 196, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(255, 107, 107, 0.03) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

/* ========================================
   AUTH SCREEN
   ======================================== */
.auth-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    background: var(--bg-base);
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .logo-icon {
    font-size: 48px;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 12px rgba(108, 99, 255, 0.3));
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-light), var(--accent), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: var(--transition);
}

.auth-tab.active {
    background: var(--accent);
    color: white;
}

.auth-error {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.2);
    color: var(--danger);
    font-size: 13px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    display: none;
}

.auth-error.show {
    display: block;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    margin-top: 8px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(108, 99, 255, 0.3);
}

.btn-ghost {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ========================================
   MAIN APP LAYOUT — CAMFROG STYLE
   Three columns: Sidebar | Stage | Right Panel
   ======================================== */
.chat-app {
    display: none;
    height: 100vh;
    position: relative;
    z-index: 1;
}

.chat-app.active {
    display: flex;
}

/* ========================================
   LEFT SIDEBAR (Rooms)
   ======================================== */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

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

.logo-sm {
    font-size: 24px;
}

.logo span {
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-section {
    padding: 12px 16px 4px;
}

.sidebar-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sidebar-section-title button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.sidebar-section-title button:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.room-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
}

.room-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2px;
}

.room-item:hover {
    background: var(--bg-hover);
}

.room-item.active {
    background: var(--bg-active);
    border: 1px solid var(--border-accent);
}

.room-item .room-icon {
    font-size: 18px;
}

.room-item .room-info {
    flex: 1;
    min-width: 0;
}

.room-item .room-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-item .room-meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* User panel at bottom of sidebar */
.user-panel {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(10, 10, 15, 0.5);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    position: relative;
    flex-shrink: 0;
}

.status-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    bottom: -1px;
    right: -1px;
}

.status-online {
    background: var(--success);
}

.status-offline {
    background: var(--text-muted);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-info .user-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info .user-status {
    font-size: 11px;
    color: var(--success);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
}

.logout-btn:hover {
    color: var(--danger);
    background: rgba(255, 107, 107, 0.1);
}

/* ========================================
   CENTER: STAGE AREA (Video Focus)
   ======================================== */
.stage-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-base);
    height: 100vh;
}

/* Stage header */
.stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(18, 18, 26, 0.9);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.stage-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stage-room-info {
    min-width: 0;
}

.stage-room-name {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stage-room-desc {
    font-size: 11px;
    color: var(--text-muted);
}

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

.stage-viewer-count,
.stage-cam-count {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stage-cam-count svg {
    color: var(--live-red);
}

/* ========================================
   SPOTLIGHT (Main Large Video)
   ======================================== */
.spotlight-container {
    flex: 1;
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
}

.spotlight-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    z-index: 2;
}

.spotlight-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.4;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.spotlight-empty h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.spotlight-empty p {
    font-size: 13px;
    color: var(--text-muted);
}

.spotlight-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
    z-index: 1;
    background: #000;
}

.spotlight-video.active {
    display: block;
}

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

.spotlight-label {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    z-index: 10;
}

.spotlight-username {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.spotlight-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: white;
}

/* LIVE indicator on spotlight */
.spotlight-container::after {
    content: '';
    position: absolute;
    top: 16px;
    right: 16px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--live-red);
    box-shadow: 0 0 8px rgba(255, 59, 59, 0.6);
    animation: livePulse 2s ease-in-out infinite;
    z-index: 10;
    display: none;
}

.spotlight-container.has-video::after {
    display: block;
}

@keyframes livePulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 8px rgba(255, 59, 59, 0.6);
    }

    50% {
        opacity: 0.5;
        box-shadow: 0 0 16px rgba(255, 59, 59, 0.8);
    }
}

/* ========================================
   CAM THUMBNAIL STRIP
   ======================================== */
.cam-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(12, 12, 18, 0.95);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    flex-shrink: 0;
    min-height: 84px;
}

.cam-strip::-webkit-scrollbar {
    height: 4px;
}

.cam-strip::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.cam-strip-remotes {
    display: contents;
}

.cam-thumb {
    position: relative;
    width: 98px;
    height: 68px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.cam-thumb:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}

.cam-thumb.spotlight-active {
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.cam-thumb-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #000;
}

.cam-thumb-local .cam-thumb-video {
    transform: scaleX(-1);
}

.cam-thumb-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2px 6px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 600;
    color: white;
}

.cam-thumb-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    background: var(--accent);
    color: white;
    font-size: 7px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: var(--radius-full);
    letter-spacing: 0.05em;
}

.cam-thumb-active-ring {
    position: absolute;
    inset: -2px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--accent);
    pointer-events: none;
    display: none;
}

.cam-thumb.spotlight-active .cam-thumb-active-ring {
    display: block;
    animation: ringPulse 2s ease-in-out infinite;
}

@keyframes ringPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(108, 99, 255, 0);
    }

    50% {
        box-shadow: 0 0 8px rgba(108, 99, 255, 0.3);
    }
}

/* Placeholder for connecting cam */
.cam-thumb-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    gap: 2px;
}

.cam-thumb-placeholder-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
}

.cam-thumb-placeholder-text {
    font-size: 8px;
    color: var(--text-muted);
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ========================================
   MEDIA CONTROLS BAR
   ======================================== */
.media-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(16, 16, 24, 0.98);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ctrl-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

.ctrl-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-accent);
    color: var(--text-primary);
}

.ctrl-btn.active {
    background: rgba(255, 59, 48, 0.15);
    border-color: rgba(255, 107, 107, 0.4);
    color: var(--danger);
}

.ctrl-btn-cam {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-color: var(--accent);
    color: white;
}

.ctrl-btn-cam:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(108, 99, 255, 0.3);
    color: white;
}

.ctrl-btn-cam.cam-on {
    background: linear-gradient(135deg, var(--danger), #cc4444);
    border-color: var(--danger);
    animation: camPulse 2s ease-in-out infinite;
}

@keyframes camPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
    }

    50% {
        box-shadow: 0 0 12px rgba(255, 107, 107, 0.3);
    }
}

.ctrl-btn-sm {
    padding: 8px;
    border-radius: var(--radius-sm);
}

/* Mic muted state */
.ctrl-btn.mic-muted {
    background: rgba(255, 59, 48, 0.15);
    border-color: rgba(255, 107, 107, 0.3);
    color: var(--danger);
}

/* ========================================
   RIGHT PANEL (Chat + Users)
   ======================================== */
.right-panel {
    width: 340px;
    min-width: 340px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Tabs */
.right-panel-tabs {
    display: flex;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.rp-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
    position: relative;
}

.rp-tab:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.rp-tab.active {
    color: var(--accent);
}

.rp-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
}

.rp-tab-badge {
    background: var(--success);
    color: #1a1a2e;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

/* Content sections */
.rp-content {
    flex: 1;
    display: none;
    flex-direction: column;
    min-height: 0;
}

.rp-content.active {
    display: flex;
}

/* ========================================
   CHAT TAB
   ======================================== */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 10px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    animation: messageIn 0.2s ease-out;
}

.message:hover {
    background: var(--bg-hover);
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

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

.message .msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.message .msg-content {
    flex: 1;
    min-width: 0;
}

.message .msg-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 1px;
}

.message .msg-username {
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.message .msg-username:hover {
    text-decoration: underline;
}

.message .msg-time {
    font-size: 10px;
    color: var(--text-muted);
}

.message .msg-text {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message.system-message {
    justify-content: center;
    padding: 2px 8px;
}

.message.system-message .msg-text {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

.message.compact .msg-avatar {
    display: none;
}

.message.compact {
    padding-left: 48px;
}

/* Typing indicator */
.typing-indicator {
    padding: 2px 16px;
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    min-height: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.typing-dots {
    display: inline-flex;
    gap: 2px;
}

.typing-dots span {
    width: 5px;
    height: 5px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-3px);
        opacity: 1;
    }
}

/* Message input */
.message-input-container {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    background: rgba(18, 18, 26, 0.9);
    flex-shrink: 0;
}

.message-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    transition: var(--transition);
}

.message-input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.message-input-wrapper .emoji-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 2px;
    transition: var(--transition);
    flex-shrink: 0;
}

.message-input-wrapper .emoji-btn:hover {
    color: var(--accent);
    transform: scale(1.1);
}

#messageInput {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    resize: none;
    outline: none;
    max-height: 80px;
    line-height: 1.4;
    padding: 4px 0;
}

#messageInput::placeholder {
    color: var(--text-muted);
}

.send-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border: none;
    color: white;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
}

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

/* ========================================
   USERS TAB
   ======================================== */
.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}

.users-group-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 10px 8px 4px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.user-item:hover {
    background: var(--bg-hover);
}

.user-item .user-avatar {
    width: 28px;
    height: 28px;
    font-size: 10px;
}

.user-item .user-name {
    font-size: 12px;
    font-weight: 500;
    flex: 1;
}

.user-item .user-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.user-item .user-cam-badge {
    font-size: 12px;
    flex-shrink: 0;
}

/* ========================================
   EMOJI PICKER
   ======================================== */
.emoji-picker {
    position: absolute;
    bottom: 60px;
    left: 12px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 100;
    width: 280px;
    max-height: 250px;
    animation: fadeInUp 0.2s ease-out;
}

.emoji-picker.show {
    display: block;
}

.emoji-picker .emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    max-height: 200px;
    overflow-y: auto;
    padding: 3px;
}

.emoji-picker .emoji-item {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
}

.emoji-picker .emoji-item:hover {
    background: var(--bg-hover);
    transform: scale(1.2);
}

/* ========================================
   MODALS
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: fadeInUp 0.3s ease-out;
}

.modal h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.modal p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 24px;
}

.modal .icon-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.modal .icon-option {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    background: var(--bg-primary);
    transition: var(--transition);
}

.modal .icon-option:hover {
    border-color: var(--accent);
}

.modal .icon-option.selected {
    border-color: var(--accent);
    background: var(--bg-active);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.modal .modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ========================================
   PM PANEL
   ======================================== */
.pm-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 340px;
    height: 440px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    display: none;
    flex-direction: column;
    z-index: 150;
    animation: fadeInUp 0.3s ease-out;
}

.pm-panel.show {
    display: flex;
}

.pm-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pm-header .pm-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pm-header .pm-user-name {
    font-size: 13px;
    font-weight: 600;
}

.pm-header .pm-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: var(--transition);
}

.pm-header .pm-close:hover {
    color: var(--danger);
    background: rgba(255, 107, 107, 0.1);
}

.pm-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pm-message {
    max-width: 80%;
    padding: 7px 12px;
    border-radius: var(--radius-md);
    font-size: 12px;
    line-height: 1.4;
    animation: messageIn 0.2s ease-out;
    word-wrap: break-word;
}

.pm-message.sent {
    align-self: flex-end;
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.pm-message.received {
    align-self: flex-start;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.pm-message .pm-msg-time {
    font-size: 9px;
    opacity: 0.6;
    margin-top: 3px;
}

.pm-input-container {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 6px;
}

.pm-input-container input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    padding: 8px 12px;
    outline: none;
    transition: var(--transition);
}

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

.pm-input-container button {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
}

.pm-input-container button:hover {
    transform: scale(1.02);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease-out;
    font-size: 12px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 320px;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.info {
    border-left: 3px solid var(--accent);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

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

/* ========================================
   CONNECTION STATUS DOTS
   ======================================== */
.cam-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cam-status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 6px rgba(78, 205, 196, 0.5);
}

.cam-status-dot.connecting {
    background: var(--warning);
    animation: blink 1s ease-in-out infinite;
}

.cam-status-dot.disconnected {
    background: var(--danger);
}

/* ========================================
   LOADING / EMPTY STATES
   ======================================== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.empty-state p {
    font-size: 12px;
    max-width: 250px;
}

/* Link styles */
.msg-text a {
    color: var(--accent-light);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.msg-text a:hover {
    color: var(--accent);
}

/* Mobile overlays */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 49;
    display: none;
}

.sidebar-overlay.show {
    display: block;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 22px;
    padding: 4px;
}

/* Hidden elements for compatibility */
.toggle-users-btn {
    display: none;
}

/* ========================================
   CAM CARD ANIMATIONS
   ======================================== */
.cam-thumb-entering {
    animation: camThumbIn 0.3s ease-out;
}

@keyframes camThumbIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.cam-thumb-removing {
    animation: camThumbOut 0.3s ease-out forwards;
}

@keyframes camThumbOut {
    to {
        opacity: 0;
        transform: scale(0.8);
        width: 0;
        padding: 0;
        margin: 0;
        border: 0;
    }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1100px) {
    .right-panel {
        width: 300px;
        min-width: 300px;
    }
}

@media (max-width: 900px) {
    .right-panel {
        position: fixed;
        right: -340px;
        top: 0;
        z-index: 50;
        box-shadow: var(--shadow-lg);
        transition: right 0.3s ease;
    }

    .right-panel.show-mobile {
        right: 0;
    }

    .mobile-menu-btn {
        display: block;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -240px;
        top: 0;
        z-index: 50;
        box-shadow: var(--shadow-lg);
        transition: left 0.3s ease;
    }

    .sidebar.show-mobile {
        left: 0;
    }

    .cam-thumb {
        width: 80px;
        height: 56px;
    }

    .ctrl-btn span {
        display: none;
    }

    .ctrl-btn {
        padding: 10px 14px;
    }

    .media-controls {
        padding: 8px 12px;
    }

    .pm-panel {
        width: calc(100% - 20px);
        right: 10px;
        bottom: 10px;
        height: 380px;
    }
}

@media (max-width: 480px) {
    .cam-strip {
        padding: 6px 8px;
        gap: 4px;
        min-height: 64px;
    }

    .cam-thumb {
        width: 64px;
        height: 48px;
    }
}

/* ========================================
    SCROLLBAR STYLES
   ======================================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.12);
}