/* 案例故事左侧导航 */
.case-layout {
    display: flex;
    gap: 2rem;
    height: 100%;
    width: 100%;
    align-items: center; /* 垂直居中 */
}

.case-sidebar {
    width: 20rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding-right: 0.4rem;
    max-height: 90%;
    overflow-y: auto;
    /* 优化滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
    position: absolute;
    left: -14rem;
}

.case-sidebar::-webkit-scrollbar {
    width: 0.4rem;
}

.case-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.case-sidebar::-webkit-scrollbar-thumb {
    background-color: #e5e7eb;
    border-radius: 0.2rem;
}

.case-sidebar::-webkit-scrollbar-thumb:hover {
    background-color: #d1d5db;
}

.sidebar-items-container {
    position: relative;
    margin: auto 0;
    padding: 1.5rem 0;
}

.sidebar-vertical-line {
    position: absolute;
    left: 1.6rem;
    /* 3.2rem图标宽度的一半 */
    top: 1.5rem;
    bottom: 1.5rem;
    width: 0.2rem;
    background-color: #e5e7eb;
    transform: translateX(-50%);
    z-index: 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 0.4rem 0;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 0.8rem;
    position: relative;
    z-index: 1;
    text-decoration: none;
}

.sidebar-item.active {
    color: #1a1a1a;
    font-weight: 600;
}

.sidebar-item:hover {
    color: #23a7fd;
}

.sidebar-icon {
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sidebar-item.active .sidebar-icon {
    opacity: 1;
}

.sidebar-icon .icon-mask{
    width: 100%;
    height: 100%;
    opacity: 0.5;
    background: linear-gradient(90deg, rgba(35, 167, 253, 1) 0%, rgba(253, 26, 226, 1) 100%);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 3;
}
.sidebar-icon img {
    width: 3.2rem;
    height: 3.2rem;
    object-fit: contain;
}

.sidebar-text {
    font-size: 1.4rem;
    color: #989ea8;
    transition: color 0.3s ease;
}

.sidebar-item.active .sidebar-text {
    color: #1a1a1a;
    font-size: 2.2rem;
}

.case-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-left: 8rem;
}

/* 案例故事区域 */
.case-stories {
    padding: 6.8rem 0;
    background-color: #f7f8fb;
    height: 100vh;
}

.stories-content {
    height: calc(100vh - 7.8rem);
    display: flex;
    align-items: center;
}

/* 移动端移除固定高度限制 */
@media screen and (max-width: 1023px) {
    .case-stories {
        height: auto;
        padding: 10rem 0 6.8rem;
    }

    .stories-content {
        height: auto;
        align-items: stretch;
    }
}

.case-stories .section-title {
    font-size: 3.6rem;
    font-weight: 700;
    margin-bottom: 4rem;
    color: #333;
}

.cases-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
}

.case-card {
    background: #fff;
    border-radius: 2.4rem;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    position: relative;
}

.case-card:hover {
    transform: translateY(-1.2rem);
}

.case-image {
    width: 100%;
    height: 22rem;
    overflow: hidden;
    position: relative;
}

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

.case-content {
    padding: 2.4rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    margin-top: -2.4rem;
    border-radius: 2.4rem;
    position: relative;
    z-index: 2;
}

.case-content h3 {
    font-size: 2.4rem;
    color: #333;
    margin-bottom: 0.8rem;
    font-weight: bold;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.case-content p {
    font-size: 1.4rem;
    line-height: 1.8;
    color: #666;
    margin-bottom: 4rem;
    text-align: justify;
    flex: 1;
    opacity: 0.9;

    /* 限制显示6行 */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;

    /* 为了更好的兼容性，可以设置max-height */
    max-height: calc(1.8em * 3);
    /* 行高 * 行数 */
}

.case-footer {
    margin-top: auto;
}

.gradient-line {
    height: 0.2rem;
    width: 100%;
    background: linear-gradient(90deg, #23a7fd 0%, #fd1ae2 100%);
    margin-bottom: 2.5rem;
    border-radius: 0.1rem;
    opacity: 0.8;
}

.case-footer .case-detail {
    display: inline-flex;
    align-items: center;
    color: #8c8c8c;
    text-decoration: none;
    font-size: 1.4rem;
    transition: all 0.3s ease;
    background: #edf0f5;
    padding: 1rem 2.4rem;
    border-radius: 3rem;
    width: fit-content;
    font-weight: 500;
}

.case-detail:hover {
    color: #666;
    background: #e5e8ed;
}

.case-detail .arrow {
    margin-left: 0.8rem;
    font-size: 1.2rem;
    line-height: 1;
    font-weight: 400;
}

@media (max-width: 102.4rem) {
    .cases-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 76.8rem) {
    .cases-grid {
        grid-template-columns: 1fr;
    }
}

/* 案例容器和轨道 */
.cases-container {
    overflow: hidden;
    padding: 1.2rem 0;
}

.cases-track {
    display: flex;
    transition: transform 0.55s ease;
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

.cases-page {
    flex: 0 0 100%;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

/* 确保所有案例卡片高度一致 */
.case-card {
    height: 50rem;
}

/* 移动端移除卡片固定高度 */
@media screen and (max-width: 1023px) {
    /* 移除卡片固定高度，让内容自然决定高度 */
    .case-card {
        height: auto;
        min-height: 35rem;
    }

    /* 调整案例卡片内容区域 */
    .case-content {
        margin-top: -2rem;
    }

    /* 调整案例图片高度 */
    .case-image {
        height: 20rem;
    }
}

/* 分页样式已在 styles.css 统一定义 */
.pagination {
    margin-top: 6rem;
}

/* 移动端分页器响应式调整 */
@media screen and (max-width: 767px) {
    .pagination {
        margin-top: 4rem;
        gap: 1.5rem;
        padding: 0 1rem;
    }

    /* 调整分页数字大小和间距 */
    .pagination-number {
        font-size: 2rem;
    }

    .pagination-number a {
        line-height: 3.5rem;
        padding: 0 1.2rem;
        font-size: 2rem;
    }

    /* 减少分页器整体大小 */
    .pagination {
    }
}

/* 小屏手机调整 */
@media screen and (max-width: 479px) {
    .pagination {
        margin-top: 3.5rem;
        gap: 1.2rem;
    }

    .pagination-number a {
        line-height: 3.2rem;
        padding: 0 1rem;
        font-size: 2rem;
    }
}

/* 移动端响应式样式 */
@media screen and (max-width: 1023px) {
    /* 改变布局为垂直方向，导航栏在上，内容在下 */
    .case-layout {
        flex-direction: column;
        align-items: stretch;
        gap: 3rem;
    }

    /* 将左侧导航栏改为顶部横向滚动导航 */
    .case-sidebar {
        width: 100%;
        max-height: auto;
        overflow-y: visible;
        overflow-x: auto;
        padding-right: 0;
        padding-bottom: 1rem;
        position: relative;
        overflow: visible;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* 添加左右边缘阴影效果，提示可滚动 */
    .case-sidebar::before,
    .case-sidebar::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 3rem;
        z-index: 1;
        pointer-events: none;
    }

    /* 左侧阴影 - 默认隐藏 */
    .case-sidebar::before {
        left: 0;
        background: linear-gradient(to right, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0));
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    /* 右侧阴影 - 默认隐藏 */
    .case-sidebar::after {
        right: 0;
        background: linear-gradient(to left, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0));
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    /* 显示左侧阴影 */
    .case-sidebar.show-left-shadow::before {
        opacity: 1;
    }

    /* 显示右侧阴影 */
    .case-sidebar.show-right-shadow::after {
        opacity: 1;
    }

    /* 隐藏竖线 */
    .sidebar-vertical-line {
        display: none;
    }

    /* 改变侧边栏容器为横向布局 */
    .sidebar-items-container {
        display: flex;
        flex-direction: row;
        padding: 1rem 0;
        gap: 1.5rem;
        overflow-x: auto;
        scrollbar-width: none; /* 隐藏滚动条 */
        -ms-overflow-style: none; /* IE and Edge */
    }

    .sidebar-items-container::-webkit-scrollbar {
        display: none; /* Chrome, Safari and Opera */
    }

    /* 调整侧边栏项目样式 */
    .sidebar-item {
        flex-direction: column;
        justify-content: center;
        gap: 0.5rem;
        padding: 1rem;
        background: #fff;
        border-radius: 1.2rem;
        min-width: 8rem;
        text-align: center;
    }

    /* 激活状态样式 */
    .sidebar-item.active {
        background: linear-gradient(135deg, #23a7fd 0%, #fd1ae2 100%);
    }

    .sidebar-item.active .sidebar-text {
        color: #fff;
        font-size: 1.4rem;
    }

    /* 图标样式 */
    .sidebar-icon {
        opacity: 1 !important;
        width: 4rem;
        height: 4rem;
    }

    .sidebar-icon img{
        width: 100%;
        height: 100%;
    }

    /* 文本样式 */
    .sidebar-text {
        font-size: 1.6rem;
    }

    /* 内容区域调整 */
    .case-content-area {
        flex: 1;
        overflow-y: auto;
    }
}

/* 响应式调整 */
@media (max-width: 102.4rem) {
    .cases-page {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 76.8rem) {
    .cases-page {
        grid-template-columns: 1fr;
    }
    .case-content-area {
        margin-left: 0;
    }
    .case-sidebar{
        left: 0;
    }
    .icon-mask-active{
        display: none;
    }
}

/* 平板和手机端调整 */
@media (max-width: 767px) {
    .cases-page {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    /* 卡片宽度调整 */
    .case-card {
        width: 100%;
        max-width: 100%;
    }

    /* 调整案例卡片内容 */
    .case-content {
        padding: 2.8rem;
        margin-top: -3rem;
    }

    .case-content h3 {
        font-size: 2rem;
    }

    .case-content p {
        font-size: 1.3rem;
        -webkit-line-clamp: 4;
        max-height: calc(1.8em * 4);
    }
}

/* 小屏手机调整 */
@media (max-width: 479px) {
    .cases-page {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .case-image {
        height: 24rem;
    }

    .case-content h3 {
        font-size: 2.4rem;
        margin-bottom: 1.2rem;
    }

    .case-content p {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }
}

/* 完善移动端样式细节 */
@media screen and (max-width: 1023px) {
    /* 调整容器padding */
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    /* 调整案例卡片悬停效果 */
    .case-card:hover {
        transform: translateY(-0.8rem);
    }

    /* 调整渐变线 */
    .gradient-line {
        margin-bottom: 2rem;
    }

    /* 调整详情按钮 */
    .case-footer .case-detail {
        padding: 0.8rem 2rem;
        font-size: 1.8rem;
    }
    .case-footer .case-detail .arrow{
        font-size: 1.8rem;
    }
    /* 调整案例轨道容器 */
    .cases-container {
        padding: 0.8rem 0;
    }
}

/* 平板设备优化 */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    /* 调整案例卡片网格 */
    .cases-page {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
        padding: 0 2rem;
    }

    /* 调整案例图片高度 */
    .case-image {
        height: 18rem;
    }

    /* 调整案例内容 */
    .case-content h3 {
        font-size: 2rem;
    }

    .case-content p {
        -webkit-line-clamp: 3;
        max-height: calc(1.8em * 3);
    }
    .case-content-area {
        margin-left: 0;
    }
    .case-sidebar{
        left: 0;
    }
    .icon-mask-active{
        display: none;
    }
}
