/* EchoChat 样式表 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    height: 100vh;
    overflow: hidden;
}

.screen {
    display: none;
    height: 100vh;
}

.screen.active {
    display: flex;
}

/* 登录/注册页 */
.auth-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
}

.auth-container h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, #00d4ff, #7b2dff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: #666;
    margin-bottom: 2rem;
}

.auth-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.5rem 1.5rem;
    background: transparent;
    border: 1px solid #333;
    border-radius: 6px;
    color: #888;
    cursor: pointer;
    transition: all 0.3s;
}

.tab.active {
    background: #00d4ff;
    border-color: #00d4ff;
    color: #000;
}

.auth-form {
    display: flex;
    flex-direction: column;
    width: 300px;
}

.auth-form input {
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    font-size: 1rem;
}

.btn-primary {
    padding: 0.75rem;
    background: linear-gradient(90deg, #00d4ff, #7b2dff);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.3s;
}

.btn-primary:hover {
    opacity: 0.9;
}

.error-msg {
    color: #ff4444;
    margin-top: 1rem;
    text-align: center;
    min-height: 1.5rem;
}

/* 主聊天界面 */
.app-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 280px;
    background: #111;
    border-right: 1px solid #222;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #222;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    background: linear-gradient(90deg, #00d4ff, #7b2dff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-badge {
    background: #00d4ff;
    color: #000;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
}

.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.users-list h3 {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.users-list ul {
    list-style: none;
}

.users-list li {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #1a1a1a;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.users-list li:hover {
    background: #222;
}

.users-list li.active {
    background: #00d4ff;
    color: #000;
}

/* 聊天主区域 */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
}

.chat-header {
    padding: 1rem;
    background: #111;
    border-bottom: 1px solid #222;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.message {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    word-break: break-word;
}

.message.sent {
    align-self: flex-end;
    background: #00d4ff;
    color: #000;
    border-bottom-right-radius: 4px;
}

.message.received {
    align-self: flex-start;
    background: #1a1a1a;
    border: 1px solid #333;
    border-bottom-left-radius: 4px;
}

.message .meta {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

.message img, .message video {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.message .voice-btn {
    background: none;
    border: 1px solid currentColor;
    color: inherit;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 0.5rem;
}

/* 输入区域 */
.input-area {
    padding: 1rem;
    background: #111;
    border-top: 1px solid #222;
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.tool-btn {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background 0.2s;
}

.tool-btn:hover {
    background: #222;
}

#message-input {
    flex: 1;
    padding: 0.75rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #fff;
    resize: none;
    max-height: 120px;
    font-size: 1rem;
}

.send-btn {
    background: #00d4ff;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1.25rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.send-btn:hover {
    opacity: 0.9;
}

/* 音视频通话 */
.call-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 1000;
}

.call-container {
    position: relative;
    width: 100%;
    height: 100%;
}

#local-video, #remote-video {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#local-video {
    position: absolute;
    bottom: 100px;
    right: 20px;
    width: 150px;
    height: 200px;
    border-radius: 12px;
    border: 2px solid #00d4ff;
    z-index: 10;
}

.call-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    z-index: 10;
}

.call-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.call-btn:hover {
    transform: scale(1.1);
}

.end-call {
    background: #ff4444;
    color: #fff;
}

.call-btn:not(.end-call) {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    backdrop-filter: blur(10px);
}

.call-info {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 1.25rem;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar-header h2,
    .users-list h3,
    .user-badge {
        display: none;
    }
    
    .message {
        max-width: 85%;
    }
}
