/* ============================================
   BRENTHIS ADVANCED ANIMATIONS LIBRARY
   Smooth transitions & advanced effects
   ============================================ */

/* ============================================
   PAGE LOAD ANIMATIONS
   ============================================ */

@keyframes pageLoadFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

body {
    animation: pageLoadFade 0.5s ease-in;
}

/* Loading spinner for page transitions */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.page-loader .spinner {
    width: 60px;
    height: 60px;
}

/* ============================================
   SCROLL-TRIGGERED ANIMATIONS
   ============================================ */

/* Slide in from left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide in from right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide in from bottom */
@keyframes slideInBottom {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide in from top */
@keyframes slideInTop {
    from {
        opacity: 0;
        transform: translateY(-100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Rotate in */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-200deg) scale(0);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

/* Bounce in */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* Flip in */
@keyframes flipIn {
    from {
        opacity: 0;
        transform: perspective(400px) rotateX(90deg);
    }
    to {
        opacity: 1;
        transform: perspective(400px) rotateX(0);
    }
}

/* Animation Classes */
.slide-in-left {
    animation: slideInLeft 0.8s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.slide-in-right {
    animation: slideInRight 0.8s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.slide-in-bottom {
    animation: slideInBottom 0.8s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.slide-in-top {
    animation: slideInTop 0.8s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.rotate-in {
    animation: rotateIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.bounce-in {
    animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) both;
}

.flip-in {
    animation: flipIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ============================================
   HOVER ANIMATIONS
   ============================================ */

/* Shake effect */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.hover-shake:hover {
    animation: shake 0.5s;
}

/* Wobble effect */
@keyframes wobble {
    0%, 100% {
        transform: translateX(0);
    }
    15% {
        transform: translateX(-10px) rotate(-5deg);
    }
    30% {
        transform: translateX(5px) rotate(3deg);
    }
    45% {
        transform: translateX(-5px) rotate(-3deg);
    }
    60% {
        transform: translateX(3px) rotate(2deg);
    }
    75% {
        transform: translateX(-2px) rotate(-1deg);
    }
}

.hover-wobble:hover {
    animation: wobble 0.8s;
}

/* Pulse grow */
@keyframes pulseGrow {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.hover-pulse-grow:hover {
    animation: pulseGrow 0.6s ease-in-out infinite;
}

/* Heartbeat */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(0.9);
    }
    20%, 40%, 60%, 80% {
        transform: scale(1.1);
    }
    50%, 70% {
        transform: scale(1.05);
    }
}

.hover-heartbeat:hover {
    animation: heartbeat 1.3s ease-in-out infinite;
}

/* ============================================
   BACKGROUND ANIMATIONS
   ============================================ */

/* Gradient animation variations */
@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes gradientRotate {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

.gradient-flow {
    background-size: 200% 200%;
    animation: gradientFlow 10s ease infinite;
}

.gradient-rotate {
    animation: gradientRotate 20s linear infinite;
}

/* Shimmer effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* ============================================
   TEXT ANIMATIONS
   ============================================ */

/* Typing effect */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

.typing-effect {
    overflow: hidden;
    border-right: 3px solid var(--accent-amber);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink 0.75s step-end infinite;
}

/* Text glow pulse */
@keyframes textGlowPulse {
    0%, 100% {
        text-shadow: 0 0 10px rgba(239, 177, 113, 0.5);
    }
    50% {
        text-shadow: 0 0 20px rgba(239, 177, 113, 0.8), 0 0 30px rgba(239, 177, 113, 0.6);
    }
}

.text-glow-pulse {
    animation: textGlowPulse 2s ease-in-out infinite;
}

/* Character reveal animation */
@keyframes revealChar {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reveal-text span {
    display: inline-block;
    opacity: 0;
    animation: revealChar 0.6s forwards;
}

.reveal-text span:nth-child(1) { animation-delay: 0.1s; }
.reveal-text span:nth-child(2) { animation-delay: 0.2s; }
.reveal-text span:nth-child(3) { animation-delay: 0.3s; }
.reveal-text span:nth-child(4) { animation-delay: 0.4s; }
.reveal-text span:nth-child(5) { animation-delay: 0.5s; }

/* ============================================
   BUTTON EFFECTS
   ============================================ */

/* 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;
}

/* Shine effect */
@keyframes shine {
    0% {
        left: -100%;
    }
    100% {
        left: 200%;
    }
}

.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.7s;
}

.btn-shine:hover::before {
    left: 200%;
}

/* ============================================
   LOADING STATES
   ============================================ */

/* Skeleton loader */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0px,
        #e0e0e0 40px,
        #f0f0f0 80px
    );
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

/* Dots loader */
@keyframes dotFlashing {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.dots-loader {
    display: inline-flex;
    gap: 8px;
}

.dots-loader span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-amber);
    animation: dotFlashing 1s infinite;
}

.dots-loader span:nth-child(1) { animation-delay: 0s; }
.dots-loader span:nth-child(2) { animation-delay: 0.2s; }
.dots-loader span:nth-child(3) { animation-delay: 0.4s; }

/* ============================================
   NOTIFICATION ANIMATIONS
   ============================================ */

@keyframes slideInNotification {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutNotification {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.notification-enter {
    animation: slideInNotification 0.3s ease-out forwards;
}

.notification-exit {
    animation: slideOutNotification 0.3s ease-in forwards;
}

/* ============================================
   PARTICLE EFFECTS
   ============================================ */

@keyframes float-particle {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(100px);
        opacity: 0;
    }
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(239, 177, 113, 0.5);
    border-radius: 50%;
    animation: float-particle 15s linear infinite;
}

/* ============================================
   SCROLL ANIMATIONS
   ============================================ */

/* Reveal on scroll */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Scale on scroll */
.scale-on-scroll {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scale-on-scroll.revealed {
    opacity: 1;
    transform: scale(1);
}

/* ============================================
   STAGGER ANIMATIONS
   ============================================ */

.stagger-animation > * {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-animation > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-animation > *:nth-child(8) { animation-delay: 0.8s; }

/* ============================================
   MICRO-INTERACTIONS
   ============================================ */

/* Like button pulse */
@keyframes likePulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

.like-animation {
    animation: likePulse 0.3s ease;
}

/* Success checkmark */
@keyframes drawCheck {
    from {
        stroke-dashoffset: 100;
    }
    to {
        stroke-dashoffset: 0;
    }
}

.checkmark {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawCheck 0.5s ease forwards;
}

/* ============================================
   PERFORMANCE OPTIMIZATION
   ============================================ */

/* GPU acceleration for smooth animations */
.hardware-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .parallax-bg {
        transform: none !important;
    }
}
