/* ============================================
   招财兔GEO - 预览页面样式 (v2.0)
   ============================================ */

/* --- 基础变量 --- */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --gradient-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: #ffffff;
    --border-color: #e8ecf1;
    --text-primary: #2c3e50;
    --text-secondary: #5a6c7d;
    --text-muted: #94a3b8;
    --radius: 16px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 12px 32px rgba(102, 126, 234, 0.18);
}

/* --- 全局 --- */
* {
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 20px 60px;
}

header {
    text-align: center;
    padding: 16px 20px 8px;
    background: transparent;
}

header h1 {
    font-size: 28px;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

/* --- 加载/错误 --- */
.loading-container {
    text-align: center;
    padding: 80px 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 20px 0;
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-container {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.error-icon { font-size: 48px; margin-bottom: 16px; }

/* --- 预览容器 --- */
.preview-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.preview-wrapper {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* --- 模块卡片 --- */
.preview-section {
    background: var(--card-bg);
    border-radius: 0;
    padding: 24px 28px;
    box-shadow: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.preview-section:last-child {
    border-bottom: none;
}

.preview-section h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-icon {
    display: none;
}

.preview-value {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 15px;
    white-space: pre-wrap;
    word-wrap: break-word;
    min-height: 40px;
}

.preview-value:empty::after {
    content: "暂无数据";
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================
   1. 企业名片
   ============================================ */
.business-card-section {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.business-card-section h2 { color: var(--text-primary); }
.business-card-section .section-icon { opacity: 0.15; color: var(--primary-color); }
.business-card-section h2 { display: none; }

.business-card {
    display: flex;
    gap: 32px;
}

.card-left {
    flex: 1;
}

.card-right {
    width: 400px;
    flex-shrink: 0;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 20px;
}

.card-avatar {
    display: none;
}

.card-avatar .avatar-placeholder {
    display: none;
}

.card-title h3 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.card-detail-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-detail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.detail-icon {
    font-size: 14px;
    width: 20px;
    text-align: center;
}

.card-detail-label {
    font-weight: 600;
    color: var(--text-muted);
    min-width: 70px;
    flex-shrink: 0;
}

.card-detail-value {
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
}

.card-logo-item {
    flex-wrap: wrap;
    align-items: center;
}

.card-logo-value {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: 72px;
    height: 72px;
    max-width: 72px;
    max-height: 72px;
    min-width: 72px;
    overflow: hidden;
    flex: 0 0 72px;
    box-sizing: border-box;
}

.brand-logo-img {
    width: 64px !important;
    height: 64px !important;
    max-width: 64px !important;
    max-height: 64px !important;
    object-fit: contain;
    display: block;
    border-radius: 6px;
    background: #fafafa;
    border: 1px solid var(--border-color);
    padding: 4px;
    box-sizing: border-box;
}

.logo-upload {
    display: none;
    margin-left: 4px;
}

.edit-mode .logo-upload {
    display: inline-flex !important;
}

.logo-upload-btn {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #e3f2fd;
    color: #1976d2;
    border: 1px dashed #2196f3;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.logo-upload-btn:hover {
    background: #bbdefb;
}

.logo-upload-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.edit-mode .card-logo-value {
    border: 2px dashed #667eea;
    border-radius: 4px;
    padding: 4px 8px;
    background-color: #f8f9fa;
}

.brand-tags,
.competitor-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.card-promotion-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.card-promotion-image {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius);
    width: 100%;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fafafa;
}

.card-promotion-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius);
}

.promotion-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.placeholder-icon {
    display: none;
}

.placeholder-text {
    font-size: 14px;
    font-weight: 500;
}

/* 宣传图片缩略图导航 */
.promotion-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 80px));
    grid-auto-flow: row;
    gap: 8px;
    margin-top: 12px;
    box-sizing: border-box;
    width: 100%;
    justify-content: flex-start;
}

.promotion-thumb {
    width: 80px;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.25);
    z-index: 1;
}

.promotion-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.edit-mode .promotion-thumb:hover .promotion-thumb-delete,
.edit-mode .promotion-thumb.touch-active .promotion-thumb-delete {
    display: flex;
}

/* 手机端始终显示删除与调序，否则点不到 */
@media (hover: none) and (pointer: coarse), (max-width: 768px) {
    .edit-mode .promotion-thumb .promotion-thumb-delete {
        display: flex;
    }
    .edit-mode .promotion-thumb .promo-order-controls {
        display: flex;
    }
}

.promo-order-controls {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 2px;
    z-index: 12;
    justify-content: space-between;
    padding: 0 2px;
    pointer-events: none;
}

.promo-order-controls .img-order-btn {
    pointer-events: auto;
}

.promotion-thumb-delete {
    position: absolute;
    top: 0;
    right: 0;
    width: 22px;
    height: 22px;
    background: rgba(255, 67, 67, 0.9);
    color: white;
    border-radius: 0 4px 0 6px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    z-index: 13;
    pointer-events: auto;
}

.promotion-thumb-delete:hover {
    background: rgba(230, 33, 33, 0.95);
}

.promotion-thumb:hover {
    border-color: var(--primary-color);
}

.promotion-thumb.dragging {
    opacity: 0.5;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
}

.promotion-thumb.drag-over {
    border-color: var(--primary-color);
    border-style: dashed;
    background: rgba(102, 126, 234, 0.1);
}

.promotion-thumb.drag-before {
    border-left: 3px solid var(--primary-color);
}

.promotion-thumb.drag-after {
    border-right: 3px solid var(--primary-color);
}

.promotion-thumb.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

.promotion-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.promotion-upload {
    margin-top: 12px;
}

.promotion-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #e3f2fd;
    color: #1976d2;
    border: 2px dashed #2196f3;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.promotion-upload-btn:hover {
    background: #bbdefb;
    border-color: #1976d2;
}

.promotion-upload-btn:active {
    transform: scale(0.98);
}

/* ============================================
   2. 联系信息卡片
   ============================================ */
.contact-info-section .contact-info-card {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.contact-item {
    flex: 1;
    min-width: 200px;
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.contact-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 60px;
    flex-shrink: 0;
}

.contact-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
    word-break: break-all;
}

/* ============================================
   3. 产品/服务
   ============================================ */
.products-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-item {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.product-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.12);
}

.product-header { margin-bottom: 12px; }

body.edit-mode .product-item .remove-product {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #ff4757;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.35);
}

body.edit-mode .product-item .remove-product:hover {
    background: #ff3742;
    transform: scale(1.08);
}

body.edit-mode .product-header {
    padding-right: 36px;
}

.product-keyword {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 6px 0;
}

.product-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.product-images {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    overflow: hidden;
    width: 100%;
    padding: 0;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 80px));
    grid-auto-flow: row;
    gap: 8px;
    margin-top: 12px;
    box-sizing: border-box;
    overflow: hidden;
    width: 100%;
    justify-content: flex-start;
}

.image-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    border-radius: 6px;
    padding: 3px;
    border: 1px solid #e8ecf1;
    transition: all 0.2s ease;
    box-sizing: border-box;
    width: 80px;
}

.image-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

/* 编辑模式：相关图片可拖拽排序 */
body.edit-mode .image-item-sortable {
    cursor: grab;
    border-style: dashed;
    border-color: #667eea;
}

body.edit-mode .image-item-sortable.dragging {
    opacity: 0.55;
    transform: scale(1.05);
    box-shadow: 0 0 16px rgba(102, 126, 234, 0.35);
    cursor: grabbing;
}

body.edit-mode .image-item-sortable.drag-over {
    border-color: #2196f3;
    border-style: solid;
    background: rgba(33, 150, 243, 0.08);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: block;
}

.product-image:hover { transform: scale(1.04); }

.add-image-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    width: 80px;
    border: 2px dashed #667eea;
    border-radius: 6px;
    background: #f8f9fa;
    color: #667eea;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.add-image-btn:hover {
    background: #f0f1ff;
    border-color: #5a6fd6;
}

.image-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: 3px;
}

.image-name {
    font-size: 10px;
    color: #94a3b8;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    line-height: 1.2;
}

.image-size {
    font-size: 9px;
    color: #cbd5e1;
    margin-top: 1px;
}

.no-images-placeholder {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
    border: 2px dashed #e2e8f0;
    border-radius: 8px;
    width: 100%;
}

/* ============================================
   7. 智能画像
   ============================================ */
.smart-profile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
    overflow: hidden;
    width: 100%;
}

.smart-card {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    transition: all 0.3s ease;
}

.smart-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.smart-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.smart-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.6;
}

.smart-value span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 16px;
    font-size: 13px;
}

.smart-value strong {
    color: var(--primary-color);
    font-size: 18px;
}

/* ============================================
   8. 智能体模块
   ============================================ */
.agent-modules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.agent-card {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 22px;
    text-align: center;
    transition: all 0.3s ease;
}

.agent-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
    transform: translateY(-3px);
}

.agent-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.agent-card h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.agent-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 14px 0;
}

.agent-status {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #e2e8f0;
    color: var(--text-muted);
}

.agent-status.active {
    background: #dcfce7;
    color: #16a34a;
}

/* ============================================
   9. 文档存档
   ============================================ */
.doc-archive {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.doc-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 18px;
    transition: all 0.3s ease;
}

.doc-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
    transform: translateX(4px);
}

.doc-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.doc-info h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.doc-info p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 6px 0;
}

.doc-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: #dcfce7;
    color: #16a34a;
}

/* ============================================
   按钮
   ============================================ */
.preview-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    padding: 20px 0 10px;
}

.btn {
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--gradient-bg);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.btn-secondary {
    background: #64748b;
    color: white;
}

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-2px);
}

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

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 28px;
    color: white;
    cursor: pointer;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover { background: rgba(0, 0, 0, 0.75); }

.modal-image {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    display: block;
}

.modal-info {
    padding: 16px 20px;
    text-align: center;
    background: #f8fafc;
}

.modal-info h3 { margin: 0; color: var(--text-primary); font-size: 16px; }

/* ============================================
   登录模态框
   ============================================ */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal .modal-content {
    background: white;
    border-radius: 14px;
    width: 90%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gradient-bg);
    color: white;
    border-radius: 14px 14px 0 0;
}

.modal-header h3 { margin: 0; font-size: 18px; }

.modal-header .close {
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.modal-header .close:hover { opacity: 1; }

.modal-body { padding: 24px; }

.modal-body p { margin: 0 0 20px; color: var(--text-secondary); font-size: 14px; }

.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
    padding-top: 0;
    border-top: none;
}

.form-actions .btn {
    width: 120px;
    padding: 10px 0;
    font-size: 14px;
    text-align: center;
    margin-bottom: 0;
}

#saveBtn,
#cancelBtn {
    flex: 0 0 auto;
    width: 120px;
    min-width: 120px;
    padding: 12px 0;
    font-size: 15px;
    text-align: center;
    box-sizing: border-box;
}

/* ============================================
   编辑模式
   ============================================ */
.edit-textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.7;
    resize: vertical;
    font-family: inherit;
    background: #f8faff;
    box-sizing: border-box;
}

.edit-textarea:focus {
    outline: none;
    border-color: #5a67d8;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.edit-mode .preview-section {
    border-color: var(--primary-color);
    background: #fafafe;
}

/* ============================================
   输入模态框
   ============================================ */
.input-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.input-modal-content {
    background: white;
    border-radius: 14px;
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.3);
}

.input-modal-header {
    padding: 18px 22px;
    background: var(--gradient-bg);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.input-modal-header h3 { margin: 0; font-size: 17px; }

.input-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: white;
    cursor: pointer;
    opacity: 0.8;
}

.input-modal-close:hover { opacity: 1; }

.input-modal-body { padding: 22px; }

.input-modal-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
}

.input-modal-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-modal-footer {
    padding: 0 22px 22px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.input-modal-btn {
    width: 120px;
    padding: 10px 0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.input-modal-btn-cancel {
    background: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
}

.input-modal-btn-cancel:hover { background: #e2e8f0; }

.input-modal-btn-confirm {
    background: var(--gradient-bg);
    color: white;
}

.input-modal-btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 40px 20px;
    background: #f8fafc;
    border-radius: 10px;
    border: 2px dashed #e2e8f0;
}

/* ============================================
   响应式（按屏幕宽度自动适配手机/平板）
   ============================================ */

/* 相关图片左右调序（默认桌面隐藏，手机/触控显示） */
.image-order-controls {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 22px;
    z-index: 11;
    justify-content: space-between;
    padding: 0 2px;
    pointer-events: none;
}

.img-order-btn {
    pointer-events: auto;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(33, 150, 243, 0.95);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.img-order-btn:active {
    transform: scale(0.92);
    background: #1565c0;
}

@media (max-width: 1200px) {
    .container { padding: 10px 16px 48px; }
    .image-gallery,
    .promotion-thumbnails {
        grid-template-columns: repeat(auto-fill, 80px);
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 8px 12px 88px;
        max-width: 100%;
    }

    header { padding: 12px 8px 4px; }
    header h1 { font-size: 22px; }
    header p { font-size: 13px; padding: 0 8px; }

    .preview-section {
        padding: 16px 14px;
        border-radius: 12px;
        margin-bottom: 14px;
    }

    .preview-section h2 {
        font-size: 18px;
        margin-bottom: 12px;
    }

    /* 宣传大图：手机端别用 16:9 拉太高 */
    .card-promotion-image {
        aspect-ratio: auto;
        max-height: 140px;
        min-height: 100px;
        width: 100%;
    }

    .card-promotion-image img {
        max-height: 140px;
        width: 100%;
        object-fit: contain;
    }

    .business-card { flex-direction: column; text-align: center; }
    .card-meta { justify-content: center; }
    .card-right { width: 100%; }
    .card-detail-row {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    .card-detail-item {
        width: 100%;
        text-align: left;
    }

    .products-list { grid-template-columns: 1fr; gap: 12px; }
    .product-item { padding: 14px 12px; }
    .product-keyword { font-size: 16px; word-break: break-word; }
    .product-description { font-size: 13px; }

    .smart-profile { flex-direction: column; }
    .agent-modules { grid-template-columns: 1fr 1fr; gap: 10px; }
    .doc-archive { grid-template-columns: 1fr; }

    /* 底部按钮：盖过 #saveBtn 的固定 120px */
    .preview-actions {
        position: sticky;
        bottom: 0;
        z-index: 50;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
        margin: 0;
        padding: 12px;
        box-sizing: border-box;
        background: rgba(102, 126, 234, 0.95);
        border-radius: 12px 12px 0 0;
    }

    .preview-actions .btn,
    #saveBtn,
    #cancelBtn {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        flex: 1 1 auto !important;
        box-sizing: border-box;
        margin: 0;
    }

    /* 缩略图固定尺寸，禁止 1fr 把格子撑满整行 */
    .image-gallery,
    .promotion-thumbnails {
        display: grid;
        grid-template-columns: repeat(auto-fill, 68px);
        gap: 8px;
        width: 100%;
        justify-content: start;
        overflow: visible;
    }

    .image-item,
    .promotion-thumb,
    .add-image-btn {
        width: 68px;
        max-width: 68px;
    }

    .add-image-btn {
        min-height: 68px;
        font-size: 11px;
        padding: 4px;
    }

    .image-name,
    .image-size {
        font-size: 9px;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.edit-mode .product-item .remove-product {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
    }

    body.edit-mode .image-order-controls {
        display: flex;
    }
}

@media (max-width: 480px) {
    .container { padding: 6px 8px 96px; }
    header h1 { font-size: 20px; }
    .section-icon { display: none; }
    .preview-section { padding: 14px 10px; }
    .preview-section h2 { font-size: 16px; }

    .card-promotion-image {
        max-height: 110px;
        min-height: 80px;
    }
    .card-promotion-image img { max-height: 110px; }

    .smart-profile { flex-direction: column; }
    .agent-modules { grid-template-columns: 1fr; }

    .image-gallery,
    .promotion-thumbnails {
        grid-template-columns: repeat(auto-fill, 64px);
        gap: 6px;
    }
    .image-item,
    .promotion-thumb,
    .add-image-btn {
        width: 64px;
        max-width: 64px;
    }
    .add-image-btn { font-size: 10px; min-height: 64px; }

    .promotion-upload-btn {
        width: 100%;
        justify-content: center;
    }
}

/* 触控设备：增大可点区域 + 显示调序按钮 */
@media (hover: none) and (pointer: coarse) {
    .preview-actions .btn,
    #saveBtn,
    #cancelBtn {
        min-height: 44px;
    }
    body.edit-mode .product-item .remove-product {
        width: 36px;
        height: 36px;
        font-size: 22px;
    }
    body.edit-mode .image-order-controls {
        display: flex;
    }
}
