/**
 * 案例详情页专用样式 - 优化版
 * 与报价计算器统一设计语言
 */

/* ========================================
   CSS 变量 - 与报价计算器保持一致
======================================== */
:root {
    --primary-green: #025E49;
    --primary-color: #2ECC71;
    --secondary-color: #27AE60;
    --text-dark: #2C3E50;
    --text-gray: #7F8C8D;
    --text-muted: #95A5A6;
    --bg-light: #F8F9FA;
    --border-color: #E0E0E0;
    --shadow-light: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-medium: 0 4px 16px rgba(0,0,0,0.12);
}

/* ============================================
   顶部导航栏
============================================ */
.detail-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-light);
}

.detail-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.2s;
}

.btn-back:active {
    color: var(--primary-green);
}

.btn-consult {
    display: inline-block;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary-green) 0%, #027a5e 100%);
    border: none;
    border-radius: 20px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-consult:active {
    transform: scale(0.95);
}

/* ============================================
   案例头部 Hero Section - 极简优化
============================================ */
.case-hero-section {
    background: var(--bg-light);
    padding: 16px 0 20px;
}

/* 简化信息展示 - 单行显示 */
.case-info-simple {
    margin-bottom: 16px;
}

.simple-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.4;
    text-align: center;
}

/* 当前阶段卡片 - 白色卡片风格 */
.current-stage-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.status-badge {
    display: none; /* 移除冗余状态徽章 */
}

/* 进度区域 */
.card-progress {
    margin-top: 0;
}

.progress-bar {
    height: 10px;
    background: #F0F0F0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-green) 0%, var(--secondary-color) 100%);
    border-radius: 5px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
}

.progress-percent {
    font-size: 12px;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.progress-info {
    font-size: 13px;
    color: var(--text-gray);
    margin: 0;
    text-align: center;
}

/* ============================================
   施工时间轴 - 简化优化
============================================ */
.timeline-section {
    padding: 40px 0;
    background: white;
}

.section-header-collapsible {
    margin-bottom: 24px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.title-icon {
    color: var(--primary-green);
    font-size: 14px;
}

.timeline-wrapper {
    margin-top: 30px;
}

.timeline-item {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    position: relative;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

/* 时间轴节点 - 极简设计 */
.timeline-node {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 32px;
}

.node-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-color);
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.node-icon {
    font-size: 16px;
    line-height: 1;
}

/* 已完成状态 */
.timeline-item.completed .node-circle {
    background: var(--secondary-color);
}

/* 施工中状态 - 添加脉冲动画 */
.timeline-item.in_progress .node-circle {
    background: var(--primary-green);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(2, 94, 73, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(2, 94, 73, 0);
    }
}

/* 待施工状态 - 半透明 */
.timeline-item.pending .node-circle {
    background: #F0F0F0;
    opacity: 0.6;
}

.timeline-item.pending .node-icon {
    opacity: 0.5;
}

/* 连接线 - 细线设计 */
.node-line {
    flex: 1;
    width: 2px;
    background: var(--border-color);
    margin: 6px 0;
}

.timeline-item.completed .node-line {
    background: var(--secondary-color);
}

.timeline-item.in_progress .node-line {
    background: linear-gradient(180deg, var(--primary-green) 0%, var(--border-color) 100%);
}

.timeline-item.pending .node-line {
    background: var(--border-color);
    border-left: 2px dashed var(--border-color);
    width: 0;
}

/* 时间轴内容 - 白色卡片 */
.timeline-content {
    flex: 1;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.timeline-item.completed .timeline-content {
    border-left: 3px solid var(--secondary-color);
}

.timeline-item.in_progress .timeline-content {
    border-left: 3px solid var(--primary-green);
    box-shadow: 0 2px 8px rgba(2, 94, 73, 0.1);
}

.timeline-item.pending .timeline-content {
    opacity: 0.7;
}

/* 阶段头部 */
.stage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.stage-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stage-emoji {
    font-size: 20px;
    line-height: 1;
}

.stage-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.stage-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.stage-status-badge {
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.stage-status-badge.completed {
    background: #E8F8EF;
    color: var(--secondary-color);
}

.stage-status-badge.in_progress {
    background: rgba(2, 94, 73, 0.1);
    color: var(--primary-green);
}

.stage-status-badge.pending {
    background: #F5F5F5;
    color: var(--text-muted);
}

.stage-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-gray);
}

/* 照片展示 - 固定网格布局 */
.stage-photos-waterfall {
    margin: 16px 0;
}

.photos-waterfall-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (min-width: 768px) {
    .photos-waterfall-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.photo-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--bg-light);
}

/* 照片加载 Skeleton 动画 */
.photo-item.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.photo-item.photo-large {
    grid-row: span 2;
    grid-column: span 2;
}

.photo-item:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    z-index: 1;
}

.photo-item:active {
    transform: scale(0.98);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.photo-item:hover .photo-overlay {
    background: rgba(0,0,0,0.3);
}

.photo-overlay svg {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s;
}

.photo-item:hover .photo-overlay svg {
    opacity: 1;
    transform: scale(1);
}

/* 查看全部照片按钮 - 绿色轻量按钮 */
.view-all-photos {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    background: white;
    border: 2px solid var(--primary-green);
    border-radius: 10px;
    color: var(--primary-green);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.view-all-photos:hover {
    background: rgba(2, 94, 73, 0.05);
}

.view-all-photos:active {
    transform: scale(0.98);
}

/* 工艺说明 */
.stage-description {
    margin: 16px 0;
    padding: 14px;
    background: var(--bg-light);
    border-radius: 10px;
}

.desc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.desc-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-gray);
    margin: 0;
}

/* ============================================
   相似案例推荐 - 卡片优化
============================================ */
.similar-cases-section {
    padding: 40px 0;
    background: var(--bg-light);
}

.similar-cases-section .section-title {
    font-size: 20px;
    margin-bottom: 8px;
}

.section-subtitle {
    font-size: 14px;
    color: var(--text-gray);
    margin: 0 0 24px 0;
    text-align: center;
}

.similar-cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.similar-case-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.similar-case-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

.similar-case-card:active {
    transform: translateY(0);
}

.similar-case-image {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.similar-case-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.similar-case-card:hover .similar-case-image img {
    transform: scale(1.05);
}

.similar-progress-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--primary-green);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

.similar-case-info {
    padding: 16px;
}

.similar-case-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 8px 0;
}

.similar-case-meta {
    font-size: 14px;
    color: var(--text-gray);
    margin: 0 0 6px 0;
}

.similar-case-status {
    font-size: 13px;
    color: var(--primary-green);
    margin: 0;
    font-weight: 600;
}

/* ============================================
   浮动转化按钮 - 单一入口优化
============================================ */
.sticky-cta {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99;
    padding: 0 20px;
    max-width: 100%;
    width: calc(100% - 40px);
    max-width: 400px;
    transition: opacity 0.3s;
}

.sticky-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 32px;
    width: 100%;
    font-size: 16px;
    font-weight: 700;
    border-radius: 28px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(2, 94, 73, 0.3);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sticky-btn-primary {
    background: linear-gradient(135deg, var(--primary-green) 0%, #027a5e 100%);
    color: white;
}

.sticky-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(2, 94, 73, 0.4);
}

.sticky-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 12px rgba(2, 94, 73, 0.25);
}

/* ============================================
   Lightbox 图片查看器 - 添加手势支持
============================================ */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    animation: fadeIn 0.3s ease forwards;
}

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

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    animation: zoomIn 0.3s ease;
}

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

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    transition: opacity 0.15s, transform 0.15s;
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(0,0,0,0.6);
    border: none;
    color: white;
    font-size: 28px;
    padding: 12px 18px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    z-index: 10001;
    user-select: none;
}

.lightbox-close {
    top: 20px;
    right: 20px;
    z-index: 10002;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(0,0,0,0.8);
}

.lightbox-counter {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 15px;
    background: rgba(0,0,0,0.5);
    padding: 6px 14px;
    border-radius: 20px;
}

/* ============================================
   联系方式弹窗
============================================ */
.contact-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    align-items: center;
    justify-content: center;
}

.contact-modal.active {
    display: flex;
}

.contact-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
}

.contact-modal .modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 350px;
    width: 90%;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #F0F0F0;
    border: none;
    font-size: 18px;
    cursor: pointer;
}

.contact-modal .modal-header h3 {
    font-size: 20px;
    margin: 0 0 8px 0;
}

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

.modal-qr img {
    width: 200px;
    height: 200px;
    border-radius: 12px;
}

.modal-note {
    font-size: 13px;
    color: var(--text-gray);
    margin-top: 16px;
}

/* ============================================
   响应式设计
============================================ */
@media (max-width: 768px) {
    .simple-title {
        font-size: 16px;
    }

    .current-stage-card {
        padding: 16px;
    }

    .card-title {
        font-size: 15px;
    }

    .timeline-section {
        padding: 30px 0;
    }

    .section-title {
        font-size: 18px;
    }

    .timeline-item {
        gap: 12px;
    }

    .timeline-node {
        width: 28px;
    }

    .node-circle {
        width: 28px;
        height: 28px;
    }

    .node-icon {
        font-size: 14px;
    }

    .timeline-content {
        padding: 14px;
    }

    .stage-name {
        font-size: 15px;
    }

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

    .sticky-cta {
        bottom: 12px;
        width: calc(100% - 32px);
        padding: 0 16px;
    }

    .sticky-btn {
        padding: 14px 24px;
        font-size: 15px;
    }

    .lightbox-prev,
    .lightbox-next {
        padding: 10px 14px;
        font-size: 24px;
    }

    .lightbox-close {
        padding: 10px 14px;
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .sticky-btn {
        padding: 13px 20px;
        font-size: 14px;
    }
}
