/* 头部区域样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* 修复：覆盖全局 header-actions 的 absolute 定位 */
.header .header-actions {
    position: static;
    transform: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 返回按钮样式 - 更柔和的浅蓝色 */
.back-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 18px;
    background-color: #f5f5f5;
    color: #666;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    height: 36px;
    box-sizing: border-box;
}

.back-btn:hover {
    background-color: #e8e8e8;
    color: #333;
    transform: translateY(-1px);
}

/* 收藏按钮样式 - 以返回按钮为模板 */
.favorite-button {
    display: inline-flex;
    align-items: center;
    padding: 6px 18px;
    background-color: #f5f5f5;
    color: #666;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    height: 36px;
    box-sizing: border-box;
    cursor: pointer;
    font-family: inherit;
}

.favorite-button:hover {
    background-color: #e8e8e8;
    color: #333;
    transform: translateY(-1px);
}

.favorite-button.favorited {
    background-color: #fff8e1;
    color: #f9a825;
}

.favorite-button.favorited:hover {
    background-color: #ffecb3;
    color: #f57f17;
}

@media (max-width: 768px) {
    .header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
        margin-top: 15px;
        margin-bottom: 15px;
    }

    .back-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .favorite-button {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* 页面标题 - 居中显示 */
.tool-title {
    font-size: 36px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
    text-align: center;
}

.tool-subtitle {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
    text-align: center;
}

/* 主要内容区 */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* 区块样式 */
.section {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
    margin-bottom: 25px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: #2563eb;
}

/* 编解码区域 */
.codec-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: stretch;
}

.codec-box {
    background: #fafafa;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid #f0f0f0;
}

.codec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f0f0f0;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.codec-header .header-actions {
    display: flex;
    gap: 5px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: #e0e0e0;
    color: #333;
}

.codec-textarea {
    flex: 1;
    min-height: 200px;
    padding: 15px;
    border: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    background: transparent;
}

.codec-textarea:focus {
    background: #fff;
}

.codec-textarea[readonly] {
    background: #f5f5f5;
}

/* 操作按钮 */
.codec-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
}

.btn-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-arrow:hover {
    background-color: #1d4ed8;
    transform: scale(1.05);
}

.btn-arrow.btn-swap {
    background-color: #f5f5f5;
    color: #666;
}

.btn-arrow.btn-swap:hover {
    background-color: #e8e8e8;
    color: #333;
}

/* 文件上传区域 */
.file-codec {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.upload-area {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: #fafafa;
}

.upload-area:hover {
    border-color: #2563eb;
    background: #f0f4ff;
}

.upload-area.dragover {
    border-color: #2563eb;
    background: #e8f0ff;
}

.upload-icon {
    font-size: 48px;
    color: #2563eb;
    margin-bottom: 15px;
}

.upload-text {
    font-size: 16px;
    color: #333;
    margin-bottom: 8px;
    font-weight: 500;
}

.upload-hint {
    font-size: 13px;
    color: #888;
}

.upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* 文件结果 */
.file-result {
    background: #fafafa;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #f0f0f0;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f0f0f0;
    border-bottom: 1px solid #e0e0e0;
}

.file-name {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.file-size {
    font-size: 12px;
    color: #888;
}

.result-actions {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
}

.btn-tool {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-tool:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
}

.btn-tool.btn-secondary {
    background-color: #f5f5f5;
    color: #666;
}

.btn-tool.btn-secondary:hover {
    background-color: #e8e8e8;
    color: #333;
}

/* 使用说明 */
.info-section {
    max-width: 1200px;
    margin: 30px auto 0;
    padding: 25px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
}

.info-section h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-section h3 i {
    color: #2563eb;
}

.info-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-section li {
    padding: 8px 0;
    color: #555;
    font-size: 14px;
    line-height: 1.6;
}

.info-section li strong {
    color: #2563eb;
}

/* Toast提示 */
.toast {
    position: fixed !important;
    bottom: 30px !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    transform: translateX(-50%) translateY(100px) !important;
    padding: 12px 24px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    z-index: 10001 !important;
    opacity: 0 !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    width: auto !important;
    height: auto !important;
    min-width: 120px !important;
    max-width: 300px !important;
    text-align: center !important;
    white-space: nowrap !important;
}

.toast.show {
    transform: translateX(-50%) translateY(0) !important;
    opacity: 1 !important;
}

.toast.success {
    background: #4caf50 !important;
    color: white !important;
}

.toast.error {
    background: #f44336 !important;
    color: white !important;
}

.toast.warning {
    background: #ff9800 !important;
    color: white !important;
}

.toast.info {
    background: #2196f3 !important;
    color: white !important;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .tool-title {
        font-size: 24px;
        width: 100%;
        order: 0;
        margin-bottom: 15px;
    }

    .section {
        padding: 20px;
    }

    .codec-container {
        grid-template-columns: 1fr;
    }

    .codec-actions {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }

    .btn-arrow {
        flex: 1;
        min-width: 100px;
    }

    .codec-textarea {
        min-height: 150px;
    }

    .result-actions {
        flex-direction: column;
    }

    .btn-tool {
        justify-content: center;
    }

    .upload-area {
        padding: 30px 20px;
    }
}
