/**
 * 创建工具弹窗样式
 * 符合代码规范：<400行
 * 使用独立前缀 app-tool-create-，确保面板独立性
 */

/* 创建工具弹窗 */
#appToolCreateModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    opacity: 0;
    transition: background-color 0.3s ease, backdrop-filter 0.3s ease, opacity 0.3s ease;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
}

#appToolCreateModal.show {
    display: flex;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 1;
}

.app-tool-create-modal {
    max-width: 700px;
    max-height: 90vh;
    width: 90%;
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-primary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

#appToolCreateModal.show .app-tool-create-modal {
    transform: scale(1);
    opacity: 1;
}

/* 弹窗头部 */
.app-tool-create-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.app-tool-create-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
}

.app-tool-create-close {
    position: absolute;
    top: 18px;
    right: 20px;
    color: var(--text-primary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.app-tool-create-close:hover {
    background: var(--bg-hover);
    color: var(--text-accent);
}

/* 弹窗内容 */
.app-tool-create-content {
    flex: 1;
    padding: 18px 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

.app-tool-create-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 表单组 */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
}

.form-label.required::after {
    content: ' *';
    color: #e74c3c;
}

/* 表单输入 */
.form-input,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* 表单提示 */
.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    margin-top: 2px;
}

/* 表单错误 */
.form-error {
    font-size: 12px;
    color: #e74c3c;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    min-height: 16px;
}

/* 文件上传区域 */
.file-upload-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-upload-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 20px;
    min-height: 120px;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    position: relative;
    overflow: hidden;
}

.file-upload-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(102, 126, 234, 0.02) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.file-upload-button:hover::before,
.file-upload-button.drag-over::before {
    opacity: 1;
}

.file-upload-button:hover {
    background: var(--bg-hover);
    border-color: var(--border-accent);
    transform: translateY(-1px);
}

.file-upload-button.drag-over {
    background: rgba(102, 126, 234, 0.08);
    border-color: var(--border-accent);
    border-style: solid;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.upload-icon-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.upload-icon {
    font-size: 24px;
    transition: transform 0.3s ease;
}

.file-upload-button:hover .upload-icon,
.file-upload-button.drag-over .upload-icon {
    transform: scale(1.1);
}

.upload-text {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    opacity: 0.8;
}

.file-upload-button.drag-over .upload-hint {
    color: var(--text-accent);
    font-weight: 500;
}

/* 文件预览 */
.file-preview {
    position: relative;
    width: 100%;
    max-width: 280px;
    margin-top: 4px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.file-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.file-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.file-remove:hover {
    background: rgba(231, 76, 60, 0.9);
}

/* 图片预览列表 */
.file-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    margin-top: 4px;
}

.file-preview-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-primary);
}

.file-preview-item img,
.file-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview-item .file-remove {
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    font-size: 14px;
}

/* 文件信息 */
.file-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    position: relative;
}

.file-name {
    font-size: 14px;
    color: var(--text-primary);
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    font-size: 12px;
    color: var(--text-muted);
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
}

/* 分类选择 */
.category-select-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-select {
    flex: 1;
    padding: 10px 32px 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}

.form-select:hover {
    border-color: var(--border-secondary);
    background-color: var(--bg-hover);
}

.form-select:focus {
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-create-category {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-create-category:hover {
    background: var(--bg-hover);
    border-color: var(--border-accent);
}

.btn-create-category svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* 推荐度 */
.rating-input {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.rating-stars-input {
    display: flex;
    gap: 4px;
    cursor: pointer;
}

.rating-star-input {
    font-size: 24px;
    color: var(--text-muted);
    transition: all 0.2s ease;
    user-select: none;
}

.rating-star-input:hover,
.rating-star-input.active {
    color: #ffc107;
    transform: scale(1.1);
}

.rating-value {
    font-size: 14px;
    color: var(--text-primary);
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    font-weight: 500;
}

/* 标签输入 */
.tags-input-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tags-preset,
.tags-custom {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tag-preset-label,
.tag-custom-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
}

.tags-preset-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: var(--text-primary);
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
}

.tag-checkbox:hover {
    background: var(--bg-hover);
    border-color: var(--border-accent);
}

.tag-checkbox input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.tag-checkbox input[type="checkbox"]:checked + span {
    color: var(--text-accent);
    font-weight: 500;
}

.tags-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tags-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.tags-input:focus {
    outline: none;
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
}

.tag-item-remove {
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    font-size: 16px;
    line-height: 1;
}

.tag-item-remove:hover {
    color: #e74c3c;
}

/* 上传进度 */
.upload-progress-section {
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-primary);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-text {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-primary);
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
}

#uploadStatusText {
    flex: 1;
}

#uploadPercentage {
    font-weight: 600;
    color: var(--text-accent);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    border-radius: 4px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* 弹窗底部 */
.app-tool-create-upload-progress {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    flex: 1;
    margin-right: 12px;
    min-width: 200px;
}

.app-tool-create-upload-progress .upload-progress-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    font-size: 12px;
    color: var(--text-secondary);
}

.app-tool-create-upload-progress .upload-status-text {
    flex: 1;
}

.app-tool-create-upload-progress .upload-speed-text {
    margin-left: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

.app-tool-create-upload-progress .upload-progress-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.app-tool-create-upload-progress .upload-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.app-tool-create-upload-progress .upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.app-tool-create-upload-progress .upload-percentage-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 35px;
    text-align: right;
}

.app-tool-create-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--text-primary);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-accent);
}

/* 滚动条样式 */
.app-tool-create-content::-webkit-scrollbar {
    width: 6px;
}

.app-tool-create-content::-webkit-scrollbar-track {
    background: transparent;
}

.app-tool-create-content::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 3px;
}

.app-tool-create-content::-webkit-scrollbar-thumb:hover {
    background: var(--border-secondary);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .app-tool-create-content {
        padding: 16px;
    }
    
    .app-tool-create-form {
        gap: 14px;
    }
    
    .file-upload-button {
        min-height: 100px;
        padding: 20px 16px;
    }
    
    .file-preview-list {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
}

