/* 本地字体设置 */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300;
    src: local('Inter Light'), local('Inter-Light');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    src: local('Inter Regular'), local('Inter-Regular');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    src: local('Inter Medium'), local('Inter-Medium');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    src: local('Inter SemiBold'), local('Inter-SemiBold');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    src: local('Inter Bold'), local('Inter-Bold');
}

:root {
    --primary-color: #4361ee;
    --primary-light: #4895ef;
    --secondary-color: #3f37c9;
    --success-color: #4cc9f0;
    --error-color: #f72585;
    --info-color: #4895ef;
    --text-color: #333;
    --text-light: #666;
    --background-light: #f8f9fa;
    --border-color: #e9ecef;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: var(--card-shadow);
}

/* 移动端导航栏 */
.mobile-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mobile-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

/* 主内容区域 */
.main-content {
    padding: 24px;
}

h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 20px 0;
}

h3 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-color);
    margin: 0 0 15px 0;
}

/* 模式选择器 - 采用底部标签栏样式 */
.mode-selector {
    display: flex;
    background: white;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 70px;
    z-index: 900;
}

.mode-btn {
    flex: 1;
    padding: 16px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 3px solid transparent;
}

.mode-btn:hover {
    background-color: var(--background-light);
}

.mode-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.form-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.form-section.active {
    display: block;
}

/* 表单元素 */
.input-group {
    margin: 20px 0;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
}

input, textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    background-color: var(--background-light);
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

/* 文件输入框美化 */
.file-input-wrapper {
    position: relative;
    margin: 20px 0;
}

.file-input-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
}

.custom-file-input {
    position: relative;
    display: inline-block;
    width: 100%;
}

.custom-file-input input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.custom-file-input .file-input-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    background-color: var(--background-light);
    transition: var(--transition);
    text-align: center;
    z-index: 1;
}

.custom-file-input:hover .file-input-content {
    border-color: var(--primary-color);
    background-color: rgba(67, 97, 238, 0.05);
}

.custom-file-input.active .file-input-content {
    border-color: var(--success-color);
    background-color: rgba(76, 201, 240, 0.1);
}

.file-input-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.file-input-text {
    flex: 1;
}

.file-input-text h4 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
}

.file-input-text p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-light);
}

.file-input-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.file-input-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

/* 已选择文件列表 */
.selected-files {
    margin-top: 16px;
}

.selected-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    background-color: white;
    transition: var(--transition);
}

.selected-file-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.1);
}

.file-info {
    flex: 1;
    overflow: hidden;
}

.file-name {
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.8rem;
    color: var(--text-light);
}

.remove-file-btn {
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    margin-left: 12px;
}

.remove-file-btn:hover {
    background: #e61e76;
    transform: translateY(-1px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .custom-file-input .file-input-content {
        flex-direction: column;
        gap: 12px;
        padding: 24px 16px;
    }
    
    .file-input-text {
        text-align: center;
    }
    
    .file-input-btn {
        width: 100%;
        padding: 10px;
    }
    
    .selected-file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .remove-file-btn {
        align-self: flex-end;
        margin-left: 0;
    }
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* 按钮样式 */
.btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 16px 0;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.2);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.35);
}

.btn:hover::before {
    left: 100%;
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(67, 97, 238, 0.2);
}

/* 下载按钮特殊样式 */
.btn.download {
    background: linear-gradient(135deg, var(--success-color), var(--info-color));
    box-shadow: 0 4px 12px rgba(76, 201, 240, 0.2);
}

.btn.download:hover {
    box-shadow: 0 8px 20px rgba(76, 201, 240, 0.35);
}

/* 结果提示 */
.result {
    margin: 16px 0;
    padding: 16px;
    border-radius: 8px;
    animation: fadeIn 0.3s ease-in-out;
}

.success {
    background-color: rgba(76, 201, 240, 0.1);
    border: 2px solid #4cc9f0;
    color: #4cc9f0;
}

.error {
    background-color: rgba(247, 37, 133, 0.1);
    border: 2px solid #f72585;
    color: #f72585;
}

.info {
    background-color: rgba(72, 149, 239, 0.1);
    border: 2px solid #4895ef;
    color: #4895ef;
}

/* 验证码样式 */
.result strong {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: 0 2px 4px rgba(67, 97, 238, 0.3);
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.1), rgba(72, 149, 239, 0.1));
    border-radius: 8px;
    margin: 8px 0;
    border: 2px solid var(--primary-color);
    cursor: pointer;
}

/* 文件列表 */
.file-item {
    padding: 16px;
    border: 2px solid var(--border-color);
    margin: 10px 0;
    border-radius: 8px;
    transition: var(--transition);
    background-color: var(--background-light);
}

.file-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.1);
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 24px;
    background-color: var(--background-light);
    border-radius: 12px;
    overflow: hidden;
    margin: 12px 0;
    border: 2px solid var(--border-color);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    transition: width 0.3s ease;
    border-radius: 10px;
}

/* 复制按钮 */
.copy-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    background: linear-gradient(135deg, var(--success-color), var(--info-color));
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    position: absolute;
    top: 12px;
    right: 12px;
}

.copy-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 201, 240, 0.3);
}

.copy-btn:active {
    transform: scale(0.95);
}

/* 辅助文本 */
.helper-text {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 消息样式 */
.message-item {
    margin-bottom: 15px;
    padding: 16px;
    border-radius: 12px;
    background-color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    transition: var(--transition);
}

.message-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.message-time {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 10px;
    font-weight: 400;
}

.message-content {
    line-height: 1.6;
    color: var(--text-color);
    word-wrap: break-word;
    cursor: pointer;
    transition: var(--transition);
    padding: 4px 8px;
    border-radius: 4px;
}

.message-content:hover {
    background-color: rgba(67, 97, 238, 0.05);
}

/* 复制成功提示 */
.copy-success {
    position: absolute;
    top: -30px;
    right: 10px;
    background: var(--success-color);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    z-index: 1000;
    animation: fadeIn 0.3s ease-in-out;
    box-shadow: 0 2px 8px rgba(76, 201, 240, 0.3);
}

/* 文件下载按钮 */
.file-item .btn {
    margin: 12px 0 0 0;
    padding: 10px 20px;
    font-size: 0.9rem;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    background-color: var(--background-light);
    border-radius: 8px;
    border: 2px dashed var(--border-color);
    margin: 20px 0;
}

/* 状态指示器 */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-success {
    background-color: rgba(76, 201, 240, 0.1);
    color: var(--success-color);
}

.status-pending {
    background-color: rgba(255, 165, 0, 0.1);
    color: #ffa500;
}

/* 文本消息区域 */
#textMessages {
    border: 2px solid var(--border-color);
    padding: 16px;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    background-color: var(--background-light);
    border-radius: 8px;
    margin: 16px 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .mobile-header {
        padding: 16px;
    }
    
    .mobile-header h1 {
        font-size: 1.3rem;
    }
    
    .mode-btn {
        padding: 14px 16px;
        font-size: 0.85rem;
    }
    
    .btn {
        padding: 14px 16px;
    }
    
    .file-item {
        padding: 14px;
    }
    
    #textMessages {
        padding: 14px;
        min-height: 180px;
    }
    
    .result strong {
        font-size: 1.8rem;
        padding: 6px 12px;
    }
}

/* 平板和桌面端适配 */
@media (min-width: 769px) {
    .container {
        margin: 20px auto;
        border-radius: 16px;
        min-height: calc(100vh - 40px);
    }
    
    .mobile-header {
        border-radius: 16px 16px 0 0;
    }
    
    .mode-selector {
        border-radius: 0;
    }
    
    .main-content {
        max-width: 600px;
        margin: 0 auto;
    }
}