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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100svh;
    color: #333;
}

#app {
    height: 100svh;
    overflow: hidden;
}

/* Screen Management */
.screen {
    display: none;
    height: 100svh;
    width: 100%;
}

.screen.active {
    display: block;
}

/* Welcome Screen */
.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100svh;
    text-align: center;
    padding: 2rem;
}

.welcome-container h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.welcome-container p {
    font-size: 1.2rem;
    margin-bottom: 3rem;
    color: rgba(255,255,255,0.9);
}

/* SFU-specific styles */
.sfu-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
    max-width: 800px;
}

.info-card {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.2);
}

.info-card i {
    font-size: 2rem;
    color: #4CAF50;
    margin-bottom: 1rem;
}

.info-card h3 {
    color: white;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.info-card p {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

.join-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 400px;
}

.join-form input {
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
}

.room-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-weight: 500;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #2196F3;
    color: white;
}

.btn-secondary:hover {
    background: #1976D2;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-outline:hover {
    background: white;
    color: #333;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-icon {
    background: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-icon:hover {
    background: rgba(255,255,255,0.1);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1.5rem;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: #f0f0f0;
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

/* Share Modal Specific Styles */
.share-info {
    margin-bottom: 1.5rem;
}

.share-info p {
    margin: 0.5rem 0;
    color: #666;
}

.share-info strong {
    color: #333;
}

.share-link-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.share-link-container input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #f9f9f9;
    color: #333;
}

.share-link-container input:focus {
    outline: none;
    border-color: #2196F3;
    background: white;
}

.qr-code-container {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
}

.qr-code-container #qr-code {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.qr-code-container #qr-code canvas {
    border: 1px solid #ddd;
    border-radius: 8px;
}

.qr-hint {
    margin: 0;
    color: #666;
    font-size: 0.85rem;
}

.share-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.share-actions .btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}



/* Video Screen */
#video-screen {
    display: flex;
    flex-direction: column;
    height: 100svh;
    background: #1a1a1a;
    position: relative;
}

.video-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.video-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--video-min-width, 200px), 1fr));
    gap: var(--video-gap, 0.5rem);
    padding: var(--video-padding, 0.5rem);
    overflow-y: auto;
    max-height: calc(100vh - 120px);
    align-items: center;
    justify-items: center;
}

.video-item {
    position: relative;
    background: #2a2a2a;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16/9;
    width: var(--video-min-width, 200px);
    height: var(--video-min-height, 120px);
    max-width: var(--video-min-width, 200px);
    max-height: var(--video-max-height, 200px);
    cursor: pointer;
    transition: all 0.3s ease;
}

.video-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.video-item.focused {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vw;
    height: 80vh;
    max-width: 1200px;
    max-height: 800px;
    z-index: 1000;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    cursor: default;
}

.video-item.focused:hover {
    transform: translate(-50%, -50%);
}

.video-item.focused .video-info {
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.video-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.video-item.focused video {
    object-fit: contain;
    border-radius: 12px;
}

.video-item .video-info {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    max-width: calc(100% - 1rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    bottom: 0;
    z-index: 10;
    align-items: center;
}

/* Transcription Floating Widget */
.transcription-float {
    position: fixed;
    right: 1rem;
    bottom: 6.25rem; /* above footer controls without shifting layout */
    min-width: 260px;
    max-width: 50vw;
    background: rgba(0,0,0,0.8);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    backdrop-filter: blur(10px);
    z-index: 1002; /* above everything important */
    overflow: hidden;
}

.transcription-float[hidden] { display: none !important; }

.transcription-float .float-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255,255,255,0.06);
    cursor: move;
}

.transcription-float .float-title { font-size: 0.85rem; opacity: 0.9; }
.transcription-float .float-body {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
}
.transcription-float .float-body i { color: #4CAF50; }
#transcription-float-text { font-size: 0.9rem; line-height: 1.3; }

.transcription-float .float-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 0.75rem;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .transcription-float { right: 0.75rem; left: 0.75rem; max-width: none; }
    
    /* Share modal mobile styles */
    .share-actions {
        grid-template-columns: 1fr;
        justify-items: center;
    }
    
    .share-link-container {
        flex-direction: column;
    }
    
    .share-link-container input {
        margin-bottom: 0.5rem;
    }
    
    .qr-code-container #qr-code canvas {
        width: 150px;
        height: 150px;
    }
}

.control-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
    margin-left: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.2);
}

.control-hint i {
    font-size: 0.9rem;
}

.btn-control {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.75rem;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-control:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

.btn-control.muted {
    background: #f44336;
}

.btn-control.muted:hover {
    background: #d32f2f;
}

.recording-timer {
    font-size: 0.7rem;
    margin-left: 0.25rem;
    font-weight: bold;
}

.btn-control.recording {
    background: #f44336;
    animation: pulse 2s infinite;
}

.btn-control.btn-share {
    background: #2196F3;
}

.btn-control.btn-share:hover {
    background: #1976D2;
}

/* Hide share button on welcome screen */
#welcome-screen .btn-share {
    display: none;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}

/* Focus overlay */
.focus-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 999;
    display: none;
}

.focus-overlay.active {
    display: block;
}

/* Focus close button */
.focus-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 1001;
    transition: all 0.3s ease;
}

.focus-close:hover {
    background: rgba(244, 67, 54, 0.8);
    transform: scale(1.1);
}

/* Whiteboard Panel */
.whiteboard-panel {
    position: absolute;
    right: 0;
    top: 0; /* Start from the top since no header */
    width: 100%;
    height: calc(100svh - 0px); /* Account for video controls only */
    background: white;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 100;
}

.whiteboard-panel.active {
    transform: translateX(0);
}

    .whiteboard-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem;
        padding-right: 1rem; /* Normal padding since buttons are in flex container */
        border-bottom: 1px solid #eee;
        background: #f8f9fa;
    }

.whiteboard-header h3 {
    margin: 0;
    color: #333;
}


    


.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.whiteboard-tools {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    flex-wrap: wrap;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-right: 1px solid #ddd;
}

.tool-group:last-child {
    border-right: none;
}

.tool-btn {
    background: #e9ecef;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
}

.tool-btn:hover {
    background: #dee2e6;
    transform: scale(1.1);
}

.tool-btn.active {
    background: #4CAF50;
    color: white;
    border-color: #45a049;
}

.tool-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#color-picker {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
}

#brush-size {
    width: 100px;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    cursor: pointer;
}

#brush-size::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
}

#brush-size::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: none;
}

#brush-size-display {
    font-size: 0.9rem;
}

/* Floating Whiteboard Tools Menu Button */
.whiteboard-tools-menu {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.whiteboard-tools-toggle {
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.whiteboard-tools-toggle:hover {
    background: #45a049;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.whiteboard-tools-toggle:active {
    transform: scale(0.95);
}

/* Floating Whiteboard Clear Button */
.whiteboard-clear-menu {
    position: fixed;
    bottom: 100px;
    right: 20px; /* Position above the tools menu button */
    z-index: 9999;
}

.whiteboard-clear-toggle {
    background: #ffc107;
    color: #333;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.whiteboard-clear-toggle:hover {
    background: #e0a800;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.whiteboard-clear-toggle:active {
    transform: scale(0.95);
}

/* Floating Whiteboard Close Button */
.whiteboard-close-menu {
    position: fixed;
    bottom: 180px;
    right: 20px; /* Position above the clear button */
    z-index: 9999;
}

.whiteboard-close-toggle {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.whiteboard-close-toggle:hover {
    background: #c82333;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.whiteboard-close-toggle:active {
    transform: scale(0.95);
}

/* Mobile responsive styles for whiteboard buttons */
@media (max-width: 768px) {
    .whiteboard-tools-toggle,
    .whiteboard-clear-toggle,
    .whiteboard-close-toggle {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .whiteboard-tools-menu,
    .whiteboard-clear-menu,
    .whiteboard-close-menu {
        right: 15px;
    }
    
    .whiteboard-clear-menu {
        bottom: 75px;
    }
    
    .whiteboard-close-menu {
        bottom: 130px;
    }
}

@media (max-width: 480px) {
    .whiteboard-tools-toggle,
    .whiteboard-clear-toggle,
    .whiteboard-close-toggle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .whiteboard-tools-menu,
    .whiteboard-clear-menu,
    .whiteboard-close-menu {
        right: 5px;
    }
    
    .whiteboard-clear-menu {
        bottom: 65px;
    }
    
    .whiteboard-close-menu {
        bottom: 110px;
    }
}

/* Whiteboard Tools Modal */
#whiteboard-tools-modal {
    z-index: 9998;
}

#whiteboard-tools-modal .menu-option {
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 80px;
}

#whiteboard-tools-modal .menu-option:hover {
    background: #e9ecef;
    transform: scale(1.05);
}

#whiteboard-tools-modal .menu-option.active {
    background: #4CAF50;
    color: white;
    border-color: #45a049;
}

#whiteboard-tools-modal .menu-option-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

#whiteboard-tools-modal .menu-option-inline label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

#whiteboard-tools-modal .menu-option-inline input[type="color"] {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
}

#whiteboard-tools-modal .menu-option-inline input[type="range"] {
    width: 100px;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    cursor: pointer;
}

#whiteboard-tools-modal .menu-option-inline input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
}

#whiteboard-tools-modal .menu-option-inline input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: none;
}

/* Floating Close Button for Whiteboard Tools Modal */
.whiteboard-tools-close-float {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 9999;
}

.whiteboard-tools-close-float:hover {
    background: #c82333;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.whiteboard-tools-close-float:active {
    transform: scale(0.95);
}

.whiteboard-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: flex-start; /* top align */
    justify-content: center; /* center horizontally */
}

#whiteboard-canvas {
    position: relative;
    width: auto;
    height: 100%;
    aspect-ratio: 16/9; /* enforce landscape on all screens */
    cursor: crosshair;
    background: white;
    border: 1px solid #ddd;
    touch-action: none;
}

/* Desktop whiteboard controls */
.whiteboard-controls .btn-small {
    display: block;
}

/* Hide only clear and toggle buttons on desktop, keep close button visible */
.mobile-round-btn.clear-btn,
.mobile-round-btn.tools-btn {
    display: none;
}

/* Desktop clear button - show on desktop */
.whiteboard-controls .tool-btn[title="Clear All"] {
    display: flex;
}

/* Fullscreen whiteboard */
.whiteboard-panel.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100svh;
    z-index: 1000;
}

.whiteboard-panel.fullscreen .whiteboard-tools {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1001;
    background: rgba(248, 249, 250, 0.95);
    backdrop-filter: blur(10px);
}

.whiteboard-panel.fullscreen .whiteboard-container {
    position: absolute;
    top: 80px;
    left: 0;
    width: 100%;
    height: calc(100svh - 80px);
}

/* Chat Panel */
.chat-panel {
    position: absolute;
    right: 0;
    top: 0; /* Start from the top since no header */
    width: 350px;
    height: calc(100svh - 0px); /* Account for video controls only */
    background: white;
    border-left: 1px solid #eee;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 50;
}

/* Transcription Panel */
.transcription-panel {
    position: absolute;
    right: 0;
    top: 0;
    width: 350px;
    height: calc(100svh - 80px);
    background: white;
    border-left: 1px solid #eee;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 100;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
}

.transcription-panel.active {
    transform: translateX(0);
}

.transcription-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.transcription-header h3 {
    margin: 0;
    color: #333;
}

.transcription-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.transcription-text {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.4;
    min-height: 200px;
    white-space: pre-wrap;
}

.transcription-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.chat-panel.active {
    transform: translateX(0);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    flex-shrink: 0;
}

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

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
}

.message {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.message.own {
    align-items: flex-end;
}

.message-content {
    background: #e3f2fd;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
}

.message.own .message-content {
    background: #4CAF50;
    color: white;
}

.message-info {
    display: flex;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #666;
}

.message.own .message-info {
    justify-content: flex-end;
}

.chat-input {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid #eee;
    background: white;
    flex-shrink: 0;
}

.chat-input input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
}

.chat-input input:focus {
    border-color: #4CAF50;
}

/* Notifications */
#notifications {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-left: 4px solid #4CAF50;
    animation: slideIn 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 300px;
    max-width: 400px;
}

.notification .notification-content {
    flex: 1;
    word-wrap: break-word;
}

.notification .notification-close {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.notification .notification-close:hover {
    background: rgba(0,0,0,0.1);
    color: #333;
}

.notification.error {
    border-left-color: #f44336;
}

.notification.warning {
    border-left-color: #ff9800;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Room List */
.room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.room-item:hover {
    background: #f8f9fa;
    border-color: #4CAF50;
}

.room-item .room-name {
    font-weight: 500;
    color: #333;
}

.room-item .participant-count {
    background: #e3f2fd;
    color: #1976D2;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* Mobile-only elements */
.mobile-only {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .welcome-container h1 {
        font-size: 2rem;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: flex !important;
    }
    
    /* Menu modal responsive */
    .menu-sections {
        gap: 1.5rem;
    }
    
    .menu-section {
        gap: 0.75rem;
    }
    
    .section-title {
        font-size: 0.8rem;
        padding-bottom: 0.4rem;
    }
    
    .menu-grid {
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
        gap: 0.4rem;
    }
    
    .menu-option {
        padding: 0.75rem 0.5rem;
        min-height: 55px;
    }
    
    .menu-option i {
        font-size: 1.1rem;
        margin-bottom: 0.15rem;
    }
    
    .menu-option span {
        font-size: 0.7rem;
    }
    

    
    .sfu-info {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .room-actions {
        flex-direction: column;
        width: 100%;
        max-width: 400px;
    }
    

    
    .video-grid {
        grid-template-columns: repeat(auto-fit, minmax(var(--video-min-width, 150px), 1fr));
        padding: var(--video-padding, 0.5rem);
        gap: var(--video-gap, 0.25rem);
        max-height: calc(100vh - 120px);
    }
    
    /* Special layout for exactly 2 participants on mobile - vertical arrangement */
    .video-grid[data-participant-count="2"] {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .video-grid[data-participant-count="2"] .video-item {
        width: 100%;
        height: calc(50vh - 80px);
        max-width: 100%;
        max-height: calc(50vh - 80px);
    }
    
    .video-item {
        width: var(--video-min-width, 150px);
        height: var(--video-min-height, 100px);
        max-width: var(--video-min-width, 150px);
        max-height: var(--video-max-height, 150px);
    }
    
    .chat-panel {
        top: 0; /* Start from the very top */
        left: 0; /* Start from the very left */
        width: 100vw; /* Full viewport width */
        height: 100svh; /* Small viewport height for mobile browsers */
        position: fixed; /* Fixed positioning to cover everything */
        z-index: 1000; /* High z-index to be above everything */
        border-left: none; /* Remove border for full screen */
    }
    
    .whiteboard-panel {
        top: 0; /* Start from the very top */
        left: 0; /* Start from the very left */
        width: 100vw; /* Full viewport width */
        height: 100svh; /* Small viewport height for mobile browsers */
        position: fixed; /* Fixed positioning to cover everything */
        z-index: 1000; /* High z-index to be above everything */
    }
    
    /* Mobile whiteboard optimization */
    .whiteboard-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1001;
        background: rgba(248, 249, 250, 0.95);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid #ddd;
    }
    

    .whiteboard-controls .tool-btn[title="Clear All"] {
        display: none !important;
    }
    
    /* Collapsible tools for mobile */
    .whiteboard-tools.collapsed {
        display: none;
    }
    
    .whiteboard-tools.expanded {
        display: flex;
    }
    
    .whiteboard-container {
        position: fixed;
        top: 60px; /* Start right after the header */
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
    }
    
    /* Mobile chat optimization */
    .chat-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1001;
        background: rgba(248, 249, 250, 0.95);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid #ddd;
    }
    
    .chat-messages {
        position: fixed;
        top: 60px; /* Below the header */
        left: 0;
        right: 0;
        bottom: calc(80px + env(safe-area-inset-bottom)); /* Above the input area with safe area */
        z-index: 1000;
        padding: 1rem;
        overflow-y: auto;
        max-height: calc(100svh - 140px - env(safe-area-inset-bottom)); /* Ensure it doesn't overflow */
    }
    
    .chat-input {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1001;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border-top: 1px solid #ddd;
        padding: 1rem;
        min-height: 60px; /* Ensure minimum height for input area */
        box-sizing: border-box;
        /* Force visibility */
        display: flex !important;
        align-items: center;
        gap: 0.5rem;
        /* iOS Safari specific fixes */
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
        bottom: env(safe-area-inset-bottom);
    }
    
    .chat-input input {
        flex: 1;
        min-height: 40px;
        border: 1px solid #ddd;
        border-radius: 20px;
        padding: 0.5rem 1rem;
        font-size: 1rem;
        outline: none;
    }
    
    .chat-input button {
        min-width: 40px;
        min-height: 40px;
        border-radius: 50%;
        border: none;
        background: #4CAF50;
        color: white;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #whiteboard-canvas {
        aspect-ratio: 16/9;
        cursor: crosshair;
        background: white;
    }
    
    .video-controls {
        padding: 0.75rem;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .control-hint {
        order: 2;
        width: 100%;
        justify-content: center;
        margin-left: 0;
        margin-top: 0.5rem;
        font-size: 0.7rem;
    }
    
    .btn-control {
        width: 55px;
        height: 55px;
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .sfu-status {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .video-info {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: repeat(auto-fit, minmax(var(--video-min-width, 120px), 1fr));
        gap: var(--video-gap, 0.25rem);
        padding: var(--video-padding, 0.25rem);
        max-height: calc(100vh - 120px);
    }
    
    /* Special layout for exactly 2 participants on smaller mobile - vertical arrangement */
    .video-grid[data-participant-count="2"] {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 0.25rem;
        padding: 0.25rem;
    }
    
    .video-grid[data-participant-count="2"] .video-item {
        width: 100%;
        height: calc(50vh - 80px);
        max-width: 100%;
        max-height: calc(50vh - 80px);
    }
    
    .video-item {
        width: var(--video-min-width, 120px);
        height: var(--video-min-height, 80px);
        max-width: var(--video-min-width, 120px);
        max-height: var(--video-max-height, 80px);
    }
    
    .btn-control {
        width: 50px;
        height: 50px;
        font-size: 0.9rem;
    }
    
    .video-controls {
        padding: 0.5rem;
        gap: 0.25rem;
    }
    
    .sfu-status {
        font-size: 0.8rem;
    }
    
    /* Additional mobile whiteboard optimizations for smaller screens */
    .whiteboard-header {
        padding: 0.75rem;
    }
    
    .whiteboard-tools {
        top: 55px; /* Slightly smaller header on smaller screens */
        max-height: 180px;
        padding: 0.25rem;
        /* Ensure tools don't create a gap - they overlay the canvas */
        pointer-events: auto;
    }
    
    .whiteboard-container {
        top: 55px; /* Start right after the header on smaller screens */
    }
    
    .tool-btn {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
    }
    
    .mobile-round-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    /* Additional mobile chat optimizations for smaller screens */
    .chat-header {
        padding: 0.75rem;
    }
    
    .chat-messages {
        top: 55px; /* Slightly smaller header on smaller screens */
        bottom: 70px; /* Slightly smaller input area */
        padding: 0.75rem;
                    max-height: calc(100svh - 125px); /* Ensure it doesn't overflow */
    }
    
    .chat-input {
        padding: 0.75rem;
    }
    
    .chat-input input {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Handle very short screens */
    @media (max-height: 600px) {
        .chat-header {
            padding: 0.5rem;
            min-height: 40px;
        }
        
        .chat-messages {
            top: 40px; /* Smaller header */
            bottom: 60px; /* Smaller input area */
            padding: 0.5rem;
            max-height: calc(100svh - 100px);
        }
        
            .chat-input {
        padding: 0.5rem;
        min-height: 50px;
        /* Force visibility with higher z-index */
        z-index: 1002 !important;
        /* iOS Safari specific fixes */
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
        bottom: env(safe-area-inset-bottom);
    }
        
        .chat-input input {
            padding: 0.25rem 0.5rem;
            font-size: 0.8rem;
            min-height: 35px;
        }
        
        .chat-input button {
            min-width: 35px;
            min-height: 35px;
        }
    }
    
    /* Mobile notification optimization */
    #notifications {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
    
    .notification {
        min-width: auto;
        max-width: none;
        width: 100%;
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
    
    /* Handle extremely short screens */
    @media (max-height: 500px) {
        .chat-header {
            padding: 0.25rem;
            min-height: 30px;
        }
        
        .chat-messages {
            top: 30px;
            bottom: 50px;
            padding: 0.25rem;
            max-height: calc(100svh - 80px);
        }
        
        .chat-input {
            padding: 0.25rem;
            min-height: 40px;
            /* Force visibility with highest z-index */
            z-index: 1003 !important;
            position: fixed !important;
            bottom: env(safe-area-inset-bottom) !important;
            padding-bottom: calc(0.25rem + env(safe-area-inset-bottom));
        }
        
        .chat-input input {
            padding: 0.2rem 0.4rem;
            font-size: 0.75rem;
            min-height: 30px;
        }
        
            .chat-input button {
        min-width: 30px;
        min-height: 30px;
        padding: 0.2rem;
        font-size: 0.75rem;
    }
    
    /* Handle extremely small screens */
    @media (max-height: 400px) {
        .chat-header {
            padding: 0.1rem;
            min-height: 25px;
        }
        
        .chat-messages {
            top: 25px;
            bottom: 40px;
            padding: 0.1rem;
            max-height: calc(100svh - 65px);
        }
        
        .chat-input {
            padding: 0.1rem;
            min-height: 35px;
            z-index: 1004 !important;
            position: fixed !important;
            bottom: env(safe-area-inset-bottom) !important;
            left: 0 !important;
            right: 0 !important;
            padding-bottom: calc(0.1rem + env(safe-area-inset-bottom));
        }
        
        .chat-input input {
            padding: 0.1rem 0.3rem;
            font-size: 0.7rem;
            min-height: 25px;
        }
        
        .chat-input button {
            min-width: 25px;
            min-height: 25px;
            padding: 0.1rem;
            font-size: 0.7rem;
        }
    }
}
    
    /* Override fullscreen styles for mobile */
    .whiteboard-panel.fullscreen {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100svh;
        z-index: 1000;
    }
    
    .whiteboard-panel.fullscreen .whiteboard-tools {
        position: fixed;
        top: 55px;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 1001;
        background: rgba(248, 249, 250, 0.95);
        backdrop-filter: blur(10px);
    }
    
    .whiteboard-panel.fullscreen .whiteboard-container {
        position: fixed;
        top: 55px;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: calc(100svh - 55px);
    }
}

/* Additional improvements for better UX */
.video-item:hover .video-info {
    background: rgba(0,0,0,0.8);
}

.video-item.screen-sharing {
    border: 2px solid #4CAF50;
}

.video-item.screen-sharing .video-info {
    background: rgba(76, 175, 80, 0.8);
}

/* Ensure controls are always visible */
.video-controls {
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}

/* Better button states */
.btn-control:active {
    transform: scale(0.95);
}

.btn-control:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
} 

/* Recording Options Modal */
.recording-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recording-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.recording-option:hover {
    background: #e9ecef;
    border-color: #4CAF50;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.recording-option i {
    font-size: 1.5rem;
    color: #4CAF50;
    width: 2rem;
    text-align: center;
}

.recording-option span {
    font-weight: 500;
    color: #333;
}

/* Menu Modal Styles */
.menu-sections {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.menu-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
}

.menu-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 0.5rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #ffffff;
    text-align: center;
    width: 100%;
    min-height: 60px;
    justify-content: center;
}

.menu-option:hover {
    background: #f8f9fa;
    border-color: #4CAF50;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.menu-option:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.menu-option i {
    font-size: 1.2rem;
    color: #4CAF50;
    margin-bottom: 0.2rem;
}

.menu-option span {
    font-weight: 500;
    color: #333;
    font-size: 0.75rem;
    line-height: 1.1;
}

/* Room Info Modal Styles */
.room-info-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4CAF50;
}

.info-item strong {
    color: #333;
    font-weight: 600;
}

.info-item span {
    color: #666;
    font-weight: 500;
}

.info-item .status-indicator {
    background: #4CAF50;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}