* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

.chat-container {
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
}

/* 顶部控制区 */
.room-section {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.section-header {
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mode-selector-container {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.connection-mode {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 25px;
    padding: 4px;
}

.mode-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.mode-btn.active {
    background: #667eea;
    color: white;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

/* 公网房间控制区域 */
.internet-room-controls {
    display: flex;
    align-items: center;
}

.room-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    padding: 3px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
}

.room-input-group:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.room-input {
    border: none;
    outline: none;
    background: transparent;
    padding: 6px 10px;
    font-size: 13px;
    color: #334155;
    width: 80px;
    font-weight: 500;
}

.room-input::placeholder {
    color: #94a3b8;
}

.btn-join, .btn-leave {
    padding: 6px 12px;
    border: none;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-join {
    background: #667eea;
    color: white;
}

.btn-join:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.btn-join:active {
    transform: translateY(0);
}

.btn-leave {
    background: #f87171;
    color: white;
}

.btn-leave:hover {
    background: #ef4444;
    transform: translateY(-1px);
}

.btn-leave:active {
    transform: translateY(0);
}

/* 局域网状态区域 */
.lan-status {
    display: flex;
    align-items: center;
}

.auto-status {
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    font-style: italic;
    background: rgba(100, 116, 139, 0.1);
    padding: 6px 12px;
    border-radius: 12px;
    border-left: 3px solid #64748b;
}

.server-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.server-input {
    width: 200px;
    padding: 10px 16px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.server-input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.btn-connect {
    padding: 10px 20px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-connect:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.connection-status {
    display: flex;
    align-items: center;
    font-size: 13px;
    padding: 6px 8px 6px 16px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 30px;
    backdrop-filter: blur(15px);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.04);
    min-width: fit-content;
}

.connection-status:hover {
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.06);
}

.status-content {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
}

/* 房间信息部分 - 灰色显示 */
.status-room-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 400;
    padding-right: 16px;
    margin-right: 16px;
    border-right: 1px solid rgba(148, 163, 184, 0.2);
    position: relative;
}

.room-name {
    color: #64748b;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.room-separator {
    opacity: 0.3;
    font-size: 16px;
    line-height: 1;
}

.room-users {
    color: #94a3b8;
    font-feature-settings: 'tnum';
}

/* 连接状态指示器 */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 12px 5px 10px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.status-connected .status-indicator {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.status-disconnected .status-indicator {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.status-error .status-indicator {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.status-indicator .status-text {
    font-weight: 500;
    color: #334155;
    font-size: 13px;
    letter-spacing: -0.01em;
}

.status-connected .status-indicator .status-text {
    color: #059669;
}

.status-error .status-indicator .status-text {
    color: #dc2626;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* 连接状态的绿点 */
.status-connected .status-dot {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2),
                0 0 12px rgba(16, 185, 129, 0.4);
}

/* 连接状态的绿点呼吸动画 */
.status-connected .status-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #10b981;
    transform: translate(-50%, -50%);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* 错误状态的红点 */
.status-error .status-dot {
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2),
                0 0 12px rgba(239, 68, 68, 0.4);
}

/* 脉冲动画 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2);
    }
}

/* 房间控制 */
.auto-connect-info,
.manual-connect-info {
    padding: 0 24px 16px;
}

.auto-status {
    font-size: 13px;
    color: #64748b;
}

.room-controls {
    display: flex;
    gap: 12px;
}

.room-controls input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.room-controls input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}


/* 用户列表 */
.user-list-container {
    padding: 0 24px 16px;
}

.user-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    font-size: 13px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.user-item.user-self {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border-color: rgba(102, 126, 234, 0.3);
}


.user-avatar-small {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.user-name {
    font-weight: 500;
}

/* 用户状态点 */
.user-item .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    flex-shrink: 0;
}

.user-item .status-dot.connected {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.user-item .status-dot.pending {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: transparent;
    min-height: 0;
}

/* 消息样式 */
.message-wrapper {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.message-wrapper.own {
    align-items: flex-end;
}

.message-wrapper.other {
    align-items: flex-start;
}

/* 消息头部（头像 + 名字 + 时间） */
.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    padding: 0 4px;
}

.message-wrapper.own .message-header {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-header-text {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.message-wrapper.own .message-header-text {
    flex-direction: row-reverse;
}

.message-name {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
    opacity: 0.8;
}

/* 消息气泡 */
.message {
    max-width: 65%;
    border-radius: 18px;
    position: relative;
    backdrop-filter: blur(10px);
    animation: messageSlideIn 0.3s ease;
    padding: 12px 16px;
}

.message-own {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.message-other {
    background: rgba(255, 255, 255, 0.95);
    color: #1f2937;
    border-bottom-left-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.message-system {
    text-align: center;
    color: #64748b;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.6);
    max-width: 100%;
    padding: 8px 16px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    margin: 8px auto;
}

.message-text {
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
    margin: 0;
}

/* 输入区域 */
.chat-input {
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.input-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.input-group input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 25px;
    font-size: 15px;
    outline: none;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.input-group input:focus {
    background: white;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* 按钮 */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    color: #374151;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: white;
    transform: translateY(-1px);
}

.btn-attach {
    padding: 14px 20px;
    border: none;
    border-radius: 25px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
    color: #374151;
    border: 2px solid rgba(0, 0, 0, 0.1);
    margin-right: 10px;
}

.btn-attach:hover {
    background: white;
    transform: translateY(-1px);
}

.btn-attach:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
    opacity: 0.5;
}

/* 现代化文件进度卡片 */
.file-progress-card {
    min-width: 280px;
    max-width: 320px;
}

.file-progress-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.file-progress-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.file-progress-info {
    flex: 1;
    overflow: hidden;
}

.file-progress-name {
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}

.message-own .file-progress-name {
    color: rgba(255, 255, 255, 0.95);
}

.message-other .file-progress-name {
    color: #374151;
}

.file-progress-details {
    display: flex;
    gap: 8px;
    font-size: 12px;
}

.message-own .file-progress-details {
    color: rgba(255, 255, 255, 0.75);
}

.message-other .file-progress-details {
    color: #6b7280;
}

.file-progress-cancel {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    color: currentColor;
    opacity: 0.7;
}

.file-progress-cancel:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.file-progress-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.progress-label {
    font-weight: 500;
}

.message-own .progress-label {
    color: rgba(255, 255, 255, 0.85);
}

.message-other .progress-label {
    color: #64748b;
}

.progress-percent {
    font-weight: 600;
}

.message-own .progress-percent {
    color: rgba(255, 255, 255, 0.95);
}

.message-other .progress-percent {
    color: #374151;
}

.file-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.message-own .file-progress-bar {
    background: rgba(255, 255, 255, 0.2);
}

.file-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* 文件记录样式 */
.file-record {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.file-record-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.file-record-info {
    flex: 1;
}

.file-record-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.message-own .file-record-name {
    color: rgba(255, 255, 255, 0.95);
}

.message-other .file-record-name {
    color: #374151;
}

.file-record-details {
    display: flex;
    gap: 8px;
    font-size: 12px;
}

.message-own .file-record-details {
    color: rgba(255, 255, 255, 0.75);
}

.message-other .file-record-details {
    color: #6b7280;
}

.file-status {
    font-weight: 500;
}

.transfer-speed {
    font-weight: 500;
    color: #10b981;
}

/* 拖放效果现在通过JavaScript动态创建 */

/* 滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* 动画 */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 通知弹幕 */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    color: #374151;
    z-index: 1000;
    max-width: 300px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    opacity: 0;
    transition: all 0.3s ease;
}

/* 显示状态 */
.notification-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 退出动画 - 向上消失 */
.notification-exit {
    opacity: 0;
    transform: translateX(-50%) translateY(-50px);
    transition: all 0.5s ease;
}

/* 响应式 */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
        align-items: stretch;
    }
    
    .connection-status {
        width: 100%;
        justify-content: center;
    }
    
    .status-content {
        flex-wrap: wrap;
        gap: 12px;
        justify-content: center;
    }
    
    .status-room-info {
        padding-right: 0;
        margin-right: 0;
        border-right: none;
        padding-bottom: 8px;
        border-bottom: 1px solid rgba(148, 163, 184, 0.2);
        width: 100%;
        justify-content: center;
    }
    
    .room-info,
    .user-list-container,
    .auto-connect-info,
    .manual-connect-info {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .chat-messages {
        padding: 16px;
    }
    
    .message {
        max-width: 85%;
    }
    
    .chat-input {
        padding: 16px;
    }
    
    .notification {
        font-size: 13px;
        padding: 10px 16px;
        max-width: 90%;
    }
    
    /* 响应式优化 */
    .mode-selector-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .room-input {
        width: 70px;
        font-size: 12px;
        padding: 5px 8px;
    }
    
    .btn-join, .btn-leave {
        padding: 5px 10px;
        font-size: 11px;
    }
    
    .auto-status {
        font-size: 13px;
        padding: 4px 8px;
    }
}