/**
 * Product Visualization - Floating Tab & Teaser Styles
 * Floating side tab, teaser animation
 */

/* =============================================
   BEFORE/AFTER TEASER ANIMATION
   ============================================= */
.pv-teaser-container {
    position: relative;
    margin-bottom: 12px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid transparent;
    animation: pvTeaserBorderPulse 5s ease-in-out infinite;
}

.pv-teaser-container:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.pv-teaser-animation {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 240px;
    overflow: hidden;
    background: var(--pv-gray-900);
}

/* Both images fill the container */
.pv-teaser-before,
.pv-teaser-after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Before image - always visible as base */
.pv-teaser-before {
    z-index: 1;
}

/* After image - clips from right to left, then back */
.pv-teaser-after {
    z-index: 2;
    clip-path: inset(0 100% 0 0);
    animation: pvTeaserReveal 5s ease-in-out infinite;
}

@keyframes pvTeaserReveal {
    0%, 12% {
        clip-path: inset(0 100% 0 0);
    }
    38%, 62% {
        clip-path: inset(0 0 0 0);
    }
    88%, 100% {
        clip-path: inset(0 100% 0 0);
    }
}

/* ===== Animated Divider Line ===== */
.pv-teaser-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--pv-white);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.9), 0 0 30px rgba(255, 255, 255, 0.5);
    z-index: 10;
    left: 0%;
    animation: pvTeaserDivider 5s ease-in-out infinite;
}

.pv-teaser-divider::before,
.pv-teaser-divider::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-style: solid;
}

.pv-teaser-divider::before {
    top: 50%;
    margin-top: -30px;
    border-width: 0 8px 10px 8px;
    border-color: transparent transparent var(--pv-white) transparent;
}

.pv-teaser-divider::after {
    top: 50%;
    margin-top: 20px;
    border-width: 10px 8px 0 8px;
    border-color: var(--pv-white) transparent transparent transparent;
}

@keyframes pvTeaserDivider {
    0%, 12% {
        left: 0%;
        opacity: 0;
    }
    18% {
        opacity: 1;
    }
    38%, 62% {
        left: 100%;
        opacity: 1;
    }
    82% {
        opacity: 1;
    }
    88%, 100% {
        left: 0%;
        opacity: 0;
    }
}

/* ===== Teaser Labels ===== */
.pv-teaser-label {
    position: absolute;
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    color: var(--pv-white);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--pv-radius);
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.pv-teaser-label i {
    font-size: 0.9rem;
}

.pv-teaser-label-before {
    top: 12px;
    left: 12px;
    animation: pvTeaserLabelBefore 5s ease-in-out infinite;
}

.pv-teaser-label-after {
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--pv-primary) 0%, #e01020 100%);
    box-shadow: 0 2px 15px var(--pv-primary-shadow);
    animation: pvTeaserLabelAfter 5s ease-in-out infinite;
}

@keyframes pvTeaserLabelBefore {
    0%, 32% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    42%, 58% {
        opacity: 0;
        transform: translateY(-8px) scale(0.95);
    }
    68%, 100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pvTeaserLabelAfter {
    0%, 32% {
        opacity: 0;
        transform: translateY(-8px) scale(0.95);
    }
    42%, 58% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    68%, 100% {
        opacity: 0;
        transform: translateY(-8px) scale(0.95);
    }
}

/* ===== Floating Product Badge ===== */
.pv-teaser-product {
    position: absolute;
    top: 50%;
    left: 15%;
    transform: translate(-50%, -50%);
    width: 90px;
    height: 90px;
    background: var(--pv-white);
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    z-index: 20;
    animation: pvTeaserProduct 5s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pv-teaser-product img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pv-teaser-product-label {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--pv-primary);
    color: var(--pv-white);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--pv-radius-sm);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes pvTeaserProduct {
    0%, 8% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.6);
    }
    22%, 78% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    92%, 100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.6);
    }
}

@keyframes pvTeaserBorderPulse {
    0%, 32%, 68%, 100% {
        border-color: transparent;
    }
    50% {
        border-color: var(--pv-primary);
    }
}

/* ===== CTA Hint ===== */
.pv-teaser-cta {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    padding: 30px 12px 10px;
    text-align: center;
    z-index: 5;
}

.pv-teaser-cta span {
    color: var(--pv-white);
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.9;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.pv-teaser-cta i {
    animation: pvTeaserCtaPulse 1.5s ease-in-out infinite;
}

@keyframes pvTeaserCtaPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* =============================================
   FLOATING SIDE TAB
   ============================================= */
.pv-floating-tab {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%) translateX(100%);
    z-index: 1040;
    background: linear-gradient(135deg, var(--pv-primary) 0%, #a0000c 100%);
    color: var(--pv-white);
    padding: 0;
    border-radius: var(--pv-radius-xl) 0 0 var(--pv-radius-xl);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, opacity 0.3s ease, visibility 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.pv-floating-tab.visible {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.pv-floating-tab:hover {
    box-shadow: -6px 0 30px rgba(0, 0, 0, 0.35);
}

.pv-floating-tab-header {
    background: rgba(0, 0, 0, 0.15);
    padding: 10px 14px;
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pv-floating-tab-content {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.pv-floating-tab-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: var(--pv-radius);
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.2);
}

.pv-floating-tab-icon {
    font-size: 1.8rem;
    opacity: 0.9;
}

.pv-floating-tab-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 8px 0;
    letter-spacing: 0.5px;
}

.pv-floating-tab-badge {
    background: var(--pv-white);
    color: var(--pv-primary);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* ===== Loading Indicator ===== */
.pv-floating-tab-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
}

.pv-floating-tab-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--pv-white);
    border-radius: 50%;
    animation: pvFloatingSpinner 0.8s linear infinite;
}

@keyframes pvFloatingSpinner {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Stacked Thumbnails ===== */
.pv-floating-tab-stack {
    position: relative;
    width: 60px;
    height: 60px;
    display: none;
}

.pv-floating-tab-stack.show {
    display: block;
}

.pv-floating-tab-stack img {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.2);
}

.pv-floating-tab-stack img:nth-child(1) {
    top: 0;
    left: 0;
    z-index: 3;
    transform: rotate(-5deg);
}

.pv-floating-tab-stack img:nth-child(2) {
    top: 4px;
    left: 6px;
    z-index: 2;
    transform: rotate(3deg);
}

.pv-floating-tab-stack img:nth-child(3) {
    top: 8px;
    left: 2px;
    z-index: 1;
    transform: rotate(-2deg);
    opacity: 0.7;
}

/* ===== Mobile Teaser ===== */
@media (max-width: 576px) {
    .pv-teaser-animation {
        aspect-ratio: 16 / 9;
        max-height: 200px;
    }

    .pv-teaser-label {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    .pv-teaser-label i {
        font-size: 0.8rem;
    }

    .pv-teaser-product {
        width: 65px;
        height: 65px;
        padding: 5px;
        left: 18%;
    }

    .pv-teaser-product-label {
        font-size: 0.5rem;
        padding: 2px 6px;
    }

    .pv-teaser-cta {
        padding: 24px 10px 8px;
    }

    .pv-teaser-cta span {
        font-size: 0.65rem;
    }
}

/* ===== Mobile Floating Tab ===== */
@media (max-width: 768px) {
    .pv-floating-tab {
        top: auto;
        bottom: 100px;
        transform: translateY(0) translateX(100%);
        border-radius: 10px 0 0 10px;
    }

    .pv-floating-tab.visible {
        transform: translateY(0) translateX(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .pv-floating-tab-header {
        padding: 8px 10px;
        font-size: 0.6rem;
    }

    .pv-floating-tab-content {
        padding: 10px 12px;
    }

    .pv-floating-tab-thumbnail {
        width: 50px;
        height: 50px;
    }

    .pv-floating-tab-icon {
        font-size: 1.5rem;
    }

    .pv-floating-tab-stack {
        width: 50px;
        height: 50px;
    }

    .pv-floating-tab-stack img {
        width: 40px;
        height: 40px;
    }
}
