/**
 * 行业案例公共样式
 * 用于所有统计工具页面的行业案例功能
 */

/* 行业案例区域 */
.case-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    margin-bottom: 2rem;
}

.case-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.case-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.case-section-badge {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.case-section-badge.free {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
}

/* 行业标签 */
.industry-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.industry-tab {
    padding: 0.5rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 20px;
    background: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.industry-tab:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.industry-tab.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

/* 案例网格 */
.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* 案例卡片 */
.case-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.case-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, #8b5cf6 100%);
    opacity: 0;
    transition: opacity 0.2s;
}

.case-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-2px);
}

.case-card:hover::before {
    opacity: 1;
}

.case-card.locked {
    opacity: 0.7;
}

.case-card.locked:hover {
    border-color: var(--warning);
}

.case-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

/* 行业标签 */
.case-industry-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.case-industry-tag.metal {
    background: #dbeafe;
    color: #1e40af;
}

.case-industry-tag.ecommerce {
    background: #fce7f3;
    color: #9d174d;
}

.case-industry-tag.manufacturing {
    background: #d1fae5;
    color: #065f46;
}

.case-status {
    font-size: 1.25rem;
}

.case-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.case-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.case-vars {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.case-var-tag {
    background: var(--gray-100);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* 案例加载提示弹窗 */
.case-loaded-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 1.5rem;
    max-width: 400px;
    z-index: 1000;
    animation: caseToastSlideIn 0.3s ease;
}

@keyframes caseToastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes caseToastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

.case-loaded-toast-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--success);
    font-weight: 600;
}

.case-loaded-toast-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.case-loaded-vars {
    background: var(--gray-50);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
}

.case-loaded-var-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.case-loaded-var-item:last-child {
    margin-bottom: 0;
}

.case-loaded-var-label {
    color: var(--text-secondary);
    min-width: 80px;
}

.case-loaded-var-value {
    font-weight: 600;
    color: var(--primary);
}

.case-loaded-hint {
    background: #dbeafe;
    border-radius: var(--radius-md);
    padding: 0.75rem;
    font-size: 0.85rem;
    color: #1e40af;
    line-height: 1.5;
}

.case-loaded-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.case-loaded-close:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

/* 业务解读区域 */
.business-interpretation {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #6ee7b7;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.business-interpretation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.business-interpretation-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: #065f46;
}

/* AI 解读按钮 */
.ai-interpret-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ai-interpret-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.ai-interpret-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* AI 解读内容 */
.ai-interpretation {
    position: relative;
}

.ai-interpretation-badge {
    display: inline-block;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.ai-hint {
    color: #6b7280;
    font-style: italic;
}

.ai-loading {
    color: #6366f1;
    font-style: italic;
}

.ai-error {
    color: #dc2626;
}

.business-interpretation-content {
    color: #047857;
    font-size: 0.95rem;
    line-height: 1.7;
}

.business-interpretation-content p {
    margin: 0 0 0.75rem;
}

.business-interpretation-content p:last-child {
    margin-bottom: 0;
}

.business-interpretation-content ul {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
}

.business-interpretation-content li {
    margin-bottom: 0.5rem;
}

/* 案例信息提示条（内嵌式） */
.case-info-bar {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #6ee7b7;
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    animation: caseInfoBarFadeIn 0.3s ease;
}

@keyframes caseInfoBarFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes caseInfoBarFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.case-info-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.case-info-bar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.case-info-bar-icon {
    font-size: 1.25rem;
}

.case-info-bar-title {
    font-weight: 600;
    color: #065f46;
    font-size: 0.95rem;
}

.case-info-bar-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #065f46;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    opacity: 0.6;
}

.case-info-bar-close:hover {
    background: rgba(6, 95, 70, 0.1);
    opacity: 1;
}

.case-info-bar-hint {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #047857;
    line-height: 1.5;
}

/* 动态变量标签样式 */
.var-label-dynamic {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.var-label-main {
    font-weight: 600;
    color: var(--text-primary);
}

.var-label-fields {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 500;
}

/* 行业标签数量徽章 */
.tab-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    background: var(--gray-200);
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.industry-tab.active .tab-count-badge {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* 会员专享提示弹窗 */
.membership-prompt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

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

.membership-prompt {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.membership-prompt-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.membership-prompt-close:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.membership-prompt-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.membership-prompt-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.membership-prompt-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

.membership-prompt-features {
    background: var(--gray-50);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: left;
}

.membership-prompt-pricing {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.membership-prompt-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.membership-prompt-price-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.membership-prompt-feature {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.25rem 0;
}

.membership-prompt-actions {
    display: flex;
    gap: 0.75rem;
}

.membership-prompt-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-secondary);
    border: none;
}

.btn-secondary:hover {
    background: var(--gray-200);
}

/* 响应式 */
@media (max-width: 768px) {
    .case-loaded-toast {
        top: auto;
        bottom: 20px;
        left: 20px;
        right: 20px;
        max-width: none;
    }

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

    .industry-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
    }

    .industry-tab {
        white-space: nowrap;
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .case-info-bar {
        padding: 0.75rem 1rem;
    }

    .case-section-title {
        font-size: 1.1rem;
    }

    .case-section-badge {
        font-size: 0.7rem;
        padding: 2px 8px;
    }
}

@media (max-width: 480px) {
    .industry-tabs {
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .industry-tabs::-webkit-scrollbar {
        display: none;
    }

    .industry-tab {
        font-size: 0.75rem;
        padding: 5px 10px;
    }

    .case-card {
        padding: 0.75rem;
    }

    .case-card-title {
        font-size: 0.9rem;
    }

    .case-card-desc {
        font-size: 0.8rem;
    }

    .case-info-bar {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .case-section-title {
        font-size: 1rem;
        gap: 0.4rem;
    }
}
