/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Главная страница */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.welcome-card {
    background: white;
    border-radius: 20px;
    padding: 50px 40px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.welcome-card h1 {
    font-size: 2.5em;
    margin-bottom: 15px;
    color: #667eea;
}

.subtitle {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 40px;
}

/* Кнопки */
.button-group {
    margin-bottom: 30px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px 35px;
    font-size: 1.3em;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(72, 187, 120, 0.4);
}

.btn-icon {
    font-size: 1.2em;
}

/* Разделитель */
.divider {
    position: relative;
    margin: 30px 0;
    text-align: center;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: #ddd;
}

.divider span {
    position: relative;
    background: white;
    padding: 0 15px;
    color: #999;
    font-size: 0.9em;
}

/* Секция информации */
.info-section {
    margin-bottom: 40px;
    padding: 20px;
    background: #f0f4ff;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.info-text {
    color: #555;
    font-size: 1em;
    line-height: 1.6;
    margin: 0;
}

/* Особенности */
.features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 30px;
}

.feature {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f7fafc;
    border-radius: 10px;
    font-size: 0.95em;
    color: #555;
}

.feature-icon {
    font-size: 1.5em;
}

/* Страница комнаты */
.room-page {
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.room-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 20px;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.room-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: white;
}

.room-label {
    font-size: 1.2em;
    font-weight: 600;
    color: white;
}

.btn-icon-small {
    background: rgba(72, 187, 120, 0.8);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1em;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-icon-small:hover {
    background: rgba(72, 187, 120, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

/* Контейнер видео */
.video-container {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 100px;
    background: #1a1a1a;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 15px;
    padding: 15px;
    overflow-y: auto;
    align-content: start;
}

.video-wrapper {
    position: relative;
    background: #2d2d2d;
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    aspect-ratio: 4 / 3;
    min-height: 240px;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.video-wrapper:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Подсветка при речи */
.video-wrapper.speaking {
    border-color: #48bb78;
    box-shadow: 0 0 20px rgba(72, 187, 120, 0.6),
                0 4px 15px rgba(0, 0, 0, 0.3);
    animation: pulse-border 1.5s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% {
        border-color: #48bb78;
        box-shadow: 0 0 20px rgba(72, 187, 120, 0.6);
    }
    50% {
        border-color: #68d391;
        box-shadow: 0 0 30px rgba(72, 187, 120, 0.8);
    }
}

/* Полноэкранный режим */
.video-wrapper.fullscreen {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 100px;
    z-index: 150;
    border-radius: 0;
    aspect-ratio: auto;
    min-height: auto;
    cursor: zoom-out;
}

.video-wrapper.fullscreen video {
    object-fit: contain;
}

.video-wrapper.fullscreen:hover {
    transform: none;
}

/* Локальное видео - PiP в правом нижнем углу */
.local-video {
    position: fixed;
    bottom: 120px;
    right: 20px;
    width: 200px;
    height: 150px;
    z-index: 90;
    border-color: #667eea;
    min-height: auto;
    aspect-ratio: auto;
}

.local-video video {
    object-fit: cover;
}

.local-video.speaking {
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6),
                0 4px 15px rgba(0, 0, 0, 0.3);
}

.local-video .video-label {
    background: rgba(102, 126, 234, 0.9);
    font-size: 0.8em;
    padding: 4px 8px;
}

.local-video .video-status {
    font-size: 0.65em;
    padding: 3px 6px;
}

/* Локальное видео в fullscreen */
.local-video.fullscreen {
    width: auto;
    height: auto;
    bottom: 100px;
}

/* Удаленное видео */
.remote-video {
    border-color: rgba(72, 187, 120, 0.3);
}

.remote-video.speaking {
    border-color: #48bb78;
}

.video-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 500;
    backdrop-filter: blur(5px);
}

.video-status {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7em;
    backdrop-filter: blur(5px);
}

/* Fullscreen иконка подсказка */
.video-wrapper::after {
    content: '🔍';
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 1.5em;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.video-wrapper:hover::after {
    opacity: 0.7;
}

.video-wrapper.fullscreen::after {
    content: '✕';
    font-size: 2em;
}

/* Для локального видео - маленькая иконка */
.local-video::after {
    font-size: 1em;
    top: 5px;
    left: 5px;
}

/* Панель управления */
.controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 15px 20px;
    min-width: 90px;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}

.control-btn .icon {
    font-size: 2em;
}

.control-btn .label {
    font-size: 0.9em;
    font-weight: 500;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

.control-btn.active {
    background: rgba(102, 126, 234, 0.6);
    border-color: #667eea;
}

.control-btn.leave {
    background: rgba(220, 38, 38, 0.6);
    border-color: #dc2626;
}

.control-btn.leave:hover {
    background: rgba(220, 38, 38, 0.8);
    transform: translateY(-3px);
}

.control-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(100, 100, 100, 0.3);
}

.control-btn.disabled:hover {
    transform: none;
    background: rgba(100, 100, 100, 0.3);
}

/* Уведомления */
.notifications {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 1.1em;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.success {
    border-left: 4px solid #48bb78;
}

.notification.error {
    border-left: 4px solid #dc2626;
}

.notification.info {
    border-left: 4px solid #667eea;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .welcome-card {
        padding: 30px 20px;
    }
    
    .welcome-card h1 {
        font-size: 2em;
    }
    
    .subtitle {
        font-size: 1em;
    }
    
    .btn {
        font-size: 1.1em;
        padding: 15px 25px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group input,
    .input-group .btn {
        width: 100%;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    /* Шапка комнаты */
    .room-header {
        padding: 12px 10px;
        height: auto;
    }
    
    .room-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .room-label {
        font-size: 1em;
    }
    
    .btn-icon-small {
        padding: 8px 15px;
        font-size: 0.9em;
    }
    
    /* Контейнер видео на мобильных */
    .video-container {
        top: 90px;
        bottom: 80px;
        padding: 5px;
        gap: 10px;
        grid-template-columns: 1fr;
    }
    
    .video-wrapper {
        min-height: 200px;
    }
    
    /* Локальное видео на мобильных */
    .local-video {
        width: 120px;
        height: 90px;
        bottom: 90px;
        right: 10px;
    }
    
    /* Метки видео на мобильных - меньше */
    .video-label {
        font-size: 0.65em;
        padding: 3px 6px;
        bottom: 5px;
        left: 5px;
    }
    
    .video-status {
        font-size: 0.6em;
        padding: 3px 6px;
        top: 5px;
        right: 5px;
    }
    
    /* Панель управления на мобильных */
    .controls {
        gap: 5px;
        padding: 10px 5px;
        height: 80px;
        flex-wrap: wrap;
        justify-content: space-around;
    }
    
    .control-btn {
        flex-direction: column;
        min-width: 60px;
        max-width: 70px;
        padding: 8px 5px;
        gap: 3px;
    }
    
    .control-btn .icon {
        font-size: 1.3em;
    }
    
    .control-btn .label {
        font-size: 0.7em;
    }
    
    /* Скрываем кнопку переключения камеры на мобильных если она не нужна */
    #switch-camera {
        display: flex !important;
    }
    
    /* Уведомления на мобильных */
    .notifications {
        top: 95px;
        right: 10px;
        left: 10px;
    }
    
    .notification {
        font-size: 0.85em;
        padding: 10px 12px;
    }
}

/* Адаптивность для больших экранов */
@media (min-width: 1400px) {
    .video-container {
        grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    }
}

@media (min-width: 1920px) {
    .video-container {
        grid-template-columns: repeat(3, 1fr);
    }
}
