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

body {
    font-family: 'HeleveticaNeue', sans-serif;
    background-color: #000;
    color: white;
    font-size: 1rem;
}

h2 {
    text-align: center;
    font-size: 1rem;
}

.container {
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 0;
}

.join-container {
    text-align: center;
    margin-top: 100px;
}

.join-container h1 {
    margin-bottom: 30px;
    color: #777;
}

.join-room {
    margin-top: 20px;
}

button {
    background-color: #777;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1rem;
    margin: 5px;
}

button:hover {
    background-color: #999;
}

input {
    padding: 10px;
    font-size: 1rem;
    border: 1px solid #ccc;
    margin-right: 10px;
}

.room-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

.room-info {
    padding: 10px 20px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    z-index: 100;
    position: relative;
}

.main-content {
    position: relative;
    width: 100%;
    height: calc(100vh - 80px);
    overflow: hidden;
    background: #000;
}

.video-grid {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0;
}

.video-container {
    position: relative;
    background: #000;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Remote video - maximize */
.video-container:not(#video-local) {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
}

/* Local video - small corner window */
#video-local {
    position: fixed;
    bottom: 20px;
    right: 80px;
    width: 200px;
    height: 150px;
    z-index: 50;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: move;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

#video-local:hover {
    border-color: rgba(255, 255, 255, 0.6);
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Remote video should contain to show full person */
.video-container:not(#video-local) video {
    object-fit: contain;
}

.video-container.enlarged {
    position: fixed;
    width: 100vw;
    height: 100vh;
    padding-top: 0;
    top: 0;
    left: 0;
    transform: none;
    z-index: 1000;
    margin: 0;
}

.video-container.enlarged video {
    object-fit: contain;
    background: black;
}

/* Overlay for when a video is enlarged */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Close button for enlarged video */
.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    cursor: pointer;
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
}

.enlarged .close-button {
    opacity: 1;
    pointer-events: auto;
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.hidden {
    display: none;
}

/* Sidebar Icons */
.sidebar-icons {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 200;
}

.sidebar-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    margin: 0;
}

.sidebar-icon:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.sidebar-icon svg {
    width: 24px;
    height: 24px;
}

/* Floating Panels */
.floating-panel {
    position: fixed;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 150;
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
}

.floating-panel:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0) !important;
}

/* Chat Panel Styles */
.chat-panel {
    width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    right: 90px;
    top: 50%;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(42, 42, 42, 0.8);
    border-radius: 12px 12px 0 0;
}

.chat-header h3 {
    margin: 0;
    color: #fff;
}

.chat-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 300px;
    max-height: 50vh;
}

.chat-message {
    background: #333;
    padding: 10px;
    border-radius: 8px;
    max-width: 100%;
}

.chat-message .username {
    font-weight: bold;
    color: #4CAF50;
    font-size: 0.8rem;
    margin-bottom: 5px;
}

.chat-message .text {
    word-wrap: break-word;
}

.chat-message .timestamp {
    font-size: 0.7rem;
    color: #888;
    margin-top: 5px;
}

.chat-input-container {
    display: flex;
    padding: 15px;
    gap: 10px;
    border-top: 1px solid #333;
}

.chat-input-container input {
    flex: 1;
    background: #333;
    border: 1px solid #555;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
}

.chat-input-container button {
    padding: 8px 16px;
    background: #4CAF50;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
}

/* Files Panel Styles */
.files-panel {
    width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    right: 90px;
    top: 50%;
}

.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(42, 42, 42, 0.8);
    border-radius: 12px 12px 0 0;
}

.files-header h3 {
    margin: 0;
    color: #fff;
}

.files-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

.file-upload-area {
    padding: 15px;
    border-bottom: 1px solid #333;
}

.drop-zone {
    border: 2px dashed #555;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.drop-zone p {
    color: #888;
    margin: 0;
}

.shared-files {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    min-height: 200px;
    max-height: 50vh;
}

.file-item {
    background: #333;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.file-item:hover {
    background: #444;
}

.file-item .filename {
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}

.file-item .file-info {
    font-size: 0.8rem;
    color: #888;
}

/* Image Panel Styles */
.image-panel {
    width: 500px;
    max-width: 90vw;
    max-height: 85vh;
    right: 90px;
    top: 50%;
}

.image-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(42, 42, 42, 0.8);
    border-radius: 12px 12px 0 0;
}

.image-header h3 {
    margin: 0;
    color: #fff;
}

.image-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

.image-container {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#sharedCanvas {
    background: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: crosshair;
    max-width: 100%;
    height: auto;
    touch-action: none;
    border-radius: 8px;
}

.image-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.image-controls button {
    padding: 8px 16px;
    background: #4CAF50;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #video-local {
        width: 120px;
        height: 90px;
        bottom: 10px;
        right: 70px;
    }
    
    .sidebar-icons {
        right: 10px;
    }
    
    .sidebar-icon {
        width: 40px;
        height: 40px;
    }
    
    .chat-panel,
    .files-panel {
        width: calc(100vw - 80px);
        max-height: 70vh;
        right: 60px;
    }
    
    .image-panel {
        width: calc(100vw - 80px);
        max-height: 75vh;
        right: 60px;
    }
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        height: auto;
    }
    
    .video-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .chat-panel,
    .files-panel {
        width: 100%;
        height: 300px;
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 1000;
    }
    
    /* Make image panel smaller and non-intrusive */
    .image-panel {
        width: 100%;
        height: 40vh;
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 1000;
        max-height: 300px;
    }
    
    #sharedCanvas {
        width: 100%;
        height: auto;
        max-height: 200px;
    }
    
    .controls {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .controls button {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    /* Ensure video grid is still visible when image panel is open */
    .video-grid {
        margin-bottom: 40vh;
        max-height: 60vh;
        overflow-y: auto;
    }
    
    /* Floating video windows for mobile */
    .video-container.floating {
        position: fixed;
        top: 20px;
        right: 20px;
        width: 120px;
        height: 90px;
        z-index: 2000;
        border: 2px solid #000;
        background: #fff;
        transition: all 0.3s ease;
        cursor: move;
        box-shadow: none;
        border-radius: 0;
    }
    
    .video-container.floating video {
        border-radius: 0;
        object-fit: cover;
    }
    
    .video-container.floating .floating-controls {
        position: absolute;
        top: -8px;
        right: -8px;
        display: flex;
        gap: 2px;
        z-index: 2001;
    }
    
    .video-container.floating .floating-controls button {
        width: 16px;
        height: 16px;
        border-radius: 0;
        border: 1px solid #000;
        font-size: 10px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        margin: 0;
        font-weight: bold;
    }
    
    .video-container.floating .minimize-btn {
        background: #ffff00;
        color: #000;
    }
    
    .video-container.floating .close-btn {
        background: #ff0000;
        color: #fff;
    }
    
    .video-container.floating .expand-btn {
        background: #00ff00;
        color: #000;
    }
    
    /* Minimized state */
    .video-container.minimized {
        width: 80px;
        height: 60px;
        opacity: 0.8;
    }
    
    .video-container.minimized .floating-controls {
        opacity: 0;
        pointer-events: none;
    }
    
    .video-container.minimized:hover {
        opacity: 1;
    }
    
    .video-container.minimized:hover .floating-controls {
        opacity: 1;
        pointer-events: auto;
    }
    
    /* Hidden state */
    .video-container.hidden {
        display: none;
    }
}
