/* meeting.css - TacMeeting Google Meet Style */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #202124;
    color: #e8eaed;
    user-select: none;
}

/* ===== LAYOUT CONTAINER ===== */
.meeting-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ===== HEADER ===== */
.meeting-header {
    background-color: #202124;
    padding: 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3c4043;
    min-height: 48px;
    flex-shrink: 0;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 15px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-copy-link {
    padding: 5px 12px;
    background: #8ab4f8;
    color: #202124;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}
.btn-copy-link:hover { background: #aecbfa; }

.header-badge {
    padding: 3px 8px;
    background: #3c4043;
    border-radius: 4px;
    font-size: 12px;
    color: #9aa0a6;
}

/* ===== MAIN AREA ===== */
.meeting-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

/* ===== VIDEO AREA ===== */
.video-area {
    flex: 1;
    display: flex;
    padding: 8px;
    gap: 8px;
    background-color: #202124;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

/* === Grid Mode === */
.video-area.grid-mode {
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    align-items: center;
}

.video-area.grid-mode .video-container {
    flex: 1 1 calc(50% - 12px);
    max-width: calc(50% - 8px);
    min-width: 250px;
    aspect-ratio: 16 / 9;
}

/* 1 người → full width */
.video-area.grid-mode .video-container:only-child {
    max-width: 100%;
    flex: 1 1 100%;
    max-height: 100%;
}

/* === Spotlight Mode === */
.video-area.spotlight-mode {
    flex-wrap: nowrap;
    flex-direction: row;
    align-items: stretch;
}

/* Unpinned: cột bên phải */
.video-area.spotlight-mode .video-container {
    flex: 0 0 200px;
    width: 200px;
    min-width: 200px;
    aspect-ratio: 16 / 9;
    order: 2;
    align-self: flex-start;
}

/* Pinned: phóng to chiếm hết */
.video-area.spotlight-mode .video-container.pinned,
.video-area.spotlight-mode .video-container.screen-share {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: none;
    aspect-ratio: auto;
    order: 0;
    align-self: stretch;
}

/* ===== VIDEO CONTAINER ===== */
.video-container {
    position: relative;
    background-color: #3c4043;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container:hover .pin-btn {
    opacity: 1;
}

/* Video: dùng absolute để fill container (container size do aspect-ratio + flex tạo ra) */
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Screen share / pinned: không cắt nội dung */
.video-container.screen-share video,
.video-container.pinned video {
    object-fit: contain;
    background: #000;
}

/* Cam off: ẩn video, hiện avatar */
.video-container.cam-off video {
    display: none;
}

/* ===== AVATAR (khi tắt camera) ===== */
.avatar-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 600;
    color: #fff;
    z-index: 1;
    /* Avatar nằm giữa container bằng flex (container đã có align-items:center) */
}

.video-container.cam-off .avatar-circle {
    display: flex;
}

/* ===== VIDEO LABEL ===== */
.video-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    z-index: 2;
}

.label-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.label-badge {
    font-size: 11px;
    padding: 1px 5px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}

.mic-status {
    width: 16px;
    height: 16px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    background: #d93025;
    border-radius: 50%;
    flex-shrink: 0;
}

.mic-status.muted {
    display: flex;
}

.hand-icon {
    display: none;
    font-size: 16px;
    flex-shrink: 0;
    animation: handBounce 0.5s ease-in-out infinite alternate;
}

.hand-icon.raised {
    display: inline;
}

@keyframes handBounce {
    from { transform: translateY(0); }
    to { transform: translateY(-3px); }
}

/* ===== PIN BUTTON ===== */
.pin-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    border-radius: 4px;
    border: none;
    background: rgba(0,0,0,0.6);
    color: white;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 12px;
    z-index: 5;
}

.pin-btn:hover { background: rgba(0,0,0,0.8); }

.video-container.pinned .pin-btn {
    opacity: 1;
    background: #8ab4f8;
    color: #202124;
}

/* ===== PiP Camera (khi share screen) ===== */
.pip-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 200px;
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 100;
    display: none;
    background: #3c4043;
    border: 2px solid #8ab4f8;
}

.pip-container.active {
    display: block;
}

.pip-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== SIDEBAR (Chat + People) ===== */
.sidebar {
    width: 320px;
    background-color: #202124;
    border-left: 1px solid #3c4043;
    display: none;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar.active {
    display: flex;
}

.sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid #3c4043;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-close {
    background: none;
    border: none;
    color: #9aa0a6;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Chat panel */
.chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.chat-message {
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.4;
}

.chat-message strong {
    color: #8ab4f8;
}

.chat-input {
    padding: 10px;
    border-top: 1px solid #3c4043;
    display: flex;
    gap: 6px;
}

.chat-input input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #3c4043;
    border-radius: 20px;
    background-color: #303134;
    color: #e8eaed;
    outline: none;
    font-size: 13px;
}

.chat-input input:focus {
    border-color: #8ab4f8;
}

.chat-input button {
    padding: 8px 16px;
    border: none;
    background-color: #8ab4f8;
    color: #202124;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
}

/* People panel */
.participant-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #303134;
}

.participant-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.participant-info {
    flex: 1;
    min-width: 0;
}

.participant-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.participant-role {
    font-size: 11px;
    color: #9aa0a6;
}

.participant-status {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 12px;
    color: #9aa0a6;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34a853;
}

.status-dot.mic-off {
    background: #d93025;
}

.status-dot.cam-off {
    background: #fbbc04;
}

/* ===== FOOTER ===== */
.meeting-footer {
    background-color: #202124;
    height: 64px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #3c4043;
    flex-shrink: 0;
    z-index: 10;
}

.control-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background-color: #3c4043;
    color: #e8eaed;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s;
}

.control-btn:hover {
    background-color: #4a4d51;
}

.control-btn.active {
    background-color: #8ab4f8;
    color: #202124;
}

.control-btn.danger {
    background-color: #d93025;
    color: #fff;
}

.control-btn.danger:hover {
    background-color: #ea4335;
}

.control-btn.muted-state {
    background-color: #d93025;
    color: #fff;
}

.footer-separator {
    width: 1px;
    height: 24px;
    background: #3c4043;
}

/* ===== LOBBY ===== */
.lobby-wait {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #9aa0a6;
}

.lobby-wait h2 {
    color: #e8eaed;
    margin-bottom: 8px;
}

/* ===== FORM (Login / Join) ===== */
.form-container {
    max-width: 420px;
    margin: 80px auto;
    background-color: #303134;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #9aa0a6;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid #3c4043;
    background-color: #202124;
    color: #e8eaed;
    box-sizing: border-box;
    font-size: 14px;
    outline: none;
}

.form-control:focus {
    border-color: #8ab4f8;
}

.btn-primary {
    width: 100%;
    padding: 10px;
    background-color: #8ab4f8;
    color: #202124;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
}

.btn-primary:hover {
    background-color: #aecbfa;
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.toast {
    background: #303134;
    color: #e8eaed;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

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

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
