/* ===================================================================
   PREMIUM ANIMATIONS & MICRO-UX POLISH
   Phase 5: Scroll Triggers, Entrance Effects, Micro-Interactions
   =================================================================== */

/* ===================================================================
   SCROLL-TRIGGERED ANIMATIONS
   =================================================================== */

/* Fade-in on scroll */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animation delays */
.animate-on-scroll:nth-child(1) { transition-delay: 0.1s; }
.animate-on-scroll:nth-child(2) { transition-delay: 0.2s; }
.animate-on-scroll:nth-child(3) { transition-delay: 0.3s; }
.animate-on-scroll:nth-child(4) { transition-delay: 0.4s; }
.animate-on-scroll:nth-child(5) { transition-delay: 0.5s; }
.animate-on-scroll:nth-child(6) { transition-delay: 0.6s; }

/* Scale-in animation */
.scale-in {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scale-in.animated {
    opacity: 1;
    transform: scale(1);
}

/* Slide-in from sides */
.slide-in-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.slide-in-left.animated {
    opacity: 1;
    transform: translateX(0);
}

.slide-in-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.slide-in-right.animated {
    opacity: 1;
    transform: translateX(0);
}

/* ===================================================================
   CARD MICRO-INTERACTIONS
   =================================================================== */

.card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    box-shadow: 0 20px 60px rgba(37, 99, 235, 0.15);
}

.card:hover::after {
    opacity: 1;
}

.card:hover {
    transform: translateY(-8px);
}

/* Service and Partner Cards Enhanced */
.service-card,
.partner-card {
    position: relative;
    overflow: hidden;
}

.service-card::before,
.partner-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.1) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.service-card:hover::before,
.partner-card:hover::before {
    width: 400px;
    height: 400px;
}

/* ===================================================================
   BUTTON INTERACTIONS
   =================================================================== */

.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::before {
    width: 300px;
    height: 300px;
    transition: width 0s, height 0s;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

/* ===================================================================
   FORM INTERACTIONS
   =================================================================== */

.form-input,
.form-select,
.form-textarea {
    transition: all 0.3s ease;
    position: relative;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.15);
}

/* Label animation */
.form-group {
    position: relative;
}

.form-label {
    transition: all 0.3s ease;
    display: block;
}

.form-input:focus ~ .form-label,
.form-select:focus ~ .form-label,
.form-textarea:focus ~ .form-label {
    color: var(--color-primary);
    transform: scale(0.95);
}

/* Textarea */
.form-textarea {
    width: 100%;
    padding: 1rem 1.2rem;
    border: 2px solid rgba(37, 99, 235, 0.1);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    background: var(--surface-card);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

/* ===================================================================
   LOADING STATES
   =================================================================== */

.btn-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===================================================================
   HERO SECTION ANIMATIONS
   =================================================================== */

.hero-headline {
    animation: fadeInUp 1s ease-out;
}

.hero-subtext {
    animation: fadeInUp 1s ease-out 0.2s both;
}

.hero-trust-badges {
    animation: fadeInUp 1s ease-out 0.4s both;
}

.hero-status {
    animation: fadeInUp 1s ease-out 0.6s both;
}

.hero-form-premium {
    animation: fadeInRight 1s ease-out 0.3s both;
}

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

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===================================================================
   WORKFLOW STEP ANIMATIONS
   =================================================================== */

.workflow-step {
    opacity: 0;
    transform: translateY(20px);
    animation: stepFadeIn 0.6s ease-out forwards;
}

.workflow-step:nth-child(1) { animation-delay: 0.1s; }
.workflow-step:nth-child(2) { animation-delay: 0.2s; }
.workflow-step:nth-child(3) { animation-delay: 0.3s; }
.workflow-step:nth-child(4) { animation-delay: 0.4s; }

@keyframes stepFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Step hover enhancement */
.workflow-step:hover .step-number {
    animation: pulse 0.6s ease-in-out;
}

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

/* ===================================================================
   ICON ANIMATIONS
   =================================================================== */

.step-icon,
.why-icon {
    transition: all 0.4s ease;
}

.workflow-step:hover .step-icon i,
.why-item:hover .why-icon i,
.service-card:hover i {
    animation: iconBounce 0.6s ease;
}

@keyframes iconBounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

/* ===================================================================
   TRUST BADGE ANIMATIONS
   =================================================================== */

.trust-badge {
    transition: all 0.3s ease;
}

.trust-badge:hover {
    transform: translateX(5px);
    background: var(--surface-2);
}

.trust-badge i {
    transition: all 0.3s ease;
}

.trust-badge:hover i {
    transform: scale(1.2);
}

/* ===================================================================
   PARTNER LOGO ANIMATIONS
   =================================================================== */

.partner-card img {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.partner-card:hover img {
    transform: scale(1.15);
    filter: drop-shadow(0 8px 16px rgba(37, 99, 235, 0.2));
}

/* ===================================================================
   SCROLL PROGRESS INDICATOR
   =================================================================== */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    z-index: 9999;
    transition: width 0.1s ease;
}

/* ===================================================================
   SMOOTH SCROLL BEHAVIOR
   =================================================================== */

html {
    scroll-behavior: smooth;
}

/* ===================================================================
   REDUCED MOTION SUPPORT
   =================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===================================================================
   FOCUS VISIBLE STATES
   =================================================================== */

.btn:focus-visible,
.form-input:focus-visible,
.form-select:focus-visible,
.form-textarea:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* ===================================================================
   TOAST NOTIFICATION ANIMATION
   =================================================================== */

@keyframes slideInToast {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutToast {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast {
    animation: slideInToast 0.4s ease-out;
}

.toast.hiding {
    animation: slideOutToast 0.4s ease-out;
}

/* ===================================================================
   MOBILE TOUCH FEEDBACK
   =================================================================== */

@media (hover: none) {
    .card:active {
        transform: scale(0.98);
    }
    
    .btn:active {
        transform: scale(0.96);
    }
    
    .trust-badge:active {
        background: var(--surface-2);
    }
}

/* ===================================================================
   SKELETON LOADING STATES
   =================================================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--surface-1) 0%,
        var(--surface-2) 50%,
        var(--surface-1) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ===================================================================
   PAGE TRANSITION FADE
   =================================================================== */

body {
    animation: pageEnter 0.5s ease-out;
}

@keyframes pageEnter {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===================================================================
   HEADER SCROLL EFFECTS
   =================================================================== */

.header {
    transition: all 0.3s ease;
}

.header.scrolled {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(25px) saturate(200%);
}

/* ===================================================================
   FLOATING ACTION BUTTONS ANIMATIONS
   =================================================================== */

.sticky-call,
.whatsapp-button {
    animation: fadeInScale 0.6s ease-out 1s both;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.sticky-call:hover,
.whatsapp-button:hover {
    animation: wiggle 0.5s ease;
}

@keyframes wiggle {
    0%, 100% { transform: scale(1.15) rotate(0deg); }
    25% { transform: scale(1.15) rotate(-5deg); }
    75% { transform: scale(1.15) rotate(5deg); }
}

/* ===================================================================
   FORM MESSAGE ANIMATIONS
   =================================================================== */

.form-message {
    animation: messageSlideIn 0.4s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 200px;
    }
}

/* ===================================================================
   COUNTER ANIMATION
   =================================================================== */

.counter {
    font-variant-numeric: tabular-nums;
}

/* ===================================================================
   GRADIENT TEXT SHIMMER
   =================================================================== */

.text-gradient-shimmer {
    background: linear-gradient(
        90deg,
        var(--color-primary) 0%,
        var(--color-secondary) 50%,
        var(--color-primary) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShimmer 3s linear infinite;
}

@keyframes gradientShimmer {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}
