/* 专业弹窗重新设计 - 预设和风格统一 */

/* ==========================================================================
   模态框基础样式
   ========================================================================== */

.modal {
    background: rgba(15, 23, 42, 0.75) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
}

.modal-content {
    background: #ffffff !important;
    border-radius: 24px !important;
    box-shadow: 
        0 32px 64px -12px rgba(15, 23, 42, 0.35),
        0 0 0 1px rgba(15, 23, 42, 0.05) !important;
    border: none !important;
    overflow: hidden !important;
    margin: 20px auto !important;
}

/* PC端尺寸控制 */
@media (min-width: 769px) {
    .modal-content {
        max-width: 800px !important;
        max-height: 80vh !important;
        width: 90vw !important;
    }
}

/* 平板端尺寸 */
@media (max-width: 768px) and (min-width: 481px) {
    .modal-content {
        max-width: 90vw !important;
        max-height: 85vh !important;
        width: 85vw !important;
    }
}

/* 移动端尺寸 */
@media (max-width: 480px) {
    .modal-content {
        max-width: 95vw !important;
        max-height: 90vh !important;
        width: 95vw !important;
    }
}

/* ==========================================================================
   模态框头部设计
   ========================================================================== */

.modal-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%) !important;
    padding: 24px 32px !important;
    border-bottom: none !important;
    position: relative !important;
    overflow: hidden !important;
}

.modal-header::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        transparent 50%, 
        rgba(255, 255, 255, 0.05) 100%) !important;
}

.modal-header h3 {
    color: #ffffff !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    margin: 0 !important;
    letter-spacing: -0.025em !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    position: relative !important;
    z-index: 2 !important;
}

.close {
    position: absolute !important;
    top: 20px !important;
    right: 24px !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 20px !important;
    font-weight: 300 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(10px) !important;
    z-index: 10 !important;
}

.close:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
    transform: scale(1.05) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

/* ==========================================================================
   模态框内容区域
   ========================================================================== */

.modal-body {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%) !important;
    padding: 0 !important;
    max-height: 65vh !important;
    overflow-y: auto !important;
}

/* 自定义滚动条 */
.modal-body::-webkit-scrollbar {
    width: 8px !important;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.1) !important;
    border-radius: 4px !important;
}

.modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #94a3b8, #64748b) !important;
    border-radius: 4px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #64748b, #475569) !important;
}

/* ==========================================================================
   网格布局统一设计
   ========================================================================== */

.style-grid,
.preset-grid {
    display: grid !important;
    padding: 32px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background: transparent !important;
}

/* PC端 - 3列布局 */
@media (min-width: 769px) {
    .style-grid,
    .preset-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 24px !important;
    }
}

/* 平板端 - 2列布局 */
@media (max-width: 768px) and (min-width: 481px) {
    .style-grid,
    .preset-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
        padding: 24px !important;
    }
}

/* 移动端 - 2列布局优化 */
@media (max-width: 480px) {
    .style-grid,
    .preset-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        padding: 16px !important;
    }
}

/* ==========================================================================
   卡片统一专业设计
   ========================================================================== */

.style-card,
.preset-card {
    background: #ffffff !important;
    border-radius: 20px !important;
    border: 2px solid transparent !important;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    overflow: hidden !important;
    position: relative !important;
    aspect-ratio: 0.85 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    background-image: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
}

/* 卡片悬停效果 */
.style-card:hover,
.preset-card:hover {
    transform: translateY(-8px) scale(1.02) !important;
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    border-color: #3b82f6 !important;
}

/* 卡片激活效果（移动端点击） */
@media (max-width: 768px) {
    .style-card:active,
    .preset-card:active {
        transform: scale(0.98) !important;
        transition: transform 0.1s ease !important;
    }
}

/* 选中状态 */
.style-card.active,
.preset-card.active {
    border-color: #2563eb !important;
    background-image: linear-gradient(135deg, #eff6ff 0%, #dbeafe 50%, #bfdbfe 100%) !important;
    box-shadow: 
        0 25px 50px -12px rgba(59, 130, 246, 0.25),
        0 0 0 1px rgba(59, 130, 246, 0.1) !important;
    transform: translateY(-4px) !important;
}

/* ==========================================================================
   图片区域设计
   ========================================================================== */

/* 风格卡片图片 */
.style-card > img,
.style-card img {
    width: 100% !important;
    height: 75% !important;
    object-fit: cover !important;
    border-radius: 16px 16px 0 0 !important;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0) !important;
    flex-shrink: 0 !important;
    order: 1 !important;
}

/* 预设卡片图片容器 */
.preset-card .preset-card-image,
.preset-card-image {
    width: 100% !important;
    height: 75% !important;
    overflow: hidden !important;
    border-radius: 16px 16px 0 0 !important;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0) !important;
    flex-shrink: 0 !important;
    order: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.preset-card .preset-card-image img,
.preset-card-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 0 !important;
}

/* ==========================================================================
   文字区域设计
   ========================================================================== */

/* 风格卡片文字 */
.style-card > span,
.style-card span {
    width: 100% !important;
    height: 25% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #374151 !important;
    background: #ffffff !important;
    padding: 12px 16px !important;
    margin: 0 !important;
    border-radius: 0 0 16px 16px !important;
    border-top: 1px solid rgba(226, 232, 240, 0.8) !important;
    line-height: 1.3 !important;
    letter-spacing: -0.01em !important;
    flex-shrink: 0 !important;
    order: 2 !important;
    transition: all 0.3s ease !important;
}

/* 预设卡片文字容器 */
.preset-card .preset-card-header,
.preset-card-header {
    width: 100% !important;
    height: 25% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #ffffff !important;
    border-radius: 0 0 16px 16px !important;
    border-top: 1px solid rgba(226, 232, 240, 0.8) !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    order: 2 !important;
}

.preset-card .preset-card-name,
.preset-card-header .preset-card-name,
.preset-card .preset-card-header .preset-card-name {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #374151 !important;
    background: transparent !important;
    padding: 12px 16px !important;
    margin: 0 !important;
    border: none !important;
    line-height: 1.3 !important;
    letter-spacing: -0.01em !important;
    visibility: visible !important;
    opacity: 1 !important;
    transition: all 0.3s ease !important;
}

/* 选中状态文字效果 */
.style-card.active > span,
.style-card.active span,
.preset-card.active .preset-card-name,
.preset-card.active .preset-card-header .preset-card-name {
    color: #1e40af !important;
    font-weight: 700 !important;
    background: rgba(239, 246, 255, 0.9) !important;
}

/* ==========================================================================
   选中标记设计
   ========================================================================== */

.style-card.active::after,
.preset-card.active::after {
    content: '✓' !important;
    position: absolute !important;
    top: 16px !important;
    right: 16px !important;
    width: 28px !important;
    height: 28px !important;
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    z-index: 10 !important;
    box-shadow: 
        0 8px 25px rgba(16, 185, 129, 0.4),
        0 3px 10px rgba(16, 185, 129, 0.2) !important;
    border: 3px solid #ffffff !important;
    animation: checkmarkAppear 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) !important;
}

@keyframes checkmarkAppear {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    70% {
        transform: scale(1.1) rotate(-10deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* ==========================================================================
   移动端优化
   ========================================================================== */

@media (max-width: 480px) {
    .modal-content {
        margin: 8px !important;
        border-radius: 18px !important;
    }
    
    .modal-header {
        padding: 16px 20px !important;
    }
    
    .modal-header h3 {
        font-size: 18px !important;
    }
    
    .close {
        width: 32px !important;
        height: 32px !important;
        top: 14px !important;
        right: 16px !important;
        font-size: 16px !important;
        border-radius: 10px !important;
    }
    
    .modal-body {
        max-height: 70vh !important;
    }
    
    .style-card,
    .preset-card {
        border-radius: 14px !important;
        aspect-ratio: 0.9 !important;
        min-height: 140px !important;
    }
    
    .style-card > img,
    .style-card img,
    .preset-card .preset-card-image,
    .preset-card-image {
        border-radius: 10px 10px 0 0 !important;
        height: 70% !important;
    }
    
    .style-card > span,
    .style-card span,
    .preset-card .preset-card-name,
    .preset-card-header .preset-card-name {
        font-size: 12px !important;
        padding: 8px 10px !important;
        border-radius: 0 0 10px 10px !important;
        height: 30% !important;
        line-height: 1.2 !important;
    }
    
    .style-card.active::after,
    .preset-card.active::after {
        top: 10px !important;
        right: 10px !important;
        width: 22px !important;
        height: 22px !important;
        font-size: 11px !important;
        border-width: 2px !important;
    }
    
    /* 移动端特殊优化 */
    .style-grid,
    .preset-grid {
        padding: 14px !important;
        gap: 10px !important;
    }
}

/* ==========================================================================
   强制覆盖规则
   ========================================================================== */

/* 确保所有元素正确显示 */
html body .modal .style-card,
html body .modal .preset-card {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
}

html body .modal .style-card img,
html body .modal .preset-card .preset-card-image,
html body .modal .preset-card .preset-card-image img {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

html body .modal .style-card span,
html body .modal .preset-card .preset-card-name,
html body .modal .preset-card-header .preset-card-name {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 移除所有可能的干扰伪元素 */
html body .modal .style-card::before,
html body .modal .preset-card::before {
    display: none !important;
}

/* 确保预设头部区域正确显示 */
html body .modal .preset-card .preset-card-header,
html body .modal .preset-card-header {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 强制预设名称显示 - 最高优先级 */
html body .modal .preset-card .preset-card-name,
html body .modal .preset-card-header .preset-card-name,
html body .modal .preset-card .preset-card-header .preset-card-name {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #374151 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    text-align: center !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    padding: 12px 16px !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    line-height: 1.3 !important;
    letter-spacing: -0.01em !important;
}

/* 移动端预设名称优化 */
@media (max-width: 480px) {
    html body .modal .preset-card .preset-card-name,
    html body .modal .preset-card-header .preset-card-name,
    html body .modal .preset-card .preset-card-header .preset-card-name {
        font-size: 12px !important;
        padding: 8px 10px !important;
        height: 30% !important;
        line-height: 1.2 !important;
    }
    
    /* 移动端强制布局修复 */
    html body .modal .style-card,
    html body .modal .preset-card {
        aspect-ratio: 0.9 !important;
        min-height: 140px !important;
        max-height: 160px !important;
        border-radius: 14px !important;
    }
    
    html body .modal .style-card > img,
    html body .modal .style-card img,
    html body .modal .preset-card .preset-card-image,
    html body .modal .preset-card-image {
        height: 70% !important;
        border-radius: 10px 10px 0 0 !important;
    }
    
    html body .modal .style-card > span,
    html body .modal .style-card span,
    html body .modal .preset-card .preset-card-header,
    html body .modal .preset-card-header {
        height: 30% !important;
        border-radius: 0 0 10px 10px !important;
    }
    
    html body .modal .preset-grid,
    html body .modal .style-grid {
        padding: 14px !important;
        gap: 10px !important;
    }
}

/* 确保网格正确显示 */
html body .modal .preset-grid,
html body .modal .style-grid {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 确保模态框内容可见 */
html body .modal .modal-body {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 清理可能的冲突样式 */
html body .modal .style-card *,
html body .modal .preset-card * {
    box-sizing: border-box !important;
}

/* 移除任何可能的负边距或定位 */
html body .modal .style-card,
html body .modal .preset-card,
html body .modal .style-card *,
html body .modal .preset-card * {
    margin: 0 !important;
    position: static !important;
}

/* 除了选中标记和关闭按钮 */
html body .modal .style-card.active::after,
html body .modal .preset-card.active::after,
html body .modal .close {
    position: absolute !important;
}

/* ==========================================================================
   额外的视觉增强
   ========================================================================== */

/* 卡片内容区域微妙阴影 */
.style-card > img,
.style-card img,
.preset-card .preset-card-image {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

/* 文字区域微妙分隔线 */
.style-card > span,
.style-card span,
.preset-card .preset-card-header {
    border-top: 1px solid rgba(226, 232, 240, 0.6) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}

/* 悬停时的微妙渐变效果 */
.style-card:hover > span,
.style-card:hover span,
.preset-card:hover .preset-card-name {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
}

/* 加载状态占位符 */
.style-card img[src=""],
.preset-card .preset-card-image img[src=""] {
    background: linear-gradient(135deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%) !important;
    background-size: 200% 100% !important;
    animation: shimmer 2s infinite linear !important;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .style-card,
    .preset-card {
        border-color: #000000 !important;
    }
    
    .style-card > span,
    .style-card span,
    .preset-card .preset-card-name {
        color: #000000 !important;
        border-top-color: #000000 !important;
    }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    .modal-content {
        background: #1f2937 !important;
    }
    
    .modal-body {
        background: linear-gradient(180deg, #111827 0%, #1f2937 100%) !important;
    }
    
    .style-card,
    .preset-card {
        background-image: linear-gradient(135deg, #374151 0%, #4b5563 100%) !important;
        border-color: #4b5563 !important;
    }
    
    .style-card > span,
    .style-card span,
    .preset-card .preset-card-name {
        color: #f9fafb !important;
        background: #374151 !important;
        border-top-color: #4b5563 !important;
    }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    .style-card,
    .preset-card,
    .close,
    .modal-content {
        transition: none !important;
        animation: none !important;
    }
    
    .style-card.active::after,
    .preset-card.active::after {
        animation: none !important;
    }
}

/* 超小屏幕优化 (iPhone SE等) */
@media (max-width: 375px) {
    .modal-content {
        margin: 5px !important;
        width: 98vw !important;
    }
    
    .style-grid,
    .preset-grid {
        padding: 12px !important;
        gap: 8px !important;
    }
    
    .style-card,
    .preset-card {
        min-height: 120px !important;
        max-height: 140px !important;
        aspect-ratio: 0.85 !important;
    }
    
    .style-card > span,
    .style-card span,
    .preset-card .preset-card-name {
        font-size: 11px !important;
        padding: 6px 8px !important;
    }
    
    .modal-header {
        padding: 14px 16px !important;
    }
    
    .modal-header h3 {
        font-size: 16px !important;
    }
}

/* 超高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 3) {
    .style-card,
    .preset-card {
        border-width: 0.5px !important;
    }
    
    .modal-content {
        box-shadow: 
            0 32px 64px -12px rgba(15, 23, 42, 0.4),
            0 0 0 0.5px rgba(15, 23, 42, 0.1) !important;
    }
}
