/**
 * 产品弹窗样式 - 移动端优先设计
 */

/* 弹窗基础样式 - 适配小屏幕 */
#product-modal {
    max-width: 100%;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    margin: 0;
    padding: 0;
}

#product-modal article {
    margin: 0;
    padding: 0;
    max-width: 100%;
    height: 100%;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

/* PC端适配 */
@media (min-width: 768px) {
    #product-modal {
        max-width: 90vw;
        width: 600px;
        height: auto;
        max-height: 90vh;
    }

    #product-modal article {
        border-radius: var(--border-radius);
    }
}

/* 标签页导航 - 移动端优化 */
.tabs-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color, #e5e5e5);
    background: var(--bg-secondary, #f8f9fa);
    position: sticky;
    top: 0;
    z-index: 10;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tabs-nav::-webkit-scrollbar {
    height: 4px;
}

.tab-btn {
    flex: 1;
    min-width: 100px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #666);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    white-space: nowrap;
}

.tab-btn.active {
    color: var(--primary-color, #1976d2);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color, #1976d2);
}

/* 表单容器 */
.tabs-container form {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 标签页内容 */
.tab-content {
    display: none;
    padding: 16px;
}

.tab-content.active {
    display: block;
}

/* 表单字段 - 单列布局 */
.tab-content label {
    display: block;
    margin-bottom: 16px;
    font-weight: 500;
    color: var(--text-primary, #333);
}

.tab-content input,
.tab-content select,
.tab-content textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    font-size: 14px;
    margin-top: 6px;
    box-sizing: border-box;
}

/* 图片预览网格 - 响应式 */
#image-preview-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

/* 移动端：2列 */
@media (min-width: 480px) {
    #image-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* PC端：3列 */
@media (min-width: 768px) {
    #image-preview-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 图片项 */
#image-preview-grid figure {
    margin: 0;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary, #f5f5f5);
    aspect-ratio: 1;
    position: relative;
}

#image-preview-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#image-preview-grid figcaption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px;
    display: flex;
    justify-content: center;
}

#image-preview-grid button {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #d32f2f;
    cursor: pointer;
    font-weight: 500;
}

/* 上传区域 */
.upload-area {
    border: 2px dashed var(--border-color, #ddd);
    border-radius: 8px;
    padding: 32px 16px;
    text-align: center;
    background: var(--bg-secondary, #fafafa);
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--primary-color, #1976d2);
    background: var(--primary-color-light, #e3f2fd);
}

.upload-area i {
    font-size: 48px;
    color: var(--text-secondary, #999);
    margin-bottom: 12px;
}

.upload-area p {
    margin: 8px 0;
    color: var(--text-secondary, #666);
}

/* 底部按钮 - 固定在底部 */
.modal-footer-actions {
    margin-top: auto;
    padding: 16px;
    background: var(--bg-secondary, #f8f9fa);
    border-top: 1px solid var(--border-color, #e5e5e5);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.modal-footer-actions button {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-footer-actions .btn-danger {
    background: #d32f2f;
    color: white;
    border: none;
}

.modal-footer-actions .btn-danger:hover {
    background: #b71c1c;
}

.modal-footer-actions .submit-btn {
    flex: 2;
    background: var(--primary-color, #1976d2);
    color: white;
    border: none;
}

.modal-footer-actions .submit-btn:hover {
    background: var(--primary-color-dark, #1565c0);
}

/* 摄像头按钮 */
#camera-btn {
    width: 100%;
    margin-top: 12px;
}

/* ==================== 官网展示标签页样式 ==================== */

/* Fieldset分组样式 */
fieldset {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
}

fieldset legend {
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 1rem;
    color: #1e293b;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background-color: white;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

fieldset legend i {
    -webkit-text-fill-color: #667eea;
    font-size: 1.1rem;
}

/* 开关标签样式 */
.switch-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.switch-label:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.switch-label > span {
    font-weight: 600;
    color: #334155;
    flex: 1;
}

.switch-label input[type="checkbox"] {
    width: 52px;
    height: 28px;
    margin: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    background: #cbd5e1;
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.switch-label input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch-label input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.switch-label input[type="checkbox"]:checked::before {
    left: 27px;
}

.switch-label small {
    display: block;
    color: #64748b;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    width: 100%;
    font-weight: normal;
}

/* 字段标签优化 */
.tab-content label {
    position: relative;
}

.tab-content label small {
    display: block;
    color: #64748b;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    font-weight: normal;
}

.tab-content label small span {
    font-weight: 600;
    color: #3b82f6;
}

/* Textarea优化 */
.tab-content textarea {
    resize: vertical;
    min-height: 60px;
    line-height: 1.6;
    font-family: inherit;
}

/* Select样式优化 */
.tab-content select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23334155' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

/* 输入框焦点效果 */
.tab-content input:focus,
.tab-content select:focus,
.tab-content textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 价格输入框 */
input[name="market_price"],
input[name="member_price"] {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
}

/* 产品标签选择器美化 */
select[name="product_tag"] option {
    padding: 8px;
    font-size: 1rem;
}

/* 响应式优化 */
@media (max-width: 768px) {
    fieldset {
        padding: 1rem;
    }

    fieldset legend {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }

    .switch-label {
        padding: 0.75rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .switch-label input[type="checkbox"] {
        align-self: flex-end;
    }
}

/* ========== 图片预览模态框 ========== */
.image-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.image-preview-modal.active {
    display: block;
}

.image-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(4px);
}

.image-preview-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.image-preview-content img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.image-preview-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.image-preview-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* ========== 图片操作按钮 ========== */
.image-wrapper,
.image-wrapper-pro {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 8px;
}

.image-wrapper img,
.image-wrapper-pro img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.image-wrapper:hover img,
.image-wrapper-pro:hover img {
    transform: scale(1.05);
}

.image-wrapper img.image-error,
.image-wrapper-pro img.image-error {
    object-fit: contain;
    padding: 1rem;
}

.image-actions,
.image-actions-pro {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-wrapper:hover .image-actions,
.image-wrapper-pro:hover .image-actions-pro {
    opacity: 1;
}

.preview-image-btn,
.preview-image-btn-pro,
.delete-image-btn,
.delete-image-btn-pro {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    color: #334155;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.preview-image-btn:hover,
.preview-image-btn-pro:hover {
    background: #3b82f6;
    color: white;
    transform: scale(1.1);
}

.delete-image-btn:hover,
.delete-image-btn-pro:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
}

/* 移动端优化 */
@media (max-width: 768px) {
    .image-preview-content {
        padding: 1.5rem;
    }

    .image-preview-close {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .image-actions,
    .image-actions-pro {
        opacity: 1;
        background: rgba(0, 0, 0, 0.4);
    }

    .preview-image-btn,
    .preview-image-btn-pro,
    .delete-image-btn,
    .delete-image-btn-pro {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
}
