/* Multi-Stream Display CSS */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #1a1a1a;
    color: #ffffff;
    overflow: hidden;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Toolbar Styles */
.toolbar {
    background-color: #2d2d2d;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #404040;
    flex-shrink: 0;
}

.toolbar h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.toolbar-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Button Styles */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #007acc;
    color: white;
}

.btn-primary:hover {
    background-color: #005a9e;
}

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

.btn-secondary:hover {
    background-color: #505050;
}

.config-dropdown {
    padding: 0.5rem;
    background-color: #404040;
    color: white;
    border: 1px solid #606060;
    border-radius: 4px;
    min-width: 200px;
}

/* Main Content */
.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* Stream Grid - Core CSS Grid System */
.stream-grid {
    width: 100%;
    height: 100%;
    display: grid;
    gap: 8px;
    padding: 8px;
    background-color: #1a1a1a;
}

/* Dynamic grid layouts based on stream count */
.stream-grid.grid-1x1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.stream-grid.grid-2x1 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}

.stream-grid.grid-2x2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.stream-grid.grid-3x2 {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.stream-grid.grid-3x3 {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
}

.stream-grid.grid-4x3 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
}

.stream-grid.grid-4x4 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr 1fr;
}

/* Stream Component Styles */
.stream-component {
    position: relative;
    background-color: #2d2d2d;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.stream-component:hover {
    border-color: #007acc;
}

.stream-component.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    border-radius: 0;
}

.stream-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #000;
}

.stream-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #2d2d2d;
    color: #888;
}

.stream-placeholder h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.stream-placeholder p {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Stream Controls Overlay */
.stream-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stream-component:hover .stream-controls {
    opacity: 1;
}

.stream-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
}

.stream-control-buttons {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.volume-slider {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

/* Empty State */
.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #888;
}

.empty-state.hidden {
    display: none;
}

.empty-state-content h2 {
    margin-bottom: 1rem;
    font-size: 2rem;
    font-weight: 300;
}

.empty-state-content p {
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: #2d2d2d;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: white;
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    background-color: #404040;
    border: 1px solid #606060;
    border-radius: 4px;
    color: white;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #007acc;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Error Message */
.error-message {
    position: fixed;
    top: 80px;
    right: 20px;
    background-color: #d32f2f;
    color: white;
    padding: 1rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 3000;
    max-width: 400px;
}

.error-message.hidden {
    display: none;
}

.error-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        gap: 1rem;
        padding: 0.75rem;
    }
    
    .toolbar-controls {
        width: 100%;
        justify-content: center;
    }
    
    .stream-grid {
        gap: 4px;
        padding: 4px;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
}

/* Drag and Drop Support */
.stream-component.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    z-index: 1000;
}

.stream-component.drop-target {
    border-color: #4caf50;
    background-color: rgba(76, 175, 80, 0.1);
}

.drop-zone {
    background-color: rgba(0, 122, 204, 0.2);
    border: 2px dashed #007acc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    min-height: 100px;
}

.drop-zone.drop-target {
    background-color: rgba(76, 175, 80, 0.3);
    border-color: #4caf50;
}

.drop-zone::after {
    content: 'Drop here';
    color: #007acc;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.7;
}

.drop-zone.drop-target::after {
    color: #4caf50;
    opacity: 1;
}

/* Loading States */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #007acc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}/* Stre
am Remove Button */
.stream-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background-color: rgba(211, 47, 47, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

.stream-component:hover .stream-remove-btn {
    opacity: 1;
}

.stream-remove-btn:hover {
    background-color: rgba(211, 47, 47, 1);
    transform: scale(1.1);
}

/* Success Message Styling */
.error-message.success {
    background-color: #4caf50;
}

/* Disabled State for Controls */
.btn:disabled,
.config-dropdown:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn:disabled:hover {
    background-color: inherit;
}

/* Keyboard Shortcut Hints */
.toolbar-controls .btn[title]::after {
    content: attr(title);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

.toolbar-controls .btn:hover[title]::after {
    opacity: 1;
}

/* Fullscreen Mode Adjustments */
.fullscreen-mode .toolbar,
.fullscreen-mode .error-message {
    z-index: 999;
}

/* Animation for Stream Addition/Removal */
.stream-component {
    animation: streamFadeIn 0.3s ease-out;
}

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

/* Improved Modal Animations */
.modal {
    animation: modalFadeIn 0.2s ease-out;
}

.modal-content {
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Error Message Animation */
.error-message {
    animation: errorSlideIn 0.3s ease-out;
}

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

/* Focus Styles for Accessibility */
.btn:focus,
.config-dropdown:focus,
.form-group input:focus {
    outline: 2px solid #007acc;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .stream-component {
        border-width: 3px;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .error-message {
        border: 2px solid white;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}/* In
itialization Error Styles */
.initialization-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem;
}

.initialization-error h2 {
    color: #ff6b6b;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.initialization-error p {
    margin-bottom: 1rem;
    color: #cccccc;
    max-width: 600px;
}

.initialization-error .btn {
    margin-top: 1rem;
}

/* Browser Compatibility Error Styles */
.compatibility-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem;
}

.compatibility-error h2 {
    color: #ffa500;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.compatibility-error p {
    margin-bottom: 1rem;
    color: #cccccc;
    max-width: 600px;
}