/* ==========================================
   VOCALX - PAGE TRANSITION STYLES
   Smart Context-Aware Loading Animations
   ========================================== */

/* Transition Overlay */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.1s ease;
    --transition-color: #0071e3;
}

.page-transition-overlay.active {
    pointer-events: all;
    opacity: 1;
    visibility: visible;
}

/* Transition Content */
.transition-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    z-index: 2;
    transform: translateY(100vh);
    opacity: 0;
}

.page-transition-overlay.active .transition-content {
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.page-transition-overlay.active.reverse .transition-content {
    animation: slideDown 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
    0% {
        transform: translateY(100vh);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh);
        opacity: 0;
    }
}

/* Icon Container */
.transition-icon-container {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.transition-icon {
    width: 80px;
    height: 80px;
    color: white;
    z-index: 2;
    animation: iconPulse 1.5s ease-in-out infinite;
}

.transition-icon-svg {
    width: 100%;
    height: 100%;
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Animated Rings */
.transition-icon-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: ringExpand 2s ease-out infinite;
}

.transition-icon-ring.ring-2 {
    animation-delay: 0.4s;
}

.transition-icon-ring.ring-3 {
    animation-delay: 0.8s;
}

@keyframes ringExpand {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* Text Styles */
.transition-text {
    text-align: center;
    color: white;
}

.transition-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    animation: textFadeIn 0.8s ease forwards 0.3s;
    opacity: 0;
}

.transition-subtitle {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    font-weight: 400;
    opacity: 0;
    animation: textFadeIn 0.8s ease forwards 0.5s;
}

@keyframes textFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 0.8;
        transform: translateY(0);
    }
}

/* Loader Dots */
.transition-loader {
    margin-top: 1rem;
}

.loader-dots {
    display: flex;
    gap: 8px;
}

.loader-dots span {
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
}

.loader-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loader-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loader-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Wave Effect */
.transition-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 150px;
    overflow: hidden;
}

.transition-wave svg {
    width: 200%;
    height: 100%;
    animation: waveMove 3s linear infinite;
}

.transition-wave path {
    fill: rgba(255, 255, 255, 0.1);
}

@keyframes waveMove {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* ==========================================
   INTERACTIVE BEFORE/AFTER COMPARISON
   ========================================== */

/* Comparison Slider */
.comparison-slider {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    user-select: none;
    cursor: ew-resize;
}

.comparison-item {
    position: relative;
    width: 100%;
}

.comparison-before,
.comparison-after {
    width: 100%;
}

.comparison-before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.comparison-after {
    display: block;
}

.comparison-before img,
.comparison-after img {
    width: 100%;
    height: auto;
    display: block;
}

.comparison-before img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Comparison Handle */
.comparison-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, #0071e3 0%, #00d4aa 100%);
    cursor: ew-resize;
    z-index: 10;
    left: 50%;
    transform: translateX(-50%);
}

.comparison-handle::before,
.comparison-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #0071e3 0%, #00d4aa 100%);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0, 113, 227, 0.4);
}

.comparison-handle::before {
    top: 50%;
    transform: translate(-50%, -50%);
}

.comparison-handle::after {
    display: none;
}

.comparison-handle-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 11;
}

.comparison-handle-circle svg {
    width: 24px;
    height: 24px;
    color: #0071e3;
}

/* Labels */
.comparison-label {
    position: absolute;
    top: 20px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    z-index: 5;
}

.comparison-label.before-label {
    left: 20px;
    background: rgba(255, 100, 100, 0.9);
}

.comparison-label.after-label {
    right: 20px;
    background: rgba(0, 212, 170, 0.9);
}

/* ==========================================
   FLIP CARD REVEAL
   ========================================== */

.flip-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.flip-card {
    perspective: 1000px;
    height: 350px;
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner,
.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.flip-card-front {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.flip-card-front h3 {
    font-size: 1.3rem;
    color: #1d1d1f;
    margin-top: 1rem;
}

.flip-card-front p {
    color: #86868b;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.flip-card-front .flip-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 100, 100, 0.1);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flip-card-front .flip-icon svg {
    width: 40px;
    height: 40px;
    color: #ff6464;
}

.flip-card-back {
    background: linear-gradient(135deg, #0071e3 0%, #00d4aa 100%);
    transform: rotateY(180deg);
    color: white;
}

.flip-card-back h3 {
    font-size: 1.3rem;
    margin-top: 1rem;
}

.flip-card-back p {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    opacity: 0.9;
}

.flip-card-back .flip-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flip-card-back .flip-icon svg {
    width: 40px;
    height: 40px;
    color: white;
}

.flip-hint {
    position: absolute;
    bottom: 15px;
    font-size: 0.75rem;
    opacity: 0.6;
}

/* ==========================================
   REVEAL ON SCROLL ANIMATIONS
   ========================================== */

.reveal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.reveal-stat {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.4s ease;
}

.reveal-stat:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.reveal-stat .stat-number {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #0071e3 0%, #00d4aa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.reveal-stat .stat-label {
    font-size: 0.9rem;
    color: #86868b;
    margin-top: 0.5rem;
}

/* Progress Bars */
.progress-comparison {
    max-width: 600px;
    margin: 0 auto;
}

.progress-item {
    margin-bottom: 2rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.progress-label {
    font-weight: 600;
    color: #1d1d1f;
}

.progress-value {
    color: #0071e3;
    font-weight: 700;
}

.progress-bar {
    height: 12px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6464 0%, #ff8080 100%);
    border-radius: 10px;
    width: 0;
    transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-fill.positive {
    background: linear-gradient(90deg, #0071e3 0%, #00d4aa 100%);
}

.progress-item.animated .progress-fill {
    width: var(--progress-width, 0);
}

/* ==========================================
   INTERACTIVE DEMO PHONE
   ========================================== */

.demo-phone-container {
    display: flex;
    justify-content: center;
    padding: 3rem 0;
}

.demo-phone {
    width: 300px;
    height: 600px;
    background: #1d1d1f;
    border-radius: 40px;
    padding: 15px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
    position: relative;
}

.demo-phone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 30px;
    background: #1d1d1f;
    border-radius: 0 0 20px 20px;
    z-index: 10;
}

.demo-phone-screen {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #f5f5f7 0%, #ffffff 100%);
    border-radius: 28px;
    overflow: hidden;
    position: relative;
}

.demo-call-ui {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 3rem 1.5rem 2rem;
}

.demo-call-status {
    text-align: center;
    padding: 1rem 0;
}

.demo-call-avatar {
    width: 100px;
    height: 100px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #0071e3 0%, #00d4aa 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: avatarPulse 2s ease-in-out infinite;
}

@keyframes avatarPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 113, 227, 0.4);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(0, 113, 227, 0);
    }
}

.demo-call-avatar svg {
    width: 50px;
    height: 50px;
    color: white;
}

.demo-call-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1d1d1f;
}

.demo-call-time {
    font-size: 0.9rem;
    color: #86868b;
    margin-top: 0.25rem;
}

.demo-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 60px;
    margin: 2rem 0;
}

.demo-wave-bar {
    width: 4px;
    background: linear-gradient(180deg, #0071e3 0%, #00d4aa 100%);
    border-radius: 2px;
    animation: waveBar 1s ease-in-out infinite;
}

.demo-wave-bar:nth-child(1) { height: 20px; animation-delay: 0s; }
.demo-wave-bar:nth-child(2) { height: 35px; animation-delay: 0.1s; }
.demo-wave-bar:nth-child(3) { height: 25px; animation-delay: 0.2s; }
.demo-wave-bar:nth-child(4) { height: 40px; animation-delay: 0.3s; }
.demo-wave-bar:nth-child(5) { height: 30px; animation-delay: 0.4s; }
.demo-wave-bar:nth-child(6) { height: 45px; animation-delay: 0.5s; }
.demo-wave-bar:nth-child(7) { height: 25px; animation-delay: 0.6s; }

@keyframes waveBar {
    0%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(0.5);
    }
}

.demo-transcript {
    flex: 1;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 16px;
    padding: 1rem;
    overflow-y: auto;
}

.demo-message {
    margin-bottom: 1rem;
    animation: messageSlide 0.5s ease forwards;
    opacity: 0;
}

.demo-message.visible {
    opacity: 1;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.demo-message-ai {
    background: linear-gradient(135deg, #0071e3 0%, #00d4aa 100%);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 16px 16px 16px 4px;
    font-size: 0.85rem;
    max-width: 85%;
}

.demo-message-customer {
    background: #e9ecef;
    color: #1d1d1f;
    padding: 0.75rem 1rem;
    border-radius: 16px 16px 4px 16px;
    font-size: 0.85rem;
    max-width: 85%;
    margin-left: auto;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .comparison-slider {
        border-radius: 12px;
    }
    
    .comparison-label {
        font-size: 0.75rem;
        padding: 6px 12px;
    }
    
    .flip-card {
        height: 300px;
    }
    
    .demo-phone {
        width: 260px;
        height: 520px;
    }
    
    .transition-icon-container {
        width: 120px;
        height: 120px;
    }
    
    .transition-icon {
        width: 60px;
        height: 60px;
    }
}
