/* style.css - ПК версия */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0a0a0a;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.page {
    display: none;
    height: 100vh;
    padding-bottom: 50px;
}

.page.active {
    display: block;
}

/* Видео область */
#video-area {
    position: relative;
    width: 100%;
    height: 70vh;
    background: #111;
    overflow: hidden;
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #111;
}

/* Холст для фонов и фильтров — строго поверх своего видео, но ниже превью */
#outputCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    display: none;
    object-fit: cover;
}

/* Видео собеседника всегда на базе */
#remoteVideo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    background: #111;
    display: none;
}

/* Управление видео (обычное состояние) */
.video-controls {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 50;
    background: rgba(20, 20, 20, 0.85);
    padding: 8px 14px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.video-controls button {
    background: rgba(50, 50, 50, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 6px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 38px;
}

.video-controls button:hover {
    background: rgba(70, 70, 70, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
}

#muteBtn {
    background: rgba(40, 167, 69, 0.9);
}

#muteBtn.muted {
    background: rgba(220, 53, 69, 0.9);
}

#endCallBtn {
    background: rgba(220, 53, 69, 0.9) !important;
}

#endCallBtn:hover {
    background: rgba(200, 35, 51, 0.9) !important;
}

/* Чат */
#chat-ui {
    height: 30vh;
    display: flex;
    flex-direction: column;
    padding: 8px 12px 12px 12px;
    background: #0a0a0a;
    min-height: 70px;
    max-height: 40vh;
    overflow-y: auto;
}

#messages {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    background: #1a1a1a;
    border-radius: 6px;
    margin-bottom: 6px;
    max-height: 100px;
    min-height: 25px;
    display: block;
}

#messages div {
    background: #2a2a2a;
    padding: 5px 8px;
    margin-bottom: 3px;
    border-radius: 5px;
    word-break: break-word;
    font-size: 12px;
}

#chat-input-area {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    position: relative !important;
}

.chat-controls {
    display: flex;
    gap: 4px;
}

.chat-input-row {
    display: flex;
    gap: 4px;
}

#chatInput {
    flex: 1;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #333;
    background: #1a1a1a;
    color: #fff;
    font-size: 13px;
    min-height: 32px;
}

#chatInput:focus {
    outline: none;
    border-color: #28a745;
}

/* Панель смайликов */
#chat-ui, #chat-input-area {
    overflow: visible !important;
}

#emoji-panel {
    display: none !important;
    position: fixed !important;
    bottom: 155px !important;
    left: 12px !important;
    width: 320px !important;
    max-height: 130px !important;
    padding: 8px !important;
    gap: 4px !important;
    background: #1a1a1a !important;
    border-radius: 12px !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    box-shadow: 0 -6px 20px rgba(0,0,0,0.95) !important;
    overflow-y: auto !important;
    z-index: 2147483647 !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    box-sizing: border-box !important;
}

#emoji-panel.show {
    display: flex !important;
}

#emoji-panel button {
    font-size: 20px !important;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#emoji-panel button:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

#emojiTrigger {
    background: #333;
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.chat-input-row button {
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

/* Студия */
#studio-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 20px;
    box-sizing: border-box;
}

#roomList {
    width: 100%;
    max-width: 600px;
    max-height: 60vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#roomList h3 {
    color: #888;
    margin-bottom: 15px;
    font-weight: normal;
    font-size: 16px;
}

#roomList button {
    display: block;
    width: 100%;
    padding: 14px;
    margin-bottom: 8px;
    background: #1a1a1a;
    color: #fff;
    border: 1px solid #333;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

#roomList button:hover {
    background: #2a2a2a;
    border-color: #28a745;
}

.studio-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: 20px;
    background: #0a0a0a;
    padding: 20px 0;
}

.studio-controls .subtitle {
    margin-top: 20px;
    color: #888;
    font-size: 14px;
}

#createRoomBtn {
    background: #28a745;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
}

#inviteBtn {
    background: #007bff;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 20px;
    margin-left: 10px;
}

/* Статус комнаты */
#room-status-container {
    display: none;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    padding: 4px 12px;
    border-radius: 20px;
    z-index: 50;
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
}

#room-status-container span {
    margin: 0 4px;
}

/* Навигация */
nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    background: #222;
    padding: 6px 0;
    z-index: 1000;
    border-top: 1px solid #444;
}

nav button {
    flex: 1;
    background: transparent;
    color: #fff;
    border: none;
    padding: 6px;
    font-size: 13px;
    cursor: pointer;
}

/* Аудио-полоска */
#audio-meter-container {
    display: block !important;
    width: 100% !important;
    height: 6px !important;
    min-height: 6px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    margin-bottom: 8px !important;
}

#audio-meter-bar {
    display: block !important;
    height: 100% !important;
    width: 0% !important;
    background: linear-gradient(90deg, #28a745, #ffc107, #dc3545) !important;
    border-radius: 4px !important;
    transition: width 0.05s ease-out !important;
}

/* ==========================================
   МАКЕТ ЗВОНКА ПК 
   ========================================== */
#main-layout.view-call #chat-ui {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 140px !important; /* Высокая панель, закрывающая просвет */
    background: #0a0a0a !important;
    z-index: 100 !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

#main-layout.view-call .video-controls {
    position: fixed !important;
    bottom: 118px !important; /* Кнопки точно поверх верхней границы панели */
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 2147483647 !important; /* Максимальный z-index */
    padding: 8px 16px !important;
    gap: 8px !important;
    background: rgba(20, 20, 20, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 30px !important;
    display: flex !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5) !important;
}

#main-layout.view-call #video {
    position: fixed !important;
    top: 50px !important;
    right: 15px !important;
    bottom: auto !important;
    width: 160px !important;
    height: 200px !important;
    z-index: 100 !important;
    border-radius: 10px !important;
    border: 2px solid rgba(255,255,255,0.3) !important;
    object-fit: cover !important;
}

/* Модальное окно настроек */
#settingsDropdown {
    display: none;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 380px !important;
    max-width: 90vw !important;
    max-height: 85vh !important;
    background: #18181b !important;
    color: #f4f4f5 !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 16px !important;
    padding: 20px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9) !important;
    z-index: 2147483647 !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
}

#settingsDropdown.show, 
#settingsDropdown[style*="display: block"] {
    display: block !important;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: 16px;
    font-weight: bold;
}

#closeSettingsX {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
}

.setting-group {
    margin-bottom: 12px;
}

#settingsDropdown label {
    font-size: 13px !important;
    color: #a1a1aa !important;
    display: block !important;
    margin-bottom: 4px !important;
    margin-top: 8px !important;
}

#settingsDropdown select, 
#settingsDropdown input[type="text"] {
    width: 100% !important;
    background: #27272a !important;
    color: #fff !important;
    border: 1px solid #3f3f46 !important;
    padding: 10px 12px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
    margin-top: 6px !important;
    margin-bottom: 12px !important;
}

.settings-divider {
    border: none;
    border-top: 1px solid #444;
    margin: 14px 0;
}

.upload-img-btn, 
#closeSettingsBtn {
    width: 100% !important;
    padding: 10px !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
}

.upload-img-btn {
    background: #3f3f46 !important;
    color: #fff !important;
}

#closeSettingsBtn {
    background: #dc3545 !important;
    color: #fff !important;
    margin-top: 10px !important;
}

#video, #localVideo, #outputCanvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- ОТОБРАЖЕНИЕ ЧАТА НА ГЛАВНОЙ СТРАНИЦЕ (до входа в комнату) --- */
#main-layout.view-default #chat-ui {
    display: flex !important;
    height: 140px !important;
    background: #0a0a0a !important;
    position: relative !important;
    z-index: 10 !important;
}

#main-layout.view-default #chat-input-area {
    display: flex !important;
}