/*
 *  Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */

/* Modern UI Styles for Chat Interface */
:root {
    --primary-color: #16608a;
    --secondary-color: #1e9bcf;
    --accent-color: #b4c7e7;
    --success-color: #16608a;
    --warning-color: #ff9600;
    --danger-color: #939393;
    --info-color: #1e9bcf;
    --dark-bg: #16608a;
    --light-bg: #b4c7e7;
    --text-primary: #16608a;
    --text-secondary: #939393;
    --border-color: #b4c7e7;
    --shadow: 0 4px 6px -1px rgba(22, 96, 138, 0.1), 0 2px 4px -1px rgba(22, 96, 138, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(22, 96, 138, 0.1), 0 4px 6px -2px rgba(22, 96, 138, 0.05);
}

html, body {
  margin: 0 !important;
  padding: 0 !important;
  height: 100% !important;
}

/* Default state: allow scrolling for configuration */
body {
  background: linear-gradient(135deg, #f5f5f5 0%, #f5f5f5 50%, #e0e0e0 100%) !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
  margin: 0 !important;
  padding: 20px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

/* Avatar active state: prevent scrolling */
body.avatar-active {
  overflow: hidden !important;
  height: 100vh !important;
}

/* Reduce header spacing when avatar is active */
body.avatar-active h1 {
  margin: 0 0 10px 0 !important;
  font-size: 24px !important;
}

/* Main Content Layout - Side by Side */
#mainContentContainer {
    width: 100%;
    height: auto; /* Allow natural height during configuration */
    padding: 20px;
    box-sizing: border-box;
    margin-top: 0px;
}

/* When avatar is active, constrain height */
body.avatar-active #mainContentContainer {
    height: calc(100vh - 80px); 
    padding: 10px; 
}

.content-layout {
    display: flex;
    gap: 20px;
    height: auto; /* Allow natural height during configuration */
    max-width: 1400px;
    margin: 0 auto;
}

/* When avatar is active, constrain content layout height */
body.avatar-active .content-layout {
    height: calc(100vh - 120px); /* Reduced from 200px to 120px */
    gap: 10px; 
}

/* Chat Sidebar */
.chat-sidebar {
    flex: 0 0 550px;
    min-width: 600px;
    max-width: 700px;
    background: linear-gradient(135deg, #16608a 0%, #1e9bcf 100%);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid rgba(22, 96, 138, 0.2);
}

/* Avatar Main Area */
.avatar-main {
    flex: 1;
    height: 100%;
    background: transparent;
    /* border-radius: 20px; */
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-main .video-container {
    width: 100%;
    height: 100%;
    z-index: 1000;
    position: relative;
    /* border-radius: 20px; */
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive Layout */
@media (max-width: 1200px) {
    .content-layout {
        flex-direction: column;
        height: auto;
    }
    
    .chat-sidebar {
        flex: none;
        width: 100%;
        max-width: none;
        height: 150px;
        margin-bottom: 10px;
    }
    
    .avatar-main {
        flex: none;
        height: 250px;
    }
}

@media (max-width: 768px) {
    #mainContentContainer {
        padding: 10px;
    }
    
    .content-layout {
        gap: 10px;
    }
    
    .chat-sidebar {
        height: 125px;
    }
    
    .avatar-main {
        height: 200px;
    }
}

/* Control Panel Styles */
.control-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover:before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #718096, #4a5568);
    color: white;
    box-shadow: 0 4px 15px rgba(113, 128, 150, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: white;
    box-shadow: 0 4px 15px rgba(237, 137, 54, 0.4);
}

.btn-info {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #f56565, #e53e3e);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.4);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

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

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

.btn-icon {
    font-size: 16px;
}

/* Consistent button styling for specific buttons */
#microphone,
#stopSpeaking,
#toggleSubtitles,
#stopSession {
    background: #16608a !important;
    color: white !important;
    border: none !important;
    box-shadow: none !important;
    background-image: none !important;
    text-shadow: none !important;
}

#microphone:hover,
#stopSpeaking:hover,
#toggleSubtitles:hover,
#stopSession:hover {
    background: #16608a !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Custom toggle switch for Enable Text Chat */
#customToggle {
    background-color: white !important;
}

/* Quick reply buttons (emoji buttons) styling for better readability */
.quick-reply-btn,
.suggestion-chip {
    background: white !important;
    border: 2px solid #16608a !important;
    font-size: 12px !important;
    padding: 10px 16px !important;
    color: #16608a !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
}

.quick-reply-btn:hover,
.suggestion-chip:hover {
    background: #16608a !important;
    border-color: #16608a !important;
    color: white !important;
}

/* Modern Chat Interface Styles */
.chat-interface {
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-icon {
    font-size: 18px;
}

.chat-controls {
    display: flex;
    gap: 8px;
}

.chat-control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    padding: 8px;
    transition: all 0.2s ease;
    font-size: 14px;
}

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

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: rgba(248, 250, 252, 0.8);
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 2px;
}

.message-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 70%;
    animation: messageSlideIn 0.3s ease-out;
}

/* Assistant messages align to left */
.assistant-message {
    align-self: flex-start;
}

/* User messages align to right */
.user-message {
    flex-direction: row-reverse;
    justify-content: flex-start;
    align-self: flex-end;
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.assistant-message .message-avatar {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
}

.message-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-message .message-content {
    text-align: right;
}

.user-message .message-sender {
    text-align: right;
}

.message-sender {
    font-size: 11px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}

.user-message .message-bubble {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-bottom-right-radius: 4px;
}

.assistant-message .message-bubble {
    background: #f1f5f9;
    color: #334155;
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
}

.message-time {
    font-size: 11px;
    color: white;
    margin-left: 16px;
}

/* Enhanced Chat Input Section */
.chat-input-section {
    padding: 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-top: 1px solid rgba(226, 232, 240, 0.5);
    margin-bottom: 15px; 
    margin-top: 15px; 
    transition: all 0.3s ease; 
}

.chat-input-section.hidden {
    display: none !important;
}

.modern-message-container {
    margin-top: 16px;
    transition: all 0.3s ease;
}

.modern-message-container.hidden {
    display: none !important;
}

.message-input-wrapper {
    display: flex;
    align-items: flex-end;
    background: white;
    border-radius: 24px;
    padding: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.message-input-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.5s;
}

.message-input-wrapper:focus-within::before {
    left: 100%;
}

.message-input-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 8px 25px rgba(0, 0, 0, 0.08);
}

.input-icons {
    display: flex;
    align-items: center;
    margin-right: 12px;
}

.input-icon {
    font-size: 20px;
    color: #667eea;
    animation: sparkle 2s infinite;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(180deg); }
}

.modern-message-input {
    flex: 1;
    min-height: 24px;
    max-height: 120px;
    padding: 8px 0;
    border: none;
    outline: none;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    overflow-y: auto;
    background: transparent;
}

.modern-message-input:empty::before {
    content: attr(placeholder);
    color: #94a3b8;
    font-style: italic;
}

.input-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: 12px;
}

.action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.action-btn:hover::before {
    width: 100%;
    height: 100%;
}

.attachment-btn {
    background: #e2e8f0;
    color: #64748b;
}

.attachment-btn:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

.emoji-btn {
    background: #fef3c7;
    color: #d97706;
    font-size: 16px;
}

.emoji-btn:hover {
    background: #fde68a;
    transform: translateY(-2px) scale(1.1);
}

.send-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 16px;
}

.send-btn:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.action-btn img {
    width: 18px;
    height: 18px;
    opacity: 0.8;
}

/* Input Suggestions */
.input-suggestions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.suggestion-chip {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.suggestion-chip:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Enhanced Toggle Switch */
.toggle-label {
    font-weight: 600;
    color: #334155;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Responsive Design for Chat */
@media (max-width: 768px) {
    .chat-interface {
        width: 320px;
    }
    
    .chat-messages {
        height: 300px;
    }
    
    .message-input-wrapper {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .input-actions {
        justify-content: space-between;
        margin-left: 0;
    }
    
    .input-suggestions {
        justify-content: center;
    }
}

/* Avatar Section */
.avatar-section {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    background: transparent;
    box-shadow: var(--shadow-lg);
}

.chat-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}

.chat-history {
    width: 360px;
    height: 480px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 16px;
    font-size: 14px;
    border: none;
    resize: none;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.local-video video,
.remote-video video {
    width: 100%;
    height: auto;
    border-radius: 12px;
}

.video-placeholder {
    width: 100%;
    min-height: 400px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
}

.placeholder-content {
    padding: 40px;
}

.avatar-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: pulse 2s infinite;
}

.placeholder-content h3 {
    margin: 16px 0 8px 0;
    font-size: 24px;
    font-weight: 600;
}

.placeholder-content p {
    margin: 0;
    font-size: 16px;
    opacity: 0.9;
    max-width: 300px;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 14px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #48bb78;
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.subtitles {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    z-index: 999;
}

/* Chat Input Section */
.chat-input-section {
    padding: 24px;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
}

.input-controls {
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.8);
    padding: 16px 20px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.input-controls:hover {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

/* Modern Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background-color: #cbd5e0;
    border-radius: 26px;
    transition: all 0.3s ease;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

/* Message Input Container */
.message-input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.message-input-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.message-input {
    flex: 1;
    min-height: 60px;
    max-height: 150px;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    resize: none;
    overflow-y: auto;
    background: #f8fafc;
}

.message-input:empty:before {
    content: attr(placeholder);
    color: var(--text-secondary);
    font-style: italic;
}

.input-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.attachment-btn,
.send-btn {
    padding: 12px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.attachment-btn {
    background: #e2e8f0;
    color: var(--text-secondary);
}

.attachment-btn:hover {
    background: #cbd5e0;
    transform: scale(1.05);
}

.send-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-weight: 500;
    padding: 12px 20px;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.attachment-btn img {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

/* Responsive Design */
@media (max-width: 768px) {
    .control-panel {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .chat-history {
        width: 280px;
        height: 300px;
    }
    
    .message-input-container {
        flex-direction: column;
        gap: 12px;
    }
    
    .input-actions {
        width: 100%;
        justify-content: space-between;
    }
}

.hidden {
    display: none;
}

.highlight {
    background-color: #eee;
    font-size: 1.2em;
    margin: 0 0 30px 0;
    padding: 0.2em 1.5em;
}

.warning {
    color: red;
    font-weight: 400;
}

@media screen and (min-width: 1000px) {
    /* hack! to detect non-touch devices */
    div#links a {
        line-height: 0.8em;
    }
}

audio {
    max-width: 100%;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-weight: 400;
    margin: 0;
    padding: 24px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    word-break: break-word;
}

/* Legacy button styles for configuration section */
button:not(.btn) {
    background-color: #d84a38;
    border: none;
    border-radius: 2px;
    color: white;
    font-family: 'Roboto', sans-serif;
    font-size: 0.8em;
    margin: 10px 0 1em 0;
    padding: 0.5em 0.7em 0.6em 0.7em;
}

button:not(.btn):active {
    background-color: #cf402f;
}

button:not(.btn):hover {
    background-color: #cf402f;
}

button:not(.btn)[disabled] {
    color: #ccc;
}

button:not(.btn)[disabled]:hover {
    background-color: #d84a38;
}

canvas {
    background-color: #ccc;
    max-width: 100%;
    width: 100%;
}

code {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
}

div#container {
    margin: 0 auto 0 auto;
    max-width: 60em;
    padding: 1em 1.5em 1.3em 1.5em;
}

div#links {
    padding: 0.5em 0 0 0;
}

h1 {
    border-bottom: 1px solid #ccc;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-weight: 600;
    margin: 0 0 0.8em 0;
    padding: 0 0 0.2em 0;
    color: var(--text-primary);
    font-size: 32px;
}

h2 {
    color: #444;
    font-weight: 500;
}

h3 {
    border-top: 1px solid #eee;
    color: #666;
    font-weight: 500;
    margin: 10px 0 10px 0;
    white-space: nowrap;
}

li {
    margin: 0 0 0.4em 0;
}

html {
    /* avoid annoying page width change
    when moving from the home page */
    overflow-y: scroll;
}

img {
    border: none;
    max-width: 100%;
}

input[type=radio] {
    position: relative;
    top: -1px;
}

p {
    color: #444;
    font-weight: 300;
}

p#data {
    border-top: 1px dotted #666;
    font-family: Courier New, monospace;
    line-height: 1.3em;
    max-height: 1000px;
    overflow-y: auto;
    padding: 1em 0 0 0;
}

p.borderBelow {
    border-bottom: 1px solid #aaa;
    padding: 0 0 20px 0;
}

section p:last-of-type {
    margin: 0;
}

section {
    border-bottom: 1px solid #eee;
    margin: 0 0 30px 0;
    padding: 0 0 20px 0;
}

section:last-of-type {
    border-bottom: none;
    padding: 0 0 1em 0;
}

select {
    margin: 0 1em 1em 0;
    position: relative;
    top: -1px;
}

h1 span {
    white-space: nowrap;
}

a {
    color: #1D6EEE;
    font-weight: 300;
    text-decoration: none;
}

h1 a {
    font-weight: 300;
    margin: 0 10px 0 0;
    white-space: nowrap;
}

a:hover {
    color: #3d85c6;
    text-decoration: underline;
}

a#viewSource {
    display: block;
    margin: 1.3em 0 0 0;
    border-top: 1px solid #999;
    padding: 1em 0 0 0;
}

div#errorMsg p {
    color: #F00;
}

div#links a {
    display: block;
    line-height: 1.3em;
    margin: 0 0 1.5em 0;
}

div.outputSelector {
    margin: -1.3em 0 2em 0;
}

p.description {
    margin: 0 0 0.5em 0;
}

strong {
    font-weight: 500;
}

textarea {
    font-family: 'Roboto', sans-serif;
}

video {
    background: #222;
    margin: 0;
    --width: 100%;
    width: var(--width);
    height: calc(var(--width) * 0.75);
}

/* Override video positioning for avatar area */
.avatar-main video {
    margin: 0;
    display: block;
}

ul {
    margin: 0 0 0.5em 0;
}

@media screen and (max-width: 650px) {
    .highlight {
        font-size: 1em;
        margin: 0 0 20px 0;
        padding: 0.2em 1em;
    }

    h1 {
        font-size: 24px;
    }
}

@media screen and (max-width: 550px) {
    button:active {
        background-color: darkRed;
    }

    h1 {
        font-size: 22px;
    }
}

@media screen and (max-width: 450px) {
    h1 {
        font-size: 20px;
    }
}

textarea {
    width: 800px;
    min-height: 60px;
    margin-bottom: 10px;
}

#webrtc textarea {
    width: 800px;
    min-height: 100px;
    resize: none;
}

#knownIssues {
    color: red;
}

/* The switch - the box around the slider */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked + .slider {
    background-color: #d84a38;
}

input:focus + .slider {
    box-shadow: 0 0 1px #d84a38;
}

input:checked + .slider:before {
    -webkit-transform: translateX(20px);
    -ms-transform: translateX(20px);
    transform: translateX(20px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.switchLabel {
    display: inline-block;
    vertical-align: middle;
    position: relative;
    margin-top: 5px;
}