/* ====================================
   BOAVENTURA GROUP - Animations
   ==================================== */

/* ====================================
   Fade In Animation
   ==================================== */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

/* Fade In Left */
.fade-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Fade In Right */
.fade-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

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

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

/* ====================================
   Staggered Animations
   ==================================== */
.fade-in:nth-child(1) { transition-delay: 0s; }
.fade-in:nth-child(2) { transition-delay: 0.1s; }
.fade-in:nth-child(3) { transition-delay: 0.2s; }
.fade-in:nth-child(4) { transition-delay: 0.3s; }
.fade-in:nth-child(5) { transition-delay: 0.4s; }
.fade-in:nth-child(6) { transition-delay: 0.5s; }

/* ====================================
   Parallax Effect
   ==================================== */
.parallax-container {
    overflow: hidden;
    position: relative;
}

.parallax-bg {
    position: absolute;
    top: -50%;
    left: 0;
    right: 0;
    bottom: -50%;
    background-size: cover;
    background-position: center;
    will-change: transform;
}

/* ====================================
   Hover Animations
   ==================================== */
/* Scale Hover */
.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Lift Hover */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

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

.hover-glow:hover {
    box-shadow: 0 0 25px rgba(46, 139, 87, 0.4);
}

/* ====================================
   Loading Animations
   ==================================== */
/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 35, 102, 0.1);
    border-top-color: var(--navy-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Dots Loading */
.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: var(--navy-blue);
    border-radius: 50%;
    animation: dot-pulse 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

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

/* ====================================
   Text Animations
   ==================================== */
/* Typing Effect */
.typing-effect {
    overflow: hidden;
    border-right: 2px solid var(--navy-blue);
    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(--navy-blue); }
}

/* Underline Animation */
.animate-underline {
    position: relative;
    display: inline-block;
}

.animate-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--emerald-green);
    transition: width 0.3s ease;
}

.animate-underline:hover::after {
    width: 100%;
}

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

.btn-ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 60%);
    transform: scale(0);
    opacity: 0;
    transition: transform 0.5s, opacity 0.3s;
}

.btn-ripple:active::after {
    transform: scale(2);
    opacity: 1;
    transition: 0s;
}

/* Arrow Animation */
.btn-arrow i {
    transition: transform 0.3s ease;
}

.btn-arrow:hover i {
    transform: translateX(5px);
}

/* ====================================
   Card Animations
   ==================================== */
/* 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);
}

/* ====================================
   Icon Animations
   ==================================== */
/* Bounce */
.icon-bounce {
    animation: icon-bounce 2s infinite;
}

@keyframes icon-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Shake */
.icon-shake:hover {
    animation: icon-shake 0.5s ease-in-out;
}

@keyframes icon-shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
    75% { transform: rotate(-10deg); }
}

/* Pulse */
.icon-pulse {
    animation: icon-pulse 2s infinite;
}

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

/* ====================================
   Background Animations
   ==================================== */
/* Gradient Animation */
.animated-gradient {
    background: linear-gradient(-45deg, #002366, #003399, #2E8B57, #247048);
    background-size: 400% 400%;
    animation: gradient-shift 15s ease infinite;
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Floating Animation */
.floating {
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

/* ====================================
   Scroll-Based Animations
   ==================================== */
/* Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--navy-blue), var(--emerald-green));
    z-index: 9999;
    transition: width 0.1s ease;
}

/* ====================================
   Counter Animation
   ==================================== */
.counter {
    transition: all 0.3s ease;
}

/* ====================================
   Form Animations
   ==================================== */
/* Input Focus */
.input-animated {
    position: relative;
}

.input-animated label {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    transition: all 0.3s ease;
    pointer-events: none;
    color: var(--light-gray);
}

.input-animated input:focus + label,
.input-animated input:not(:placeholder-shown) + label {
    top: 0;
    left: 12px;
    font-size: 0.75rem;
    background: var(--white);
    padding: 0 4px;
    color: var(--navy-blue);
}

/* Checkbox Animation */
.checkbox-animated {
    position: relative;
    cursor: pointer;
}

.checkbox-animated input {
    opacity: 0;
    position: absolute;
}

.checkbox-animated .checkmark {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-gray);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.checkbox-animated input:checked + .checkmark {
    background: var(--emerald-green);
    border-color: var(--emerald-green);
}

.checkbox-animated .checkmark::after {
    content: '✓';
    color: var(--white);
    transform: scale(0);
    transition: transform 0.2s ease;
}

.checkbox-animated input:checked + .checkmark::after {
    transform: scale(1);
}

/* ====================================
   Toast/Notification Animations
   ==================================== */
.toast {
    animation: toast-in 0.3s ease-out;
}

@keyframes toast-in {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.toast.toast-out {
    animation: toast-out 0.3s ease-in forwards;
}

@keyframes toast-out {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

/* ====================================
   Modal Animations
   ==================================== */
.modal-overlay {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    transform: scale(0.9) translateY(-20px);
    opacity: 0;
    transition: all 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ====================================
   Skeleton Loading
   ==================================== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

/* ====================================
   Reduced Motion
   ==================================== */
@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;
    }
    
    .fade-in,
    .fade-in-left,
    .fade-in-right,
    .fade-in-scale {
        opacity: 1;
        transform: none;
    }
}