/**
 * SecondScent Animations & Microinteractions
 * Smooth, delightful animations for better UX
 */

/* ===================================
   LOADING ANIMATIONS
==================================== */

/* Page Loader */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #faf5ff 0%, #ffffff 50%, #fffbeb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.page-loader-content {
    text-align: center;
}

.page-loader-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    position: relative;
    animation: pulse 2s ease-in-out infinite;
}

.page-loader-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 20px rgba(255, 180, 76, 0.4));
}

.page-loader-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
}

.page-loader-subtext {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Dots Loader */
.dots-loader {
    display: inline-flex;
    gap: 6px;
}

.dots-loader span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffb54d;
    animation: dots-bounce 1.4s infinite ease-in-out;
}

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

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

@keyframes dots-bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Skeleton Pulse */
.skeleton-pulse {
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

/* ===================================
   BUTTON ANIMATIONS
==================================== */

/* Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

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

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Button Loading State */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-right-color: transparent;
    animation: spin 0.6s linear infinite;
}

/* ===================================
   CARD ANIMATIONS
==================================== */

/* Card Reveal */
.card-reveal {
    opacity: 0;
    transform: translateY(30px);
    animation: card-reveal 0.6s ease forwards;
}

@keyframes card-reveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-reveal:nth-child(2) { animation-delay: 0.1s; }
.card-reveal:nth-child(3) { animation-delay: 0.2s; }
.card-reveal:nth-child(4) { animation-delay: 0.3s; }

/* Card Flip */
.card-flip {
    perspective: 1000px;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

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

.card-flip-front,
.card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.card-flip-back {
    transform: rotateY(180deg);
}

/* ===================================
   SCROLL ANIMATIONS
==================================== */

/* Fade In Up */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Fade In */
.fade-in {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
}

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

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

/* ===================================
   HOVER EFFECTS
==================================== */

/* Glow on Hover */
.hover-glow {
    transition: all 0.3s ease;
}

.hover-glow:hover {
    filter: drop-shadow(0 0 20px rgba(255, 180, 76, 0.6));
}

/* Bounce on Hover */
.hover-bounce:hover {
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Shake on Error */
.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* ===================================
   NUMBER COUNTERS
==================================== */

.count-up {
    font-variant-numeric: tabular-nums;
}

/* ===================================
   PROGRESS BARS
==================================== */

.progress-bar {
    position: relative;
    height: 8px;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFB44C 0%, #ffc866 100%);
    border-radius: 9999px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ===================================
   FLOATING ELEMENTS
==================================== */

.float {
    animation: float 3s ease-in-out infinite;
}

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

.float-delay-1 {
    animation-delay: 0.5s;
}

.float-delay-2 {
    animation-delay: 1s;
}

/* ===================================
   TYPEWRITER EFFECT
==================================== */

.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--primary-600);
    white-space: nowrap;
    animation: 
        typing 3.5s steps(40, end),
        blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink-caret {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--primary-600);
    }
}

/* ===================================
   NOTIFICATION BADGE PULSE
==================================== */

.badge-pulse {
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* ===================================
   UTILITY ANIMATIONS
==================================== */

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

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Ping */
@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

.animate-ping {
    animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* Pulse */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

