/* WebRTC Video Calling App Styles */
* {
    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: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: white;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 10px;
}

/* User Input Section */
.user-inputs {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    margin-bottom: 25px;
}

.user-inputs .input-group {
    margin-bottom: 15px;
}

.user-inputs .button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.input-group {
    flex: 1;
    min-width: 200px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.join-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 120px;
}

.join-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.join-btn:active {
    transform: translateY(0);
}

/* Video Container */
.video-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

@media (max-width: 768px) {
    .video-container {
        grid-template-columns: 1fr;
    }
}

.video-wrapper {
    position: relative;
    background: #2c3e50;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    aspect-ratio: 4/3;
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-wrapper canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-label {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: 500;
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    justify-content: center;
}

.control-btn .icon {
    font-size: 18px;
}

.control-btn.audio-on {
    background: #27ae60;
    color: white;
}

.control-btn.audio-on:hover {
    background: #219a52;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.4);
}

.control-btn.audio-off {
    background: #e74c3c;
    color: white;
}

.control-btn.audio-off:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.control-btn.video-on {
    background: #3498db;
    color: white;
}

.control-btn.video-on:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.control-btn.video-off {
    background: #95a5a6;
    color: white;
}

.control-btn.video-off:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(149, 165, 166, 0.4);
}

.control-btn.hang-up {
    background: #e74c3c;
    color: white;
}

.control-btn.hang-up:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Status */
.status {
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.status .status {
    font-size: 16px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 20px;
    display: inline-block;
    min-width: 200px;
}

.status.disconnected {
    background: #e74c3c;
    color: white;
}

.status.connecting {
    background: #f39c12;
    color: white;
    animation: pulse 1.5s infinite;
}

.status.connected {
    background: #27ae60;
    color: white;
}

/* Animations */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .user-inputs {
        flex-direction: column;
        gap: 15px;
    }
    
    .input-group {
        min-width: auto;
    }
    
    .controls {
        gap: 10px;
    }
    
    .control-btn {
        min-width: 100px;
        padding: 10px 15px;
        font-size: 13px;
    }
    
    header h1 {
        font-size: 2em;
    }
}

@media (max-width: 480px) {
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 200px;
    }
}

/* Connection Quality Indicator */
.connection-quality {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
}

.connection-quality.excellent {
    background: #27ae60;
}

.connection-quality.good {
    background: #f39c12;
}

.connection-quality.poor {
    background: #e74c3c;
}

#remoteCanvas {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
}

/* Enhanced styles for SFU features */
.quality-controls {
    margin: 20px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.quality-controls label {
    font-weight: bold;
    margin-right: 10px;
}

.quality-controls select {
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
}

.network-stats {
    margin-top: 10px;
    display: flex;
    gap: 20px;
    font-family: monospace;
    font-size: 0.9em;
}

.network-stats span {
    padding: 4px 8px;
    background: #e8f4f8;
    border-radius: 4px;
    border: 1px solid #bee5eb;
}

.audio-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(40, 167, 69, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    animation: pulse 1s ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.button-group button:first-child {
    background: #17a2b8;
}

.button-group button:first-child:hover {
    background: #138496;
}

/* Quick Test Styles */
.quick-test-instructions {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1003;
}

.tab-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.tab-setup {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #dee2e6;
}

.tab-setup h4 {
    color: #495057;
    margin-bottom: 10px;
}

.countdown {
    background: #fff3cd;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    color: #856404;
    margin: 20px 0;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Enhanced notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    animation: slideIn 0.3s ease-out forwards;
}

.notification.success {
    background: #28a745;
}

.notification.error {
    background: #dc3545;
}

.notification.warning {
    background: #ffc107;
    color: #333;
}

.notification.info {
    background: #17a2b8;
    color: white;
}

.notification.joined {
    background: #17a2b8;
}

.notification.left {
    background: #6c757d;
}

@keyframes slideIn {
    to {
        transform: translateX(0);
    }
}

/* Local Testing Info Panel */
.local-testing-info {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1002;
}

.info-panel {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    border-left: 5px solid #17a2b8;
}

.info-panel h3 {
    color: #17a2b8;
    margin-bottom: 20px;
    font-size: 1.4em;
}

.info-panel h4 {
    color: #495057;
    margin: 20px 0 10px 0;
    font-size: 1.1em;
}

.info-panel p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.info-panel ol, .info-panel ul {
    margin: 10px 0 15px 20px;
    line-height: 1.8;
}

.info-panel li {
    margin-bottom: 8px;
}

.test-urls {
    background: #e9ecef;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.test-urls code {
    background: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #495057;
    display: block;
    margin: 5px 0;
}

.test-urls button {
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 10px;
    transition: background-color 0.3s;
}

.test-urls button:hover {
    background: #218838;
}

.info-panel button {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 20px;
    transition: background-color 0.3s;
}

.info-panel button:hover {
    background: #138496;
}


.localhost-connection-help {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 10px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.help-panel {
    background: white;
    padding: 20px;
    border-radius: 8px;
    color: #333;
}

.help-panel h3 {
    color: #e74c3c;
    margin-top: 0;
}

.help-panel h4 {
    color: #2980b9;
    margin: 15px 0 8px 0;
}

.help-section {
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.help-section ol, .help-section ul {
    margin: 8px 0;
    padding-left: 20px;
}

.help-section li {
    margin: 5px 0;
}

.help-section code {
    background: #eee;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.btn-primary {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary:hover {
    background: #7f8c8d;
}


.codec-info {
    background: #f0f0f0;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.codec-selector, .quality-selector, .svc-config {
    margin: 15px 0;
}

.codec-selector label, .quality-selector label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.codec-selector select, .quality-selector select {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.svc-config label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
}

.quality-layers {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.quality-layer {
    flex: 1;
    min-width: 150px;
    padding: 15px;
    background: #e0e0e0;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.quality-layer.active {
    background: #4CAF50;
    color: white;
    border-color: #45a049;
    transform: scale(1.05);
}

.quality-layer small {
    color: #666;
}

.quality-layer.active small {
    color: #e0e0e0;
}

.svc-indicator {
    background: #ff9800;
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
}

.network-indicators {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.network-indicators div {
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    text-align: center;
    font-family: monospace;
}

.debug-section {
    margin-top: 30px;
}

#debugLog {
    width: 100%;
    font-family: monospace;
    font-size: 12px;
    background: #2b2b2b;
    color: #00ff00;
    border: none;
    border-radius: 4px;
    padding: 10px;
}

.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.stats-section {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
}

.stats-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .quality-layers {
        flex-direction: column;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .network-indicators {
        grid-template-columns: 1fr;
    }
}