:root {
    --bg-main: #070a13;
    --bg-dark: #03050a;
    --bg-card: rgba(15, 23, 42, 0.45);
    --primary: #00d2ff;
    --primary-gradient: linear-gradient(135deg, #00d2ff, #0066ff);
    --accent: #F3D261;
    --border: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(0, 210, 255, 0.25);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #00e676;
    --warning: #ffb300;
    --danger: #ff1744;
    --glass-blur: blur(12px);
    --shadow-glow: 0 0 15px rgba(0, 210, 255, 0.15);
    --shadow-danger: 0 0 15px rgba(255, 23, 68, 0.35);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(0, 210, 255, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 102, 255, 0.03) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Header */
header {
    background: rgba(7, 10, 19, 0.85);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

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

.brand-icon {
    width: 38px;
    height: 38px;
    background: var(--primary-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    box-shadow: var(--shadow-glow);
}

.brand-text h1 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: white;
}

.brand-text p {
    font-size: 0.72rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.sync-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 230, 118, 0.1);
    border: 1px solid rgba(0, 230, 118, 0.2);
    color: var(--success);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.status-dot.pulsing {
    box-shadow: 0 0 8px var(--success);
    animation: statusPulse 1.8s infinite;
}

@keyframes statusPulse {
    0% { transform: scale(0.95); opacity: 0.5; }
    50% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 12px var(--success); }
    100% { transform: scale(0.95); opacity: 0.5; }
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-main);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.25s;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

/* Layout Grid */
.main-layout {
    display: grid;
    grid-template-columns: 280px 1fr 340px;
    gap: 20px;
    flex: 1;
    padding: 20px;
    overflow: hidden;
    height: calc(100vh - 70px);
}

@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 240px 1fr;
    }
    .right-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .left-sidebar, .right-sidebar {
        display: none;
    }
}

/* Common Widget Cards */
.section-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.section-card.flex-grow {
    flex: 1;
    overflow-y: auto;
}

.section-card h3 {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-left: 3px solid var(--primary);
    padding-left: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.member-count {
    font-size: 0.75rem;
    background: rgba(0, 210, 255, 0.1);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* Sidebar List elements */
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(3, 5, 10, 0.6);
    border: 1px solid var(--border);
    color: white;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: all 0.3s;
}

.form-group select:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.site-meta {
    background: rgba(3, 5, 10, 0.3);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.site-meta strong {
    color: white;
}

.member-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
    padding-right: 5px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.member-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.05);
}

.member-item.active-call {
    border-color: rgba(0, 230, 118, 0.15);
    background: rgba(0, 230, 118, 0.02);
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    position: relative;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-circle .status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
    position: absolute;
    bottom: 0;
    right: 0;
}

.avatar-circle .status-indicator.online { background-color: var(--success); }
.avatar-circle .status-indicator.offline { background-color: var(--text-muted); }
.avatar-circle .status-indicator.calling { background-color: var(--danger); animation: callingPulse 1s infinite; }

@keyframes callingPulse {
    0% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.7; }
}

.member-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}

.member-info span.name {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-info span.role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.member-item.ai-bot .avatar-circle {
    background: linear-gradient(135deg, #a855f7, #6366f1);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

/* Chat Main Viewport */
.chat-viewport {
    background: rgba(15, 23, 42, 0.25);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.chat-header-bar {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(3, 5, 10, 0.4);
}

.room-info h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: white;
}

.room-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
}

.pulse-icon {
    width: 6px;
    height: 6px;
    background: var(--warning);
    border-radius: 50%;
    display: inline-block;
    animation: statusPulse 2s infinite;
}

.btn-primary {
    padding: 10px 18px;
    background: var(--primary-gradient);
    border: none;
    color: white;
    font-weight: 700;
    font-size: 0.82rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-glow);
    transition: all 0.25s;
}

.btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.35);
}

.btn-primary.in-call {
    background: linear-gradient(135deg, #ff1744, #d50000);
    box-shadow: var(--shadow-danger);
}

.btn-primary.in-call:hover {
    box-shadow: 0 0 20px rgba(255, 23, 68, 0.55);
}

/* Chat Messages */
.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message-bubble-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 80%;
}

.message-bubble-wrapper.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-bubble-wrapper.ai {
    align-self: flex-start;
}

.message-bubble-wrapper.remote {
    align-self: flex-start;
}

.msg-bubble-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.msg-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.message-bubble-wrapper.user .msg-meta {
    justify-content: flex-end;
}

.msg-bubble-content {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.45;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-main);
    word-break: break-word;
}

.message-bubble-wrapper.user .msg-bubble-content {
    background: rgba(0, 210, 255, 0.08);
    border-color: rgba(0, 210, 255, 0.25);
    border-bottom-right-radius: 2px;
}

.message-bubble-wrapper.ai .msg-bubble-content {
    background: rgba(168, 85, 247, 0.08);
    border-color: rgba(168, 85, 247, 0.25);
    border-bottom-left-radius: 2px;
}

.message-bubble-wrapper.remote .msg-bubble-content {
    background: rgba(255, 255, 255, 0.04);
    border-bottom-left-radius: 2px;
}

.msg-bubble-content img.msg-image {
    max-width: 100%;
    max-height: 250px;
    border-radius: 8px;
    margin-top: 8px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.2s;
    display: block;
}

.msg-bubble-content img.msg-image:hover {
    transform: scale(1.02);
}

.msg-bubble-content .system-suggestion-box {
    background: rgba(3, 5, 10, 0.4);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 10px;
    font-size: 0.8rem;
}

/* Chat Input Area */
.chat-input-area {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    background: rgba(3, 5, 10, 0.5);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-actions-bar {
    display: flex;
    gap: 8px;
}

.icon-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.icon-action-btn:hover {
    background: rgba(255,255,255,0.08);
    color: white;
    border-color: var(--primary);
}

.input-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input-area textarea {
    flex: 1;
    background: rgba(7, 10, 19, 0.7);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    padding: 12px 16px;
    font-size: 0.9rem;
    resize: none;
    outline: none;
    max-height: 120px;
    transition: all 0.25s;
    line-height: 1.4;
}

.chat-input-area textarea:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.btn-send {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-send:hover {
    transform: scale(1.03);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
}

/* Right Sidebar: Video Panel & Controls */
.video-card-widget {
    border: 1px solid rgba(255,23,68,0.15);
    background: rgba(255, 23, 68, 0.01);
    box-shadow: 0 8px 32px rgba(255, 23, 68, 0.05);
}

.call-duration {
    font-size: 0.75rem;
    color: var(--danger);
    background: rgba(255, 23, 68, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

.video-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    aspect-ratio: 16/11;
}

.video-stream-card {
    background: #03050a;
    border-radius: 10px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    aspect-ratio: 4/3;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.video-stream-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.75rem;
    background: #0b0f19;
}

.video-placeholder .avatar-circle {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
}

.stream-label {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    pointer-events: none;
    border: 1px solid rgba(255,255,255,0.05);
}

/* Pulsing visual for Site Engineer */
.pulsing-wave {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(0, 210, 255, 0.15);
    animation: radarRipple 2s infinite;
}

@keyframes radarRipple {
    0% { transform: scale(0.3); opacity: 0.8; }
    100% { transform: scale(1.2); opacity: 0; }
}

/* AI stream card styles */
.ai-facilitator-stream {
    border-color: rgba(168, 85, 247, 0.25);
    background: radial-gradient(circle at center, #1b0a2c 0%, #03050a 100%);
}

.ai-stream-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orb-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    position: relative;
}

.neon-orb {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #d8b4fe, #a855f7 40%, #4c1d95 85%);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.6), inset 0 0 10px rgba(255,255,255,0.4);
    animation: orbFloat 3s ease-in-out infinite;
}

@keyframes orbFloat {
    0% { transform: translateY(0px) scale(1); box-shadow: 0 0 20px rgba(168, 85, 247, 0.6); }
    50% { transform: translateY(-6px) scale(1.05); box-shadow: 0 0 35px rgba(168, 85, 247, 0.8); }
    100% { transform: translateY(0px) scale(1); box-shadow: 0 0 20px rgba(168, 85, 247, 0.6); }
}

/* Audio Waves */
.audio-waves {
    display: flex;
    gap: 4px;
    height: 20px;
    align-items: center;
}

.audio-waves span {
    width: 3px;
    background: var(--primary);
    border-radius: 3px;
    transition: height 0.1s ease;
    height: 3px;
}

/* Active talking animation */
.audio-waves.talking span {
    animation: wavePulse 1.2s ease-in-out infinite;
}

.audio-waves.talking span:nth-child(1) { animation-delay: 0.1s; height: 12px; }
.audio-waves.talking span:nth-child(2) { animation-delay: 0.3s; height: 20px; }
.audio-waves.talking span:nth-child(3) { animation-delay: 0s; height: 8px; }
.audio-waves.talking span:nth-child(4) { animation-delay: 0.4s; height: 16px; }
.audio-waves.talking span:nth-child(5) { animation-delay: 0.2s; height: 10px; }

@keyframes wavePulse {
    0%, 100% { transform: scaleY(0.3); }
    50% { transform: scaleY(1); }
}

/* Screen sharing presentation viewport */
.screen-share-presentation {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 10px;
    background: #000;
    position: relative;
    border: 1.5px solid var(--primary);
    box-shadow: var(--shadow-glow);
    margin-bottom: 12px;
    overflow: hidden;
}

.screen-share-presentation video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.presentation-header {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.7);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.72rem;
    border: 1px solid rgba(255,255,255,0.05);
}

.btn-stop-share {
    background: var(--danger);
    color: white;
    border: none;
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.68rem;
}

/* Control buttons bar */
.video-controls-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 15px;
    background: rgba(3, 5, 10, 0.4);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.control-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.control-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: var(--primary);
}

.control-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}

.control-btn.danger {
    background: rgba(255, 23, 68, 0.15);
    border-color: rgba(255, 23, 68, 0.3);
    color: var(--danger);
}

.control-btn.danger:hover {
    background: var(--danger);
    color: white;
    box-shadow: var(--shadow-danger);
}

/* Gallery Section */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    overflow-y: auto;
    max-height: 250px;
    padding-right: 5px;
}

.gallery-item {
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    background: #03050a;
    transition: all 0.25s;
}

.gallery-item:hover {
    border-color: var(--primary);
    transform: scale(1.04);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Lightbox Modal */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(3, 5, 10, 0.95);
    backdrop-filter: blur(10px);
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 80%;
    max-height: 75vh;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    animation: zoomIn 0.3s;
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close-lightbox {
    position: absolute;
    top: 25px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close-lightbox:hover {
    color: var(--danger);
    transform: scale(1.1);
}

.lightbox-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: var(--text-muted);
    padding: 15px 0;
    font-size: 0.9rem;
    font-weight: 500;
}
