/**
 * TrustyGEO Product Carousel - 轮播样式
 */

/* 轮播容器 */
.tgp-carousel {
    position: relative;
    margin: 0 auto;
    padding: 0 50px;
    width: 100%;
    box-sizing: border-box;
}

/* 轨道容器 */
.tgp-carousel-track {
    overflow: hidden;
    border-radius: 12px;
    width: 100%;
}

/* 幻灯片容器 */
.tgp-carousel-slides {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    touch-action: pan-y pinch-zoom;
    cursor: grab;
    user-select: none;
}

.tgp-carousel-slides.dragging {
    cursor: grabbing;
}

.tgp-carousel-slides.dragging img {
    pointer-events: none;
}

/* 单个幻灯片 */
.tgp-carousel-slide {
    flex-shrink: 0;
    padding: 10px;
    box-sizing: border-box;
}

/* 产品卡片 */
.tgp-carousel-item {
    display: block;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tgp-carousel-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* 图片容器 */
.tgp-carousel-image {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.tgp-carousel-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.tgp-carousel-item:hover .tgp-carousel-image img {
    transform: scale(1.08);
}

/* 内容区域 */
.tgp-carousel-content {
    padding: 16px;
    background: #fff;
}

.tgp-carousel-title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: #1a1a1a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 价格样式 */
.tgp-carousel-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.tgp-price-sale {
    font-size: 18px;
    font-weight: 700;
    color: #e8565e;
}

.tgp-price-original {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
}

.tgp-price-regular {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

/* 箭头按钮 */
.tgp-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
    opacity: 0;
}

.tgp-carousel:hover .tgp-carousel-arrow {
    opacity: 1;
}

.tgp-carousel-arrow:hover {
    background: #fff;
    color: #e8565e;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

.tgp-carousel-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.tgp-carousel-prev {
    left: 0;
}

.tgp-carousel-next {
    right: 0;
}

.tgp-carousel-arrow svg {
    width: 20px;
    height: 20px;
}

/* 分页指示器 */
.tgp-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: -50px;
    padding: 0;
}

.tgp-carousel-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 1px solid #333;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.tgp-carousel-dot:hover {
    border-color: #000;
}

.tgp-carousel-dot.active {
    width: 8px;
    height: 8px;
    border: none;
    border-radius: 50%;
    background: #000;
}

/* 空状态 */
.tgp-carousel-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #f9f9f9;
    border-radius: 12px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .tgp-carousel {
        padding: 0 40px;
    }
}

@media (max-width: 768px) {
    .tgp-carousel {
        padding: 0 30px;
        padding-bottom: 40px;
    }

    .tgp-carousel-arrow {
        width: 36px;
        height: 36px;
        opacity: 1;
    }

    .tgp-carousel-arrow svg {
        width: 16px;
        height: 16px;
    }

    .tgp-carousel-title {
        font-size: 13px;
    }

    .tgp-price-sale {
        font-size: 16px;
    }

    .tgp-carousel-content {
        padding: 12px;
    }

    .tgp-carousel-dots {
        margin-top: 10px !important;
    }

    /* 移动端幻灯片宽度由 JS 控制，移除 min-width 限制 */
    .tgp-carousel-slide {
        min-width: 0 !important;
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .tgp-carousel {
        padding: 0 10px;
    }

    .tgp-carousel-arrow {
        width: 32px;
        height: 32px;
    }

    .tgp-carousel-slide {
        padding: 6px;
        min-width: 0 !important;
        width: 100% !important;
    }

    .tgp-carousel-item {
        border-radius: 8px;
    }

    .tgp-carousel-image {
        border-radius: 8px 8px 0 0;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .tgp-carousel-item {
        background: #1f1f1f;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    }

    .tgp-carousel-item:hover {
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    }

    .tgp-carousel-content {
        background: #1f1f1f;
    }

    .tgp-carousel-title {
        color: #f0f0f0;
    }

    .tgp-price-regular {
        color: #f0f0f0;
    }

    .tgp-carousel-arrow {
        background: rgba(30, 30, 30, 0.95);
        color: #f0f0f0;
    }

    .tgp-carousel-arrow:hover {
        background: #2a2a2a;
    }

    .tgp-carousel-dot {
        border-color: #f0f0f0;
    }

    .tgp-carousel-dot:hover {
        border-color: #fff;
    }

    .tgp-carousel-dot.active {
        background: #fff;
    }

    .tgp-carousel-image {
        background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
    }
}

/* 无障碍优化 */
.tgp-carousel-arrow:focus {
    outline: 2px solid #e8565e;
    outline-offset: 2px;
}

.tgp-carousel-dot:focus {
    outline: none;
}

/* ========================================
   轮播包装器样式
======================================== */
.tgp-carousel-wrapper {
    width: 100%;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* 轮播标题 - 在轮播容器正上方 */
.tgp-carousel-header {
    position: relative;
    z-index: 2;
    padding: 30px 50px 40px;
    text-align: center;
    background: transparent;
}

.tgp-carousel-header .tgp-carousel-title {
    margin: 0;
    padding: 0;
    font-size: 28px;
    font-weight: 500;
    color: #1a1a1a;
    letter-spacing: 1px;
    line-height: 1.3;
}

/* 有背景图时标题样式 */
.tgp-carousel-wrapper.has-bg-image .tgp-carousel-header {
    padding-top: 40px;
}

.tgp-carousel-wrapper.has-bg-image .tgp-carousel-title {
    color: #ffffff;
}

.tgp-carousel-wrapper.has-bg-image .tgp-carousel {
    position: relative;
    z-index: 2;
}

.tgp-carousel-wrapper.has-title .tgp-carousel {
    padding-top: 0;
}

/* 深色模式下的标题 */
@media (prefers-color-scheme: dark) {
    .tgp-carousel-header .tgp-carousel-title {
        color: #f0f0f0;
    }
    
    .tgp-carousel-wrapper.has-bg-image .tgp-carousel-title {
        color: #ffffff;
    }
}
