/* ========================================
   Testimonial Slider Widget - CSS Styles
   ======================================== */

/* 主容器 */
.tsw-slider-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden; /* 保持 hidden 防止右侧卡片溢出 */
    box-sizing: border-box;
}

.tsw-slider-container {
    width: 100%;
    overflow: visible; /* 改为 visible 让头像可以溢出到 padding 区域 */
    padding: 55px 0px;
}

.tsw-slider-track {
    display: flex;
    gap: 30px;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    padding: 0 60px; /* 将 padding 移到这里 */
    margin: 0 -60px; /* 用负 margin 抵消外层的 padding */
}

.tsw-slide {
    flex: 0 0 calc(33.333% - 20px);
    box-sizing: border-box;
    overflow: visible; /* 允许头像溢出 */
}

/* 卡片样式 */
.tsw-card {
    background-color: #fdf6dc;
    width: 100%;
    height: 350px;
    position: relative;
    border-radius: 4px;
    overflow: visible;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tsw-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* 评分条 */
.tsw-rating-bar {
    background-color: #ffbd29;
    height: 80px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 40px;
    box-sizing: border-box;
    border-top-right-radius: 4px;
}

/* 星星样式 */
.tsw-star {
    color: #ffffff;
    font-size: 40px;
    margin: 0 5px;
    position: relative;
    top: -2px;
    transition: transform 0.2s ease;
}

.tsw-star-empty {
    opacity: 0.3;
}

.tsw-card:hover .tsw-star {
    transform: scale(1.1);
}

/* 头像容器 */
.tsw-avatar-container {
    width: 120px;
    height: 120px;
    background-color: #ffbd29;
    border-radius: 50%;
    position: absolute;
    top: -30px;
    left: -30px;
    border: 8px solid #fdf6dc;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    overflow: hidden;
    z-index: 10;
    transition: transform 0.3s ease;
}

.tsw-card:hover .tsw-avatar-container {
    transform: scale(1.05);
}

/* 自定义头像图片 */
.tsw-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* 默认用户图标 */
.tsw-user-head {
    width: 40px;
    height: 40px;
    background-color: #3b4cca;
    border-radius: 50%;
    margin-bottom: 5px;
}

.tsw-user-body {
    width: 80px;
    height: 45px;
    background-color: #3b4cca;
    border-top-left-radius: 50px;
    border-top-right-radius: 50px;
}

/* 内容区域 */
.tsw-content {
    padding: 30px 30px 20px;
    height: calc(100% - 80px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tsw-customer-name {
    font-size: 24px;
    font-weight: bold;
    color: #333333;
    margin: 0 0 10px 0;
    text-align: left;
}

.tsw-testimonial-title {
    font-size: 18px;
    font-weight: 600;
    color: #555555;
    margin: 0 0 10px 0;
    text-align: left;
    font-style: italic;
}

.tsw-testimonial-text {
    font-size: 16px;
    line-height: 1.6;
    color: #666666;
    margin: 0;
    overflow-y: auto;
    flex: 1;
    text-align: left;
}

/* 导航按钮 */
.tsw-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 189, 41, 0.9);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 30px;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.tsw-nav:hover {
    background-color: rgba(255, 189, 41, 1);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.tsw-nav-prev {
    left: 10px;
}

.tsw-nav-next {
    right: 10px;
}

/* 指示器 */
.tsw-dots {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 100;
}

.tsw-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 189, 41, 0.3);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.tsw-dot:hover {
    background-color: rgba(255, 189, 41, 0.6);
    transform: scale(1.2);
}

.tsw-dot.active {
    background-color: #ffbd29;
    transform: scale(1.3);
}

/* ========================================
   响应式设计
   ======================================== */

/* 平板设备 (iPad) - 显示2张卡片 */
@media (max-width: 1024px) {
    .tsw-slider-track {
        padding: 0;
        margin: 0;
        gap: 0; /* 移除 gap */
    }

    .tsw-slide {
        flex: 0 0 50%;
        padding: 0 50px; /* 将 padding 移到 slide 上 */
    }

    .tsw-card {
        height: 320px;
    }

    .tsw-rating-bar {
        height: 70px;
        padding-right: 30px;
    }

    .tsw-star {
        font-size: 35px;
        margin: 0 4px;
    }

    .tsw-content {
        padding: 25px 25px 15px;
    }

    .tsw-customer-name {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .tsw-testimonial-title {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .tsw-testimonial-text {
        font-size: 14px;
    }
}

/* 手机设备 - 显示1张卡片 */
@media (max-width: 768px) {
    .tsw-slider-track {
        padding: 0;
        margin: 0;
        gap: 0; /* 移除 gap */
    }

    .tsw-slide {
        flex: 0 0 100%;
        padding: 0 40px; /* 将 padding 移到 slide 上 */
    }

    .tsw-card {
        height: 300px;
    }

    .tsw-rating-bar {
        height: 60px;
        padding-right: 20px;
    }

    .tsw-star {
        font-size: 28px;
        margin: 0 3px;
    }

    .tsw-content {
        padding: 20px 20px 15px;
    }

    .tsw-customer-name {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .tsw-testimonial-title {
        font-size: 15px;
        margin-bottom: 8px;
    }

    .tsw-testimonial-text {
        font-size: 13px;
        line-height: 1.5;
    }
}

/* 小屏手机 */
@media (max-width: 480px) {
    .tsw-slide {
        padding: 0 30px; /* 调整小屏手机的 padding */
    }

    .tsw-card {
        height: 280px;
    }

    .tsw-rating-bar {
        height: 55px;
        padding-right: 15px;
    }

    .tsw-star {
        font-size: 24px;
        margin: 0 2px;
    }

    .tsw-content {
        padding: 18px 18px 12px;
    }

    .tsw-customer-name {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .tsw-testimonial-title {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .tsw-testimonial-text {
        font-size: 12px;
    }
}

/* 平滑滚动条样式 */
.tsw-testimonial-text::-webkit-scrollbar {
    width: 6px;
}

.tsw-testimonial-text::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.tsw-testimonial-text::-webkit-scrollbar-thumb {
    background: rgba(255, 189, 41, 0.5);
    border-radius: 3px;
}

.tsw-testimonial-text::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 189, 41, 0.7);
}

/* 动画效果 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.tsw-slide {
    animation: slideIn 0.5s ease-out;
}

/* 无障碍支持 */
.tsw-nav:focus,
.tsw-dot:focus {
    outline: none; /* 移除默认轮廓 */
}

.tsw-nav:focus-visible,
.tsw-dot:focus-visible {
    outline: 2px solid currentColor; /* 使用按钮当前的颜色 */
    outline-offset: 2px;
}

/* 打印样式 */
@media print {
    .tsw-nav,
    .tsw-dots {
        display: none;
    }

    .tsw-slider-track {
        flex-wrap: wrap;
    }

    .tsw-slide {
        flex: 0 0 50%;
        page-break-inside: avoid;
    }
}
