/**
 * 增强版商品管理样式
 * 参考萤火商城设计
 */

/* ========== 步骤向导 ========== */
.product-create-wizard {
    padding: 1.5rem;
}

.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.wizard-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 5%;
    right: 5%;
    height: 2px;
    background: linear-gradient(to right, 
        var(--primary-color) 0%, 
        var(--primary-color) var(--progress, 0%), 
        var(--gray-300) var(--progress, 0%), 
        var(--gray-300) 100%);
    z-index: 0;
}

.step {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    margin: 0 auto 0.5rem;
    border-radius: 50%;
    background: var(--gray-300);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: all 0.3s ease;
}

.step-title {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

.step.active .step-number {
    background: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
    transform: scale(1.1);
}

.step.active .step-title {
    color: var(--primary-color);
    font-weight: 600;
}

.step.completed .step-number {
    background: var(--success-color);
}

.step.completed .step-number::after {
    content: '✓';
    font-weight: bold;
}

.step.completed .step-title {
    color: var(--success-color);
}

/* ========== 步骤内容 ========== */
.wizard-content {
    min-height: 400px;
    margin-bottom: 2rem;
}

.wizard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

/* ========== 表单增强 ========== */
.form-label.required::after {
    content: '*';
    color: var(--danger-color);
    margin-left: 4px;
}

.form-text {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* ========== 卡片样式 ========== */
.card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.card-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.25rem;
}

.card-header h6 {
    margin: 0;
    font-weight: 600;
    color: var(--gray-800);
}

/* ========== 图片上传区域 ========== */
.image-upload-section {
    padding: 1rem;
}

.upload-tips {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    min-height: 200px;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--gray-100);
    transition: all 0.3s ease;
}

.image-preview-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.main-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
}

.image-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-preview-item:hover .image-actions {
    opacity: 1;
}

.image-actions .btn {
    padding: 4px 8px;
    font-size: 0.875rem;
}

.drag-handle {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: move;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-preview-item:hover .drag-handle {
    opacity: 1;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    grid-column: 1 / -1;
}

.empty-state-sm {
    text-align: center;
    padding: 2rem 1rem;
}

/* ========== 上传进度 ========== */
.upload-progress {
    margin-top: 1rem;
}

.upload-progress .progress {
    height: 8px;
    border-radius: var(--radius-sm);
}

/* ========== 属性管理 ========== */
.attribute-row {
    background: var(--bg-secondary);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.attribute-row:hover {
    background: var(--gray-200);
}

/* ========== 规格管理 ========== */
.spec-group {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

.spec-values {
    margin-top: 0.5rem;
}

.spec-value-item {
    position: relative;
}

.spec-value-image {
    position: relative;
    width: 60px;
    height: 60px;
    margin-left: 0.5rem;
    display: inline-block;
}

.spec-value-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-300);
}

/* ========== SKU矩阵 ========== */
.table-responsive {
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table-bordered {
    border: 1px solid var(--gray-200);
}

.table thead th {
    background: var(--bg-secondary);
    color: var(--gray-700);
    font-weight: 600;
    border-color: var(--gray-200);
    padding: 0.75rem;
}

.table tbody td {
    padding: 0.5rem;
    vertical-align: middle;
}

.table tbody td input {
    min-width: 80px;
}

/* ========== 预览区域 ========== */
#productSummaryPreview {
    font-size: 0.875rem;
}

#productSummaryPreview strong {
    color: var(--gray-700);
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .wizard-steps {
        flex-wrap: wrap;
    }

    .step {
        flex: 1 0 50%;
        margin-bottom: 1rem;
    }

    .wizard-steps::before {
        display: none;
    }

    .image-preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.5rem;
    }

    .wizard-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .wizard-actions > * {
        width: 100%;
    }

    .table-responsive {
        font-size: 0.875rem;
    }
}

/* ========== 动画效果 ========== */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.wizard-content > div {
    animation: slideInRight 0.3s ease-out;
}

/* ========== 按钮组 ========== */
.wizard-actions .btn {
    min-width: 100px;
}

.wizard-actions .btn i {
    margin-right: 4px;
}

/* ========== 表单验证样式 ========== */
.was-validated .form-control:invalid,
.form-control.is-invalid {
    border-color: var(--danger-color);
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.was-validated .form-control:valid,
.form-control.is-valid {
    border-color: var(--success-color);
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%234ade80' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* ========== 工具提示 ========== */
.tooltip {
    font-size: 0.875rem;
}

/* ========== 加载状态 ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-300);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


