/* === CONTAINER & LAYOUT === */
.container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* === HEADER WITH LOGO === */
header {
    height: 10vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    width: 70px;
    height: 70px;
    filter: drop-shadow(0 4px 12px rgba(255, 140, 66, 0.3));
    animation: logoFloat 3s ease-in-out infinite;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo-text h1 {
    font-size: 2.2em;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    color: var(--color-text-light);
}

.logo-accent {
    color: var(--color-accent-orange);
}

.logo-text p {
    font-size: 0.75em;
    font-weight: 400;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* === ROOM SELECTION SCREEN === */
#room-selection {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    max-width: 600px;
    margin: 0 auto;
}

#room-selection h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.8em;
    font-weight: 600;
}

/* Room Selection Footer */
.room-footer {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    color: var(--color-text-muted);
    font-size: 0.9em;
}

.footer-tagline {
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--color-text-light);
    opacity: 0.8;
}

.footer-brand {
    margin: 0;
    font-size: 0.85em;
    opacity: 0.6;
    letter-spacing: 0.5px;
}

.section {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid var(--glass-border);
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* === MAIN CONTENT GRID === */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 15px;
    padding: 0 20px;
    min-height: 0;
    height: 70vh;
    overflow: hidden;
}

.videos-layout {
    display: contents;
}

/* === VIDEO CONTAINERS === */
.local-video-container {
    position: relative;
    background: #000;
    border-radius: 10px;
    overflow: visible;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.remote-videos-container {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    grid-auto-rows: auto;
    align-content: start;
    overflow-y: auto;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 10px;
}

video {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    background: #000;
    object-fit: contain; /* Показать всё видео без обрезки */
}

#local-video {
    border: 3px solid var(--color-accent-green);
    box-shadow: 0 0 20px rgba(127, 217, 87, 0.3);
}

.remote-video {
    border: 3px solid var(--color-accent-orange);
    box-shadow: 0 0 15px rgba(255, 140, 66, 0.2);
    width: 100%;
    height: 100%;
    object-fit: contain; /* Показать всё видео без обрезки */
}

.remote-video-container {
    position: relative;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 16/9; /* Будет динамически обновляться через JS */
    width: 100%;
}

/* === BOTTOM PANEL === */
.bottom-panel {
    height: auto;
    min-height: 60px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
    flex-shrink: 0;
    background: rgba(26, 37, 69, 0.7);
    backdrop-filter: blur(15px);
    border-top: 1px solid var(--glass-border);
}

.bottom-panel .controls {
    justify-self: center;
}

/* Compact room info - минималистичный стиль */
.room-info-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
    opacity: 0.9;
    justify-self: start;
}

.info-item {
    cursor: help;
    transition: opacity 0.2s;
}

.info-item:hover {
    opacity: 1;
}

.room-id-hover {
    position: relative;
    cursor: pointer;
}

.room-id-full:empty + .room-id-placeholder {
    display: inline;
}

.room-id-full:not(:empty) {
    display: none;
}

.room-id-full:not(:empty) + .room-id-placeholder {
    display: inline;
}

.room-id-hover:hover .room-id-full:not(:empty) {
    display: inline;
}

.room-id-hover:hover .room-id-full:not(:empty) + .room-id-placeholder {
    display: none;
}

.info-divider {
    opacity: 0.4;
    user-select: none;
}

.user-name-compact {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Global footer at bottom of page */
.global-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.75em;
    opacity: 0.5;
    padding: 8px;
    background: rgba(26, 37, 69, 0.5);
    backdrop-filter: blur(10px);
    z-index: 100;
    transition: opacity 0.3s;
}

.global-footer:hover {
    opacity: 0.8;
}

.global-footer p {
    margin: 0;
}

/* Legacy support */
.room-info {
    text-align: left;
    opacity: 0.8;
    font-size: 0.9em;
}

.room-info p {
    margin: 5px 0;
}

.participants-title {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    text-align: center;
}

.video-container-flex {
    flex: 1;
    position: relative;
}

/* === ADAPTIVE GRID FOR PARTICIPANTS === */

/* Адаптивная сетка в зависимости от количества участников */
.remote-videos-container.participants-1 {
    grid-template-columns: 1fr;
}

.remote-videos-container.participants-2 {
    grid-template-columns: repeat(2, 1fr);
}

.remote-videos-container.participants-3 {
    grid-template-columns: repeat(2, 1fr);
}

.remote-videos-container.participants-4 {
    grid-template-columns: repeat(2, 1fr);
}

.remote-videos-container.participants-5,
.remote-videos-container.participants-6 {
    grid-template-columns: repeat(3, 1fr);
}

.remote-videos-container.participants-7,
.remote-videos-container.participants-8,
.remote-videos-container.participants-9 {
    grid-template-columns: repeat(3, 1fr);
}

.remote-videos-container.participants-10,
.remote-videos-container.participants-11,
.remote-videos-container.participants-12 {
    grid-template-columns: repeat(4, 1fr);
}

/* Для большого количества участников */
.remote-videos-container.many-participants {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

/* Особые случаи для 3 участников - лучше выглядит в 2 столбца */
.remote-videos-container.participants-3 .remote-video-container:nth-child(3) {
    grid-column: 1 / -1;
    max-width: 300px;
    margin: 0 auto;
}
