/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4F46E5;
    --primary-dark: #4338CA;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --bg-color: #F3F4F6;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* 容器 */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* 头部 */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* 卡片 */
.card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.card h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    width: 100%;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.875rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* 分隔符 */
.divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    background: white;
    padding: 0 15px;
    color: var(--text-secondary);
    position: relative;
}

/* 功能介绍 */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.feature-item {
    background: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    display: block;
}

.feature-item h3 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.feature-item p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================================
   会议室页面样式
   ============================================================ */

.meeting-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #1a1a1a;
    color: white;
}

/* 屏幕共享显示区域 */
.screen-share-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.screen-share-container.hidden {
    display: none;
}

.screen-share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #2d2d2d;
    border-bottom: 1px solid #3d3d3d;
    font-size: 1rem;
}

.screen-share-header .close-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen-share-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.screen-share-header .collapse-btn {
    margin-left: auto;
    margin-right: 8px;
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.14);
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
}

.screen-share-header .collapse-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

#screen-share-video {
    flex: 1;
    width: 100%;
    object-fit: contain;
}

/* 屏幕共享旋转按钮（手机端） */
.screen-rotate-btn {
    position: absolute;
    bottom: 100px;
    right: 20px;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.screen-rotate-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 视频旋转样式 - 使用 transform 保持元素在正确位置 */
#screen-share-video {
    transition: transform 0.3s ease;
}

/* 顶部栏 */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px 15px;
    background: #2d2d2d;
    border-bottom: 1px solid #3d3d3d;
    flex-wrap: wrap;
    gap: 10px;
}

.room-info {
    flex: 1;
    min-width: 200px;
}

.room-info h1 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px 0;
    flex-wrap: wrap;
}

.room-info span {
    color: var(--primary-color);
    font-family: monospace;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.room-info .btn-small {
    margin-right: 8px;
    padding: 4px 12px;
    font-size: 0.8rem;
}

.user-count {
    font-size: 0.85rem;
    color: #9ca3af;
    white-space: nowrap;
}

/* 移动端优化 */
@media (max-width: 480px) {
    .top-bar {
        padding: 12px 10px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .room-info {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }
    
    .room-info h1 {
        font-size: 0.9rem;
        margin: 0;
        flex: 1;
        min-width: 0;
    }
    
    .room-info span {
        font-size: 0.85rem;
    }
    
    .room-info .btn-small {
        padding: 3px 10px;
        font-size: 0.75rem;
        margin-right: 6px;
    }
    
    .user-count {
        text-align: right;
        font-size: 0.8rem;
    }
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    padding-bottom: 80px; /* 为固定控制栏留出空间 */
}

/* 内容面板 */
.content-panel {
    display: none;
    flex-direction: column;
    height: 100%;
    padding: 0;
    padding-bottom: 80px; /* 为底部控制栏留出空间 */
    background: #1a1a1a;
    overflow: hidden;
    box-sizing: border-box;
}

.content-panel.active {
    display: flex;
}

.panel-header {
    padding: 12px 20px;
    background: #2d2d2d;
    border-bottom: 1px solid #3d3d3d;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    scroll-behavior: smooth;
    min-height: 0; /* 重要：允许flex子元素收缩 */
}

/* 自定义滚动条 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #5a5a5a;
}

.chat-message {
    max-width: 70%;
    padding: 12px 16px;
    background: #3d3d3d;
    border-radius: 12px;
    margin-bottom: 8px;
}

.chat-message.own {
    margin-left: auto;
    background: var(--primary-color);
}

.chat-message .sender {
    font-size: 0.85rem;
    font-weight: 600;
    color: #9ca3af;
    margin-bottom: 4px;
}

.chat-message.own .sender {
    color: rgba(255, 255, 255, 0.8);
}

.chat-message .text {
    font-size: 0.95rem;
    line-height: 1.5;
    color: white;
    margin-bottom: 4px;
}

.chat-message .time {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: right;
}

/* 系统消息样式 */
.chat-message.system-message {
    background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
    border: 1px solid #667eea40;
    border-radius: 12px;
    padding: 10px 15px;
    margin: 8px 0;
}

.chat-message.system-message .sender {
    color: #667eea;
    font-weight: bold;
    font-size: 0.85rem;
}

.chat-message.system-message .text {
    color: #667eea;
    font-weight: bold;
    font-size: 1rem;
}

.chat-message.system-message .time {
    color: #667eea80;
}

/* 聊天输入框 */
.chat-input {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #2d2d2d;
    background: #1a1a1a;
    flex-shrink: 0;
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
}

.chat-input input {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    border: 1px solid #3d3d3d;
    border-radius: 24px;
    background: #2d2d2d;
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input input:focus {
    border-color: var(--primary-color);
}

.chat-input input::placeholder {
    color: #6b7280;
}

.chat-input button {
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}

.chat-input button:hover {
    background: var(--primary-color-hover);
}

/* 侧边栏 */
.sidebar {
    width: 280px;
    background: #2d2d2d;
    border-left: 1px solid #3d3d3d;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 15px 20px;
    border-bottom: 1px solid #3d3d3d;
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.participant-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    max-height: 400px;
}

.participant-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #3d3d3d;
    border-radius: 8px;
    margin-bottom: 8px;
}

.participant-list-item .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.participant-list-item .info {
    flex: 1;
}

.participant-list-item .name {
    font-weight: 500;
    font-size: 0.9rem;
}

.participant-list-item .status {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* 控制栏 */
.controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    background: #2d2d2d;
    border-top: 1px solid #3d3d3d;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 12px 24px;
    background: #3d3d3d;
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.control-btn:hover {
    background: #4d4d4d;
    transform: translateY(-2px);
}

.control-btn.active {
    background: var(--success-color);
}

.control-btn.danger {
    background: var(--danger-color);
}

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

/* 静音按钮特殊样式 - 静音时显示红色叉 */
.control-btn.muted {
    background: var(--danger-color);
    border: 2px solid #ef4444;
}

.control-btn.muted .control-icon {
    color: white;
}

.control-btn.muted:hover {
    background: #dc2626;
}

.control-icon {
    font-size: 1.5rem;
}

.control-label {
    font-size: 0.75rem;
}

/* Toast 提示 */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 1000;
}

.toast.hidden {
    display: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .meeting-container {
        min-height: 100vh;
        height: auto;
    }
    
    .main-content {
        flex-direction: column;
        overflow: hidden;
        min-height: calc(100vh - 140px);
        height: calc(100vh - 140px);
        position: relative;
    }
    
    .content-panel {
        height: 100%;
        min-height: calc(100vh - 140px);
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
    
    .participant-list {
        max-height: calc(100vh - 320px);
    }
    
    /* 手机端聊天输入框 */
    .chat-input {
        position: fixed;
        bottom: 70px;
        left: 0;
        right: 0;
        z-index: 100;
        padding: 10px 15px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
    
    .chat-messages {
        padding-bottom: 120px;
    }
    
    .controls {
        padding: 15px;
        gap: 10px;
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }
    
    .control-btn {
        padding: 10px 15px;
    }
    
    .control-label {
        display: none;
    }
    
    .participants-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
        max-height: 200px;
    }
    
    /* 手机端屏幕共享样式 */
    .screen-share-container {
        top: 0;
        bottom: calc(82px + env(safe-area-inset-bottom));
        height: auto;
        z-index: 90;
        background: #000;
    }
    
    .screen-share-header {
        padding: 10px 12px;
        font-size: 0.9rem;
        min-height: 42px;
    }
    
    #screen-share-video {
        width: 100%;
        height: calc(100dvh - 124px - env(safe-area-inset-bottom));
        object-fit: contain;
        background: #000;
    }
    
    .screen-rotate-btn {
        bottom: 16px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
        z-index: 91;
    }

    .screen-share-container:not(.hidden) ~ .main-content {
        visibility: hidden;
    }

    .screen-share-container.collapsed {
        left: 12px;
        right: 12px;
        top: 10px;
        bottom: auto;
        width: auto;
        height: 128px;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    }

    .screen-share-container.collapsed .screen-share-header {
        min-height: 34px;
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    .screen-share-container.collapsed #screen-share-video {
        height: 94px;
    }

    .screen-share-container.collapsed .screen-rotate-btn {
        display: none;
    }

    .screen-share-container.collapsed ~ .main-content {
        visibility: visible;
    }
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 管理员控制按钮 */
.admin-control-btn {
    padding: 5px 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
}

.admin-control-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* 超级管理员控制按钮 */
.super-admin-control-btn {
    padding: 5px 10px;
    background: #ff6b35;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-left: 5px;
}

.super-admin-control-btn:hover {
    background: #e55a2b;
    transform: scale(1.05);
}

/* 自定义滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* iOS 点击开始按钮覆盖层 */
.start-audio-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.start-audio-content {
    text-align: center;
    color: white;
    padding: 40px;
}

.start-audio-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

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

.start-audio-content h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.start-audio-content p {
    font-size: 1rem;
    color: #ccc;
    margin-bottom: 30px;
}

.start-audio-content .btn {
    padding: 15px 50px;
    font-size: 1.1rem;
}

/* Firefox 滚动条样式 */
* {
    scrollbar-width: thin;
    scrollbar-color: #555 #2d2d2d;
}
