/* Copied from ai-noon-b2b-demo-agent-server/webrtc-demo with minimal/no changes */
/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 2px solid #eee;
}

header h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Control Panel */
.control-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 15px;
    border: 1px solid #e9ecef;
}

.connection-section,
.status-section {
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.connection-section h3,
.status-section h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

/* Input Groups */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fff;
}

.input-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.input-group input:disabled {
    background: #f8f9fa;
    border-color: #e9ecef;
    color: #6c757d;
}

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

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn.primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: 2px solid #3498db;
}

.btn.primary:hover {
    background: linear-gradient(135deg, #2980b9, #1e6b96);
    border-color: #2980b9;
}

.btn.secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
    border: 2px solid #95a5a6;
}

.btn.secondary:hover {
    background: linear-gradient(135deg, #7f8c8d, #6c757d);
    border-color: #7f8c8d;
}

.btn.control-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px;
    font-size: 1.2rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    justify-content: center;
}

.btn.control-btn:hover {
    background: white;
    border-color: #3498db;
}

.btn.small {
    padding: 6px 12px;
    font-size: 0.9rem;
}

.btn:disabled {
    background: #bdc3c7;
    border-color: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* Status Section */
.status-indicators {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.status-label {
    font-weight: 500;
    color: #555;
}

.status-value {
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.status-value.connected {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-value.disconnected {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Video Section */
.video-section {
    margin-bottom: 30px;
}

.video-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    min-height: 500px;
}

.local-video-container,
.remote-videos-container {
    background: #1a1a1a;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.local-video-container h4,
.remote-videos-container h4 {
    color: white;
    text-align: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.7);
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
}

#localVideo {
    width: 100%;
    height: 400px;
    object-fit: cover;
    background: #2c2c2c;
}

.video-controls {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

/* Remote Videos */
.remote-videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    padding: 15px;
    min-height: 400px;
}

.remote-video-item {
    position: relative;
    background: #2c2c2c;
    border-radius: 10px;
    overflow: hidden;
}

.remote-video-item video {
    width: 100%;
    height: auto;
    min-height: 180px;
    max-height: 400px;
    aspect-ratio: 16/9;
    object-fit: contain;
}

.video-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.no-remote-video {
    display: flex;
    align-items: center;
    justify-content: center;
    grid-column: 1 / -1;
    color: #bbb;
    font-style: italic;
    min-height: 200px;
}

.no-remote-video p {
    text-align: center;
    font-size: 1.1rem;
}

/* Participants Section */
.participants-section {
    margin-bottom: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 15px;
    border: 1px solid #e9ecef;
}

.participants-section h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 600;
    border-bottom: 2px solid #27ae60;
    padding-bottom: 8px;
}

.participants-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.participant-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-left: 4px solid #27ae60;
}

.participant-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

.participant-id {
    color: #7f8c8d;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
}

.join-time {
    color: #95a5a6;
    font-size: 0.85rem;
}

/* Logs Section */
.logs-section {
    padding: 25px;
    background: #2c3e50;
    border-radius: 15px;
    color: white;
}

.logs-section h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #34495e;
    padding-bottom: 8px;
}

.logs-container {
    background: #34495e;
    border-radius: 8px;
    padding: 15px;
    height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    border: 1px solid #4a5f7a;
}

.log-entry {
    margin-bottom: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #4a5f7a;
}

.log-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.timestamp {
    color: #bdc3c7;
    font-weight: 500;
}

/* Scrollbar Styling */
.logs-container::-webkit-scrollbar {
    width: 8px;
}

.logs-container::-webkit-scrollbar-track {
    background: #2c3e50;
    border-radius: 4px;
}

.logs-container::-webkit-scrollbar-thumb {
    background: #7f8c8d;
    border-radius: 4px;
}

.logs-container::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .video-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .local-video-container {
        order: 2;
    }

    .remote-videos-container {
        order: 1;
    }
}

@media (max-width: 900px) and (min-width: 769px) {
    .remote-video-item video {
        min-height: 150px;
        max-height: 280px;
        aspect-ratio: 16/10;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
        margin: 10px;
        border-radius: 15px;
    }

    .control-panel {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }

    .button-group {
        flex-direction: column;
    }

    header h1 {
        font-size: 2rem;
    }

    .remote-videos-grid {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .participants-list {
        grid-template-columns: 1fr;
    }

    .logs-container {
        height: 200px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
        margin: 5px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .control-panel,
    .participants-section,
    .logs-section {
        padding: 15px;
    }

    .connection-section,
    .status-section {
        padding: 15px;
    }

    #localVideo {
        height: 300px;
    }

    .remote-video-item video {
        height: auto;
        min-height: 120px;
        max-height: 200px;
        aspect-ratio: 4/3;
    }
}

.participant-item,
.log-entry,
.remote-video-item {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn {
    transition: all 0.2s ease;
}

.input-group input {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
