/* 弹窗遮罩层 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
    /* 添加内边距防止溢出 */
    box-sizing: border-box;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 弹窗主体 */
.step-modal {
    background: white;
    border-radius: 20px;
    width: auto;
    min-width: min(900px, 90vw);
    max-width: 95vw;
    max-height: 90vh;
    overflow: visible;
    /*允许内容溢出，让modal-content处理滚动*/
    position: relative;
    transform: scale(0.8);
    transition: transform 0.3s ease;
    -webkit-transition: transform 0.3s ease;
    -moz-transition: transform 0.3s ease;
    -ms-transition: transform 0.3s ease;
    -o-transition: transform 0.3s ease;
}

/* 结果推荐页面时移除 modal-content 的 padding 并添加滚动 */
.step-modal.recommendation-mode .modal-content {
    padding: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    max-height: calc(100% - 80px) !important;
    /* 减去头部高度 */
    height: calc(100% - 80px) !important;
    /* 设置固定高度以确保滚动生效 */
    /* 隐藏滚动条但保持滚动功能 */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE 和 Edge */
}

/* 隐藏 WebKit 浏览器的滚动条 */
.step-modal.recommendation-mode .modal-content::-webkit-scrollbar {
    display: none;
}

.step-modal.recommendation-mode .modal-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.step-modal.recommendation-mode .modal-header .results-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.modal-overlay.active .step-modal {
    transform: scale(1);
}

/* 弹窗头部 */
.modal-header {
    padding: 10px 30px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.step-indicator {
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

.close-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #666;
    transition: background-color 0.2s ease;
}

.close-btn:hover {
    background: #e0e0e0;
}

/* 弹窗内容 */
.modal-content {
    text-align: center;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    max-height: calc(90vh - 120px) !important;
    /* 使用视口高度而不是相对高度 */
    /* 隐藏滚动条但保持滚动功能 */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE 和 Edge */
}

/* 隐藏 WebKit 浏览器的滚动条 */
.modal-content::-webkit-scrollbar {
    display: none;
}

.step-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 16px 0;
}

.step-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 30px;
    font-style: italic;
}

/* 选择项网格 */
.options-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 40px;
    justify-content: center;
}

/* 动态列数类 */
.options-grid.cols-1 {
    grid-template-columns: 362px;
}

.options-grid.cols-2 {
    grid-template-columns: repeat(2, 362px);
}

.options-grid.cols-3 {
    grid-template-columns: repeat(2, 362px);
}

/* 三个选项时的特殊布局 */
.options-grid.three-options {
    grid-template-columns: repeat(2, 362px);
    grid-template-rows: auto auto;
    grid-template-areas:
        "first second"
        "third third";
}

.options-grid.three-options .option-card:nth-child(1) {
    grid-area: first;
}

.options-grid.three-options .option-card:nth-child(2) {
    grid-area: second;
}

.options-grid.three-options .option-card:nth-child(3) {
    grid-area: third;
    justify-self: center;
    max-width: 362px;
    width: 50%;
    margin: 0 auto;
}

.options-grid.cols-4 {
    grid-template-columns: repeat(2, 362px);
}

.option-card {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid #e0e0e0;
    background: white;
    width: 362px;
    height: 198px;
    display: flex;
    flex-direction: column;
}

.option-card:hover {
    border-color: #FEDB1E;
}

.option-card.selected {
    border-color: #4CAF50;
}

.option-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

.option-label {
    position: absolute;
    left: 17px;
    bottom: 16px;
    font-size: 18px;
    font-weight: 600;
    color: white;
    z-index: 2;
}

/* 选中状态的勾选图标 */
.option-card::after {
    content: '';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background-image: url('https://img-va.myshopline.com/image/store/1737714205978/future-success-2x.png?w=80&h=80');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
}

.option-card.selected::after {
    opacity: 1;
    transform: scale(1);
}

/* 选中状态的边框效果 */
.option-card.selected {
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

/* 选中状态的覆盖层 */
.option-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(76, 175, 80, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.option-card.selected::before {
    opacity: 1;
}

/* 下一步按钮 */
.next-btn {
    background: #FEDB1E;
    color: #333;
    border: none;
    padding: 9px 60px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.4;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.2);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
    margin-bottom: 16px;
}

.next-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
    -webkit-transition: left 0.5s ease;
    -moz-transition: left 0.5s ease;
    -ms-transition: left 0.5s ease;
    -o-transition: left 0.5s ease;
}

.next-btn.active {
    opacity: 1;
    pointer-events: auto;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
}

.next-btn.active:hover {
    background: #FEDB1E;
}

.next-btn.active:hover::before {
    left: 100%;
}

.next-btn:active {
    transform: translateY(0);
}

/* 推荐内容页面 */
.recommendation-content {
    position: relative;
    min-height: 400px;
    padding: 0;
    text-align: left;
    border-radius: 20px;
    overflow: visible;
    /* 允许内容溢出，让父容器处理滚动 */
}

/* 桌面端样式 */
.recommendation-content[data-view-mode="desktop"] {
    color: white;
}

/* 移动端样式 */
.recommendation-content[data-view-mode="mobile"] {
    background: white !important;
    background-image: none !important;
}

.recommendation-content[data-view-mode="mobile"] .product-name {
    color: #333 !important;
    text-shadow: none;
}

.recommendation-content[data-view-mode="mobile"] .product-description {
    color: #666 !important;
    opacity: 1;
}

.recommendation-content[data-view-mode="mobile"] .features-title {
    color: #333 !important;
}

.recommendation-content[data-view-mode="mobile"] .feature-text {
    color: #666 !important;
    opacity: 1;
}

.recommendation-content[data-view-mode="mobile"] .product-price {
    color: #333 !important;
    text-shadow: none;
}

.recommendation-content[data-view-mode="mobile"] .current-price {
    color: #333 !important;
}

.recommendation-content[data-view-mode="mobile"] .original-price {
    color: #999 !important;
}


/* 顶部标签栏 */
.recommendation-header {
    position: relative;
    z-index: 3;
    padding: 20px 30px 0;
}

.recommendation-tabs {
    display: flex;
    gap: 0;
}

.tab-item {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 8px 8px 0 0;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: none;
}

.tab-item.active {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border-color: rgba(255, 255, 255, 0.9);
}

.product-recommendation {
    position: relative;
    z-index: 2;
    padding: 20px 30px 30px;
    min-height: 400px;
}

.product-info {
    position: relative;
    z-index: 2;
    color: white;
    max-width: 60%;
}

.product-name {
    font-size: 28px;
    margin-bottom: 16px;
    font-weight: 600;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.product-description {
    font-size: 16px;
    color: #fff;
    margin-bottom: 24px;
    opacity: 0.95;
    line-height: 1.5;
}

/* 产品特性列表 */
.product-features {
    margin-bottom: 30px;
}

.features-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 15px;
}

.features-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.feature-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
    background-image: url('https://img-va.myshopline.com/image/store/1737714205978/future-success-2x.png?w=80&h=80');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.feature-text {
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
    opacity: 0.9;
}

.product-price {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 25px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-price {
    color: #fff;
    font-size: 32px;
    font-weight: 700;
}

.original-price {
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    font-weight: 400;
    text-decoration: line-through;
}

.recommendation-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.cta-button {
    border: none;
    padding: 13px 40px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-width: 120px;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
}

.cta-button.primary {
    background: #FFD700;
    color: #333;
    font-weight: 700;
}

.cta-button.primary:hover {
    background: #FFC107;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.cta-button.secondary {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.cta-button.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
    transform: translateY(-2px);
    backdrop-filter: blur(10px);
}

/* 小笔记本适配 (1025px - 1280px) */
@media (max-width: 1280px) and (min-width: 1025px) {
    .step-modal {
        min-width: 700px;
        max-width: 88vw;
        max-height: 90vh !important;
    }

    .modal-content {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        max-height: calc(90vh - 120px) !important;
        /* 隐藏滚动条但保持滚动功能 */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .modal-content::-webkit-scrollbar {
        display: none;
    }


    .options-grid {
        grid-template-columns: repeat(2, minmax(310px, 330px));
        grid-template-rows: repeat(2, minmax(175px, 185px));
        gap: 16px;
        padding: 0 16px;
    }

    /* 三个选项时的小笔记本适配 */
    .options-grid.three-options {
        grid-template-columns: repeat(2, minmax(310px, 330px));
        grid-template-areas:
            "first second"
            "third third";
    }

    .options-grid.three-options .option-card:nth-child(3) {
        max-width: 330px;
    }

    .option-card {
        width: 100%;
        height: 100%;
    }

    .option-image {
        height: 100%;
    }
}

/* 大笔记本适配 (1281px - 1366px) */
@media (max-width: 1366px) and (min-width: 1281px) {
    .step-modal {
        min-width: 720px;
        max-width: 85vw;
        max-height: 90vh !important;
    }

    .modal-content {
        padding: 30px 20px;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        max-height: calc(90vh - 120px) !important;
        /* 隐藏滚动条但保持滚动功能 */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .modal-content::-webkit-scrollbar {
        display: none;
    }


    .options-grid {
        grid-template-columns: repeat(2, minmax(320px, 340px));
        grid-template-rows: repeat(2, minmax(180px, 190px));
        gap: 16px;
    }

    /* 三个选项时的大笔记本适配 */
    .options-grid.three-options {
        grid-template-columns: repeat(2, minmax(320px, 340px));
        grid-template-areas:
            "first second"
            "third third";
    }

    .options-grid.three-options .option-card:nth-child(3) {
        max-width: 340px;
    }

    .option-card {
        width: 100%;
        height: 100%;
    }

    .option-image {
        height: 100%;
    }
}

/* 平板横屏适配 (769px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .step-modal {
        min-width: 680px;
        max-width: 90vw;
        max-height: 90vh !important;
    }

    .modal-content {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        max-height: calc(90vh - 120px) !important;
        /* 隐藏滚动条但保持滚动功能 */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .modal-content::-webkit-scrollbar {
        display: none;
    }

    .options-grid {
        grid-template-columns: repeat(2, minmax(300px, 320px));
        grid-template-rows: repeat(2, minmax(170px, 180px));
        gap: 16px;
    }

    /* 三个选项时的平板横屏适配 */
    .options-grid.three-options {
        grid-template-columns: repeat(2, minmax(300px, 320px));
        grid-template-areas:
            "first second"
            "third third";
    }

    .options-grid.three-options .option-card:nth-child(3) {
        max-width: 320px;
    }

    .option-card {
        width: 100%;
        height: 100%;
    }

    .option-image {
        height: 100%;
    }
}

/* 手机端适配 */
@media (max-width: 768px) {
    .step-modal {
        width: calc(100vw - 40px);
        /* 全宽减去左右边距 */
        max-width: 400px;
        max-height: calc(100vh - 40px);
        /* 限制最大高度 */
        min-width: auto;
        margin: 20px auto;
        overflow: visible;
        /* 允许内容溢出到滚动区域 */
    }

    .modal-content {
        padding: 16px 16px 20px 16px;
        /* 减少padding以匹配设计图 */
        overflow-y: auto !important;
        overflow-x: hidden !important;
        max-height: calc(100vh - 100px) !important;
        /* 减少顶部空间 */
        /* 隐藏滚动条但保持滚动功能 */
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE 和 Edge */
    }

    /* 推荐模式下移除padding */
    .step-modal.recommendation-mode .modal-content {
        padding: 0 !important;
    }

    /* 隐藏 WebKit 浏览器的滚动条 */
    .modal-content::-webkit-scrollbar {
        display: none;
    }

    .options-grid {
        grid-template-columns: 1fr !important;
        grid-template-rows: repeat(4, auto);
        gap: 12px;
        justify-content: center;
        margin-bottom: 30px;
    }

    /* 三个选项时的移动端适配 - 仍使用单列布局 */
    .options-grid.three-options {
        grid-template-columns: 1fr !important;
        grid-template-rows: repeat(3, auto);
        grid-template-areas:
            "first"
            "second"
            "third";
    }

    .options-grid.three-options .option-card:nth-child(3) {
        max-width: 350px;
        width: 100%;
    }

    .option-card {
        width: 100%;
        max-width: 350px;
        height: auto;
        min-height: 170px;
        margin: 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .option-image {
        width: 100%;
        height: 170px;
        object-fit: cover;
    }

    .option-label {
        position: absolute;
        bottom: 12px;
        left: 12px;
    }

    .step-title {
        font-size: 18px;
        margin-bottom: 20px;
        text-align: center;
    }

    .next-btn {
        width: 100%;
        max-width: 350px;
        margin: 20px auto;
        display: block;
    }

    /* 推荐页面响应式 - 基础样式已移至data-view-mode属性选择器 */

    /* 产品图片容器 - 仅移动端 */
    .product-image-container {
        width: 100%;
        margin-bottom: 16px;
        border-radius: 12px;
        overflow: hidden;
    }

    .product-image {
        width: 100%;
        height: 200px;
        object-fit: cover;
        border-radius: 12px;
    }

    .recommendation-header {
        padding: 15px 20px 0;
    }

    .product-recommendation {
        padding: 15px 0 25px;
        min-height: 350px;
    }

    .product-info {
        max-width: 100%;
    }

    /* 移动端样式已移至data-view-mode属性选择器 */

    .product-name {
        font-size: 20px;
        /* 减小字体 */
        margin-bottom: 8px;
        /* 减少边距 */
    }

    .product-description {
        font-size: 14px;
        margin-bottom: 12px;
        /* 减少边距 */
    }

    .features-title {
        font-size: 16px;
        margin-bottom: 8px;
        /* 减少边距 */
    }

    .feature-text {
        font-size: 13px;
    }

    .feature-item {
        margin-bottom: 8px;
        /* 减少特性项之间的间距 */
    }

    .product-price {
        font-size: 24px;
        margin: 12px 0;
        /* 减少边距 */
        gap: 8px;
    }

    .current-price {
        font-size: 24px;
    }

    .original-price {
        font-size: 18px;
    }

    .cta-button {
        padding: 14px 20px;
        font-size: 16px;
        border-radius: 26px;
        -webkit-border-radius: 26px;
        -moz-border-radius: 26px;
        -ms-border-radius: 26px;
        -o-border-radius: 26px;
    }

    .recommendation-buttons {
        flex-direction: row;
        gap: 12px;
        margin-top: 20px;
        font-weight: 600;
    }

    .cta-button {
        width: 100%;
        text-align: center;
    }

    .cta-button.primary {
        background: #FFD700;
        color: #333;
        font-weight: 600;
    }

    .cta-button.secondary {
        background: transparent;
        color: #666;
        border: 1px solid #ccc;
    }
}