* {
    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%);
    min-height: 100vh;
    padding: 20px;
}

/* 登录模态框 */
.login-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.login-modal.active {
    display: flex;
}

.login-box {
    background: white;
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 400px;
    width: 100%;
    animation: scaleIn 0.4s ease;
}

.login-box h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #333;
}

.login-box p {
    color: #666;
    margin-bottom: 25px;
    font-size: 1rem;
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
}

.login-tip {
    font-size: 0.8rem;
    color: #ccc;
    margin-top: 15px;
}

.logout-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* 头部 */
.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    animation: slideDown 0.6s ease-out;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主容器 */
.main {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 1024px) {
    .main {
        grid-template-columns: 1fr;
    }

    .file-container {
        order: 2;
    }
}

/* 聊天容器 */
.chat-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 600px;
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}

.empty-state p:first-child {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* 聊天消息气泡 */
.chat-message {
    display: flex;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease;
}

.chat-message.own {
    justify-content: flex-end;
}

.chat-message.own .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.chat-message.other .message-bubble {
    background: #e0e0e0;
    color: #333;
    border-radius: 18px 18px 18px 4px;
}

.message-bubble {
    max-width: 85%;
    padding: 10px 14px;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* 文件消息气泡 */
.file-message-bubble {
    max-width: 85%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
    background: #f0f0f0;
    color: #333;
}

.chat-message.own .file-message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.file-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    margin-bottom: 2px;
    word-break: break-all;
    max-width: 200px;
}

.file-size {
    font-size: 0.8rem;
    opacity: 0.7;
}

.file-download-btn {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-download-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.chat-message.other .file-download-btn {
    background: rgba(0, 0, 0, 0.1);
}

.chat-message.other .file-download-btn:hover {
    background: rgba(0, 0, 0, 0.2);
}

.message-info {
    font-size: 0.75rem;
    color: #999;
    margin-top: 4px;
    padding: 0 10px;
}

.chat-message.own .message-info {
    text-align: right;
}

/* 聊天输入区域 */
.chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.nickname-section {
    margin-bottom: 10px;
}

.nickname-section label {
    display: inline-block;
    font-weight: 600;
    color: #666;
    margin-right: 10px;
    font-size: 0.9rem;
}

.nickname-section input {
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    width: 150px;
}

.message-input-section {
    display: flex;
    gap: 10px;
}

.message-input-section textarea {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
}

.message-input-section .btn {
    align-self: flex-end;
    white-space: nowrap;
}

/* 文件容器 */
.file-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.6s ease-out;
}

.file-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 2px solid #f0f0f0;
}

.file-header h2 {
    font-size: 1.1rem;
    color: #333;
}

.upload-section {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.upload-area {
    border: 2px dashed #667eea;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #f8f9ff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f5f7ff;
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.upload-area p {
    color: #666;
    margin: 5px 0;
    font-size: 0.9rem;
}

.upload-area .btn {
    margin-top: 8px;
}

/* 文件列表 */
.files-list-section {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
}

.files-list-section h3 {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 10px;
    font-weight: 600;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    padding: 10px;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 0.85rem;
}

.file-item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    word-break: break-all;
}

.file-item-meta {
    color: #999;
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.file-item-actions {
    display: flex;
    gap: 6px;
}

.file-item-actions .btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.75rem;
}

/* 标签头 */
.tab-header, .list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.list-header {
    justify-content: space-between;
}

.list-header h2 {
    font-size: 1.3rem;
    color: #333;
}

.tab-header {
    padding: 0;
    gap: 0;
}

.tab-btn, .list-tab {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: #f5f5f5;
    color: #666;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover, .list-tab:hover {
    background: #efefef;
    color: #333;
}

.tab-btn.active, .list-tab.active {
    background: white;
    color: #667eea;
    border-bottom-color: #667eea;
}

/* 表单 */
.tab-content {
    display: none;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

.list-content {
    display: none;
    padding: 20px;
}

.list-content.active {
    display: block;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* 上传区域 */
.upload-area {
    border: 2px dashed #667eea;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: #f8f9ff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f5f7ff;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.upload-area p {
    color: #666;
    margin: 5px 0;
}

.upload-area .or {
    font-weight: 600;
    color: #999;
    margin: 15px 0;
}

/* 进度条 */
.upload-progress {
    margin: 15px 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

#progressText {
    text-align: center;
    color: #666;
    margin-top: 10px;
    font-size: 0.9rem;
}

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 提示 */
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

/* 复制部分 */
.copy-section {
    margin: 15px 0;
}

.copy-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.copy-input {
    display: flex;
    gap: 8px;
}

.copy-input input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #666;
}

.copy-input .btn {
    min-width: 80px;
}

/* 列表 */
.list {
    max-height: 400px;
    overflow-y: auto;
}

.list-item {
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.list-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.list-item-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    word-break: break-all;
}

.list-item-meta {
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 8px;
}

.list-item-actions {
    display: flex;
    gap: 8px;
}

.list-item-actions button {
    flex: 1;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.btn-download {
    background: #4caf50;
    color: white;
}

.btn-download:hover {
    background: #45a049;
}

.btn-delete {
    background: #f44336;
    color: white;
}

.btn-delete:hover {
    background: #da190b;
}

.btn-copy {
    background: #2196f3;
    color: white;
}

.btn-copy:hover {
    background: #0b7dda;
}

.message-item {
    padding: 10px 12px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 8px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.85rem;
}

.message-nickname {
    font-weight: 600;
    color: #667eea;
}

.message-time {
    color: #999;
}

.message-text {
    color: #333;
    word-wrap: break-word;
}

.empty {
    text-align: center;
    color: #999;
    padding: 20px 0;
}

/* 标签页 */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #f0f0f0;
    padding: 0 20px;
}

/* 底部 */
.footer {
    text-align: center;
    color: white;
    padding: 20px;
}

.footer p {
    margin: 5px 0;
    font-size: 0.95rem;
}

.footer-note {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* 动画 */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 滚动条美化 */
.list::-webkit-scrollbar {
    width: 6px;
}

.list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.list::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* 额外动画 */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
