/* ==========================================
   产品报告 UI 样式
   ========================================== */

/* 报告容器 */
.product-report-wrapper {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    /* 移除 overflow: hidden 以允许设计风格下拉框显示 */
    margin-bottom: 1rem;
    position: relative;
    z-index: 1000;
}

/* 报告头部 - 独立显示 */
.product-report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 0.5rem 0;
    /* 仅保留下方间距 */
    background: transparent;
    /* 去除背景 */
    border-bottom: none;
    /* 去除边框 */
    cursor: default;
    /* cursor default */
}

.product-report-header:hover {
    background: transparent;
    /* hover时无背景变化 */
}

.report-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-status-icon {
    /* 调整图标样式 */
    width: 24px;
    height: 24px;
    background: transparent;
    /* 去除绿色背景块 */
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #22c55e;
    /* 图标颜色 */
}

.report-status-icon svg {
    width: 20px;
    /* 稍微放大图标 */
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
}

.report-header-text h3 {
    margin: 0;
    font-size: 1rem;
    /* 稍微加大标题 */
    font-weight: 600;
    color: #1e293b;
}

.report-toggle-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    /* 去除内边距 */
    background: transparent;
    /* 去除背景 */
    border: none;
    /* 去除边框 */
    font-size: 0.85rem;
    color: #3b82f6;
    /* 蓝色链接色 */
    cursor: pointer;
    transition: all 0.2s;
}

.report-toggle-btn:hover {
    background: transparent;
    color: #2563eb;
    text-decoration: underline;
    /* hover时加下划线 */
}

.report-toggle-arrow {
    display: none;
    /* 隐藏箭号 */
}

/* 紧凑布局容器 */
.product-report-compact {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

/* 独立的图片区域 */
.report-image-box {
    width: 72px;
    height: 72px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s;
    position: relative;
    /* 核心：子元素绝对定位的基础 */
}

.report-image-box:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.report-image-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 替换图标暗示 */
.report-image-replace-hint {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    z-index: 5;
    pointer-events: none;
    /* 点击事件透传给父容器 */
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.report-image-box:hover .report-image-replace-hint {
    transform: scale(1.15);
}

.report-image-replace-hint img {
    width: 12px;
    height: 12px;
    object-fit: contain;
}

.report-image-box svg {
    width: 24px;
    height: 24px;
    color: #94a3b8;
}

/* 默认状态内容 - 扁平化布局 */
.product-report-default {
    flex: 1;
    height: 72px;
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    min-width: 0;
}

/* 报告容器 - 移除原来的边框和背景，由内部product-report-default接管 */
.product-report-wrapper {
    background: transparent;
    border: none;
    border-radius: 0;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1000;
}



/* 右侧：产品核心信息 - 等距分布 */
.report-info-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex: 1;
    height: 100%;
    min-width: 0;
}

/* 各个字段的比例调整 */
.report-info-brand {
    flex: 1.2;
    min-width: 100px;
}

.report-info-desc {
    flex: 2.5;
    /* 产品描述占主要比例 */
    min-width: 0;
}

.report-info-region,
.report-info-vibe,
.report-info-business-type,
.report-info-adaptation-type {
    flex: 1;
    min-width: 100px;
}

/* 增加 App 模式下拉框之间的间距 */
.report-info-adaptation-type+.report-info-region {
    margin-left: 3rem;
    /* 增加下拉框之间的距离 */
}

.report-product-desc-value {
    min-width: 0;
    overflow: hidden;
}

.report-product-desc-text {
    font-size: 0.9rem;
    color: #334155;
    line-height: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.report-info-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

/* Reset specific widths */
.report-info-brand,
.report-info-category,
.report-info-style,
.report-info-layout {
    width: auto;
    margin-left: 0;
}

.report-info-label {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 500;
    white-space: nowrap;
}

.report-info-value {
    font-size: 0.9rem;
    font-weight: 400;
    color: #0f172a;
    /* 深色 */
    height: auto;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-info-brand .report-info-value {
    font-weight: 600;
}

/* Checkbox Styling */
.layout-mode-selector {
    height: 32px;
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: #475569;
    font-weight: 500;
    white-space: nowrap;
}

.checkbox-label input {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: #000;
}

/* Update Selectors and Dropdowns to fill width and truncate */
.product-category-selector {
    width: 100%;
}

/* 极简下拉框样式 */
.product-category-selector select {
    width: 100% !important;
    min-width: 0 !important;
    height: auto;
    padding: 0 1.25rem 0 0 !important;
    /* 缩小右侧padding */
    background: transparent;
    border: none;
    font-size: 0.9rem;
    font-weight: 400;
    color: #0f172a;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    /* Custom Arrow */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 2px center;
    /* 将箭头向左移动一点 */
    background-size: 14px;
    line-height: 1.5;
}

.product-category-selector select:focus {
    outline: none;
}

.design-style-selector {
    width: 100%;
}

.design-style-dropdown {
    width: 100%;
    min-width: 0;
    height: auto;
    padding: 0;

    background: transparent;
    border: none;
    font-size: 0.9rem;
    font-weight: 400;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.design-style-dropdown svg {
    width: 16px;
    height: 16px;
    stroke: #64748b;
}

.design-style-dropdown:hover {
    background: transparent;
    border: none;
}

/* 复选框样式调整 */
.layout-mode-selector {
    height: auto;
    margin-top: 2px;
}

.checkbox-label {
    font-size: 0.9rem;
    color: #0f172a;
    font-weight: 400;
}

.checkbox-label input {
    width: 18px;
    /* 稍微放大 */
    height: 18px;
    border-radius: 4px;
    accent-color: #0f172a;
    /* 深色选中色 */
}

.design-style-dropdown span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 设计风格选择器 - 下拉框版本 */
.design-style-selector {
    position: relative;
    width: 100%;
}

.design-style-selector .design-style-dropdown svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
    margin-left: 0.5rem;
    /* Add consistent spacing */
    flex-shrink: 0;
}

.design-style-selector .design-style-dropdown.open svg {
    transform: rotate(180deg);
}

.style-options-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 180px;
    /* 确保最小宽度 */
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 100;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}

.style-options-menu.open {
    display: block;
}

.style-option {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.style-option:hover {
    background: #f8fafc;
}

.style-option.active {
    background: #f0f0f0;
    font-weight: 600;
}

.style-option-icon {
    display: none;
}

.style-option-name {
    flex: 1;
    white-space: nowrap;
}

/* 详情状态内容 */
.product-report-details {
    padding: 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: none;
    margin-top: 1rem;
    background: white;
    /* 增加白色背景 */
    border-radius: 8px;
    /* 圆角与外部容器协调 */
}

/* 通过JS控制显示 */
.identification-report:not(.hidden) .product-report-details.expanded {
    display: block;
}

/* 临时修复：确保.expanded类能直接工作 */
.product-report-details.expanded {
    display: block !important;
}


.details-group {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.details-group:last-child {
    margin-bottom: 0;
}

.details-group-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed #cbd5e1;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

.details-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.details-field.full-width {
    grid-column: 1 / -1;
}

.details-field label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
}

.details-field input,
.details-field textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #1e293b;
    transition: all 0.2s;
}

.details-field input:focus,
.details-field textarea:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.details-field textarea {
    resize: vertical;
    min-height: 80px;
}

/* 双输入框 */
.details-split-input {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.75rem;
    align-items: center;
}

/* 视觉规范区域布局 */
.visual-specs-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    /* 将标题对齐到顶部 */
    gap: 1.5rem;
    /* 保持一致的间距 */
}

.visual-specs-color,
.visual-specs-style,
.visual-specs-bilingual {
    flex: 0 0 auto;
    /* 核心修复：适应内容，不强行填满 */
}

/* 下拉框容器适应内容 */
.visual-specs-style .design-style-selector {
    width: fit-content;
    min-width: 160px;
}

/* 复选框容器适应内容 */
.visual-specs-bilingual .bilingual-toggle-label {
    width: fit-content;
}

.bilingual-toggle-label {
    display: flex;
    align-items: center;
    padding: 0.55rem 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    color: #334155;
    font-weight: 500;
    user-select: none;
}

.bilingual-toggle-label:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.details-split-divider {
    width: 1px;
    height: 20px;
    background: #e2e8f0;
}

/* 卖点标签 */
.selling-points-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.selling-point-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #475569;
}

.selling-point-tag button {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.selling-point-tag button:hover {
    color: #ef4444;
}

.add-selling-point-btn {
    padding: 0.5rem 0.875rem;
    background: white;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.add-selling-point-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #475569;
}

/* 颜色选择器 */
.color-palette {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.color-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.color-swatch {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
}

.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.color-code {
    font-size: 0.75rem;
    color: #94a3b8;
    font-family: 'Monaco', 'Courier New', monospace;
}

/* 详情页底部的删除按钮 */
.delete-design-on-report {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px dashed #fee2e2;
    display: flex;
    justify-content: center;
}

.delete-current-btn-report {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: white;
    border: 1px solid #fecaca;
    border-radius: 9999px;
    color: #ef4444;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-current-btn-report:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
}

.delete-current-btn-report svg {
    stroke-width: 2.5;
}

/* 响应式 */
@media (max-width: 768px) {
    .product-report-compact {
        flex-direction: column;
        height: auto;
    }

    .report-image-box {
        width: 140px !important;
        /* 调整为合适的正方形尺寸 */
        height: 140px !important;
        margin: 1.25rem auto 0 !important;
        /* 居中显示，并与顶部拉开间距 */
        border-radius: 12px !important;
        /* 四周圆角 */
        flex: none !important;
    }

    .product-report-default {
        height: auto !important;
        padding: 1.25rem !important;
    }

    .report-info-section {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 1rem 0 !important;
        /* Use vertical gap, handle horizontal width explicitly */
        height: auto !important;
        width: 100% !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        overflow: visible !important;
    }

    .report-info-row {
        flex: 0 0 auto !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        padding: 0 5px !important;
    }

    /* 第一行：1/2 宽度 */
    .report-info-brand,
    .report-info-desc {
        width: 50% !important;
    }

    /* 第二行：平分剩余空间 */
    /* 针对下拉框所在的 row */
    .report-info-business-type,
    .report-info-adaptation-type,
    .report-info-region,
    .report-info-vibe {
        flex: 1 !important;
        /* 核心：让它们自动平分剩余行 */
        width: auto !important;
        max-width: none !important;
    }

    /* 辅助间距：当下拉框多时缩小文字 */
    .report-info-label {
        font-size: 0.7rem !important;
        color: #94a3b8 !important;
        margin-bottom: 2px !important;
    }

    .report-info-value,
    .report-product-desc-text {
        font-size: 0.8rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
    }

    .report-product-desc-text {
        width: 100%;
    }

    /* Dropdown specific styling on mobile */
    .design-style-dropdown {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.8rem !important;
        height: 32px !important;
        min-width: unset !important;
    }

    .design-style-dropdown svg {
        width: 12px !important;
        height: 12px !important;
    }

    .report-info-adaptation-type+.report-info-region {
        margin-left: 0 !important;
    }

    .report-image-box img {
        max-height: 100px;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    .design-style-selector {
        width: 100%;
    }

    .product-report-header {
        padding: 1rem;
    }

    .report-header-text h3 {
        font-size: 0.95rem;
    }

    .report-header-text p {
        font-size: 0.8rem;
    }

    .report-toggle-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}