/* ==========================================================================
   Process Steps Widget - CSS
   ========================================================================== */

/* CSS Variables */
:root {
    --ps-bg-dark: #0a0a0a;
    --ps-bg-card: #1c1c1c;
    --ps-text-primary: #f5f5f5;
    --ps-text-secondary: #d1d1d1;
    --ps-border: #525252;
    --ps-accent-pink: #fa5fb4;
    --ps-accent-green: #33d478;
    --ps-shadow-soft: 0 0.84px 0.5px rgba(0,0,0,0.06),
                      0 2px 1.2px rgba(0,0,0,0.06),
                      0 3.6px 2.2px rgba(0,0,0,0.06),
                      0 6px 3.6px rgba(0,0,0,0.06),
                      0 9.7px 5.8px rgba(0,0,0,0.06),
                      0 16px 9.6px rgba(0,0,0,0.06),
                      0 27.5px 16.5px rgba(0,0,0,0.06),
                      0 50px 30px rgba(0,0,0,0.06);
}

/* Section */
.ps-section {
    background-color: var(--ps-bg-dark);
    padding: 80px 20px;
}

.ps-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.ps-header {
    text-align: center;
    margin-bottom: 60px;
}

.ps-tag {
    display: inline-block;
    padding: 8px 20px;
    border: 1px solid var(--ps-border);
    border-radius: 28px;
    color: var(--ps-accent-pink);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.02em;
    margin-bottom: 24px;
}

.ps-title {
    color: var(--ps-text-primary);
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 600;
    line-height: 1.2;
    margin: 0 auto 20px;
    max-width: 700px;
    letter-spacing: -0.02em;
}

.ps-description {
    color: var(--ps-text-secondary);
    font-size: clamp(16px, 2vw, 18px);
    line-height: 1.6;
    margin: 0 auto;
    max-width: 600px;
}

/* Steps Grid */
.ps-steps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* Step Card */
.ps-step {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ps-step-label {
    display: inline-flex;
    align-self: flex-start;
    padding: 8px 16px;
    border: 1px solid var(--ps-border);
    border-radius: 28px;
    color: var(--ps-accent-pink);
    font-size: 13px;
    font-weight: 500;
}

/* Step Visual Container */
.ps-step-visual {
    position: relative;
    height: 220px;
    background-color: var(--ps-bg-card);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--ps-shadow-soft);
}

/* Step Content */
.ps-step-content {
    padding: 0 4px;
}

.ps-step-title {
    color: var(--ps-text-primary);
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
}

.ps-step-desc {
    color: var(--ps-text-secondary);
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
}

/* ==========================================================================
   Visual Type: Videos
   ========================================================================== */
.ps-videos-container {
    display: flex;
    gap: 12px;
    padding: 20px;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.ps-video {
    width: calc(50% - 6px);
    height: 100%;
    border-radius: 22px;
    object-fit: cover;
    background-color: #000;
}

.ps-video-placeholder {
    width: calc(50% - 6px);
    height: 100%;
    border-radius: 22px;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
}

/* ==========================================================================
   Visual Type: Upload Animation
   ========================================================================== */
.ps-upload-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ps-upload-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ps-accent-pink);
    border-radius: 12px;
    background-color: rgba(250, 95, 180, 0.4);
    color: var(--ps-accent-pink);
    animation: ps-pulse 2s ease-in-out infinite;
}

@keyframes ps-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.05); opacity: 0.8; }
}

.ps-upload-cursor {
    position: absolute;
    bottom: 30px;
    right: 40px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: ps-cursor-float 3s ease-in-out infinite;
}

@keyframes ps-cursor-float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-10px, -8px); }
}

.ps-cursor-icon {
    color: #fff;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.ps-upload-clips {
    display: flex;
    gap: 6px;
    margin-left: 4px;
}

.ps-clip-thumb {
    width: 45px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--ps-shadow-soft);
    animation: ps-clip-float 2.5s ease-in-out infinite;
}

.ps-clip-thumb:nth-child(1) { animation-delay: 0s; }
.ps-clip-thumb:nth-child(2) { animation-delay: 0.2s; }
.ps-clip-thumb:nth-child(3) { animation-delay: 0.4s; }

@keyframes ps-clip-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.ps-clip-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ps-clip-placeholder {
    background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
}

.ps-upload-count {
    position: absolute;
    bottom: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--ps-accent-green);
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(51, 212, 120, 0.4);
    animation: ps-count-pop 0.5s ease-out 1s both;
}

@keyframes ps-count-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   Visual Type: Chat Messages - Looping Animation
   ========================================================================== */
.ps-chat-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    height: 100%;
    justify-content: center;
}

.ps-chat-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 8px 8px;
    background-color: rgba(255, 255, 255, 0.06);
    border-radius: 36px;
    max-width: 90%;
    opacity: 0;
    transform: translateY(10px);
}

/* Message 1: Appears first, stays visible longest */
.ps-chat-message-1 {
    animation: ps-chat-loop-1 6s ease-in-out infinite;
}

/* Message 2: Appears second */
.ps-chat-message-2 {
    align-self: flex-end;
    animation: ps-chat-loop-2 6s ease-in-out infinite;
}

/* Message 3: Appears last */
.ps-chat-message-3 {
    animation: ps-chat-loop-3 6s ease-in-out infinite;
}

/* Message 1: 0% start, appear at 5%, visible until 75%, fade out by 85% */
@keyframes ps-chat-loop-1 {
    0%, 5% {
        opacity: 0;
        transform: translateY(10px);
    }
    12%, 75% {
        opacity: 1;
        transform: translateY(0);
    }
    85%, 100% {
        opacity: 0;
        transform: translateY(-5px);
    }
}

/* Message 2: appear at 20%, visible until 78%, fade out by 88% */
@keyframes ps-chat-loop-2 {
    0%, 20% {
        opacity: 0;
        transform: translateY(10px);
    }
    30%, 78% {
        opacity: 1;
        transform: translateY(0);
    }
    88%, 100% {
        opacity: 0;
        transform: translateY(-5px);
    }
}

/* Message 3: appear at 35%, visible until 80%, fade out by 90% */
@keyframes ps-chat-loop-3 {
    0%, 35% {
        opacity: 0;
        transform: translateY(10px);
    }
    45%, 80% {
        opacity: 1;
        transform: translateY(0);
    }
    90%, 100% {
        opacity: 0;
        transform: translateY(-5px);
    }
}

.ps-chat-avatar {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(135deg, #4a4a4a 0%, #3a3a3a 100%);
    box-shadow: var(--ps-shadow-soft);
}

.ps-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ps-chat-text {
    color: #FFFFFF;
    font-size: 12px;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

/* ==========================================================================
   Visual Type: Growth Graph - Looping Animation
   ========================================================================== */
.ps-graph-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 100%;
    padding: 30px 20px;
}

.ps-graph-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 100%;
    width: 100%;
    max-width: 280px;
}

.ps-graph-bar {
    flex: 1;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 66px;
    min-height: 20px;
    position: relative;
    overflow: hidden;
}

/* The fill element inside each bar */
.ps-graph-bar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #053880;
    border-radius: 66px;
    transform-origin: bottom;
    animation: ps-bar-fill-loop 4s ease-in-out infinite;
    animation-delay: calc(var(--bar-index) * 0.15s);
}

/* Keyframes for looping fill animation */
@keyframes ps-bar-fill-loop {
    0%, 5% {
        height: 0%;
    }
    30%, 70% {
        height: 100%;
    }
    95%, 100% {
        height: 0%;
    }
}

/* Fallback heights for browsers without sin() support */
.ps-graph-bar:nth-child(1) { height: 25%; }
.ps-graph-bar:nth-child(2) { height: 35%; }
.ps-graph-bar:nth-child(3) { height: 30%; }
.ps-graph-bar:nth-child(4) { height: 45%; }
.ps-graph-bar:nth-child(5) { height: 40%; }
.ps-graph-bar:nth-child(6) { height: 55%; }
.ps-graph-bar:nth-child(7) { height: 50%; }
.ps-graph-bar:nth-child(8) { height: 65%; }
.ps-graph-bar:nth-child(9) { height: 60%; }
.ps-graph-bar:nth-child(10) { height: 75%; }
.ps-graph-bar:nth-child(11) { height: 85%; }
.ps-graph-bar:nth-child(12) { height: 95%; }

/* ==========================================================================
   Visual Type: Single Image
   ========================================================================== */
.ps-single-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 1024px) {
    .ps-steps-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ps-step-visual {
        height: 200px;
    }
}

@media (max-width: 768px) {
    .ps-section {
        padding: 60px 16px;
    }
    
    .ps-header {
        margin-bottom: 40px;
    }
    
    .ps-steps-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }
    
    .ps-step-visual {
        height: 240px;
    }
    
    .ps-step-title {
        font-size: 17px;
    }
    
    .ps-step-desc {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .ps-title {
        font-size: 24px;
    }
    
    .ps-description {
        font-size: 15px;
    }
    
    .ps-step-visual {
        height: 200px;
    }
}

/* ==========================================================================
   Animation Control - Respect reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .ps-upload-icon,
    .ps-upload-cursor,
    .ps-clip-thumb,
    .ps-upload-count,
    .ps-chat-message,
    .ps-chat-message-1,
    .ps-chat-message-2,
    .ps-chat-message-3,
    .ps-graph-bar,
    .ps-graph-bar::after {
        animation: none !important;
    }

    .ps-upload-count {
        transform: scale(1);
    }

    .ps-chat-message,
    .ps-chat-message-1,
    .ps-chat-message-2,
    .ps-chat-message-3 {
        opacity: 1;
        transform: translateY(0);
    }

    .ps-graph-bar::after {
        height: 100%;
    }
}

/* ==========================================================================
   Dark Mode Support (for light theme contexts)
   ========================================================================== */
@media (prefers-color-scheme: light) {
    .ps-section[data-theme="auto"] {
        --ps-bg-dark: #f5f5f5;
        --ps-bg-card: #ffffff;
        --ps-text-primary: #1a1a1a;
        --ps-text-secondary: #666666;
        --ps-border: #e0e0e0;
    }
}

/* ==========================================================================
   Scroll-triggered Animations
   ========================================================================== */
.ps-step {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.ps-step.ps-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger animation delays */
.ps-step:nth-child(1) { transition-delay: 0.1s; }
.ps-step:nth-child(2) { transition-delay: 0.2s; }
.ps-step:nth-child(3) { transition-delay: 0.3s; }
.ps-step:nth-child(4) { transition-delay: 0.4s; }

/* Elementor Editor Preview */
.elementor-editor-active .ps-step {
    opacity: 1;
    transform: translateY(0);
}

.elementor-editor-active .ps-chat-message,
.elementor-editor-active .ps-chat-message-1,
.elementor-editor-active .ps-chat-message-2,
.elementor-editor-active .ps-chat-message-3,
.elementor-editor-active .ps-upload-count {
    animation-play-state: paused;
    opacity: 1;
    transform: none;
}

.elementor-editor-active .ps-graph-bar::after {
    animation-play-state: paused;
    height: 100%;
}
