/**
 * Smooth Transitions & Micro-interactions - Sprint 5
 * Transições suaves e micro-interações para melhor UX
 */

/* ========== GLOBAL TRANSITIONS ========== */

/* Smooth transitions para todos os elementos interativos */
a, button, input, textarea, select {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Card lift on hover */
.card-hover-lift {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover-lift:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* Card image zoom on hover */
.card-image-zoom {
    overflow: hidden;
}

.card-image-zoom img {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-image-zoom:hover img {
    transform: scale(1.08);
}

/* ========== BUTTON MICRO-INTERACTIONS ========== */

/* Primary Button */
.btn-primary,
.button-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover,
.button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(77, 134, 196, 0.4);
}

.btn-primary:active,
.button-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(77, 134, 196, 0.3);
}

/* 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;
}

/* ========== INPUT FOCUS EFFECTS ========== */

/* Smooth input focus */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #4d86c4;
    box-shadow: 0 0 0 3px rgba(77, 134, 196, 0.1);
    transform: scale(1.01);
}

/* Floating label effect */
.input-floating {
    position: relative;
}

.input-floating label {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    background: white;
    padding: 0 0.4rem;
    color: #6b7280;
}

.input-floating input:focus + label,
.input-floating input:not(:placeholder-shown) + label {
    top: 0;
    font-size: 1.2rem;
    color: #4d86c4;
}

/* ========== NAVIGATION TRANSITIONS ========== */

/* Menu item hover */
.menu-item {
    position: relative;
    transition: all 0.2s ease-out;
}

.menu-item::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: currentColor;
    transform: translateX(-50%);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-item:hover::before,
.menu-item.active::before {
    width: 100%;
}

/* Menu slide in */
.menu-slide-in {
    animation: slideInLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Badge bounce */
.badge-bounce {
    animation: bounce 1s ease-in-out;
}

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

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

/* Icon rotate on hover */
.icon-rotate:hover i {
    transform: rotate(360deg);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Icon bounce */
.icon-bounce:hover i {
    animation: iconBounce 0.5s ease-in-out;
}

@keyframes iconBounce {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-5px);
    }
    75% {
        transform: translateY(-2px);
    }
}

/* Icon shake (for errors) */
.icon-shake {
    animation: shake 0.5s ease-in-out;
}

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

/* ========== CONTENT REVEAL ANIMATIONS ========== */

/* Fade in up */
.fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Fade in (simple) */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

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

/* Scale in */
.scale-in {
    animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

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

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(77, 134, 196, 0.5);
}

/* Underline slide */
.hover-underline {
    position: relative;
}

.hover-underline::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Spinner */
.spinner-rotate {
    animation: spin 1s linear infinite;
}

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

/* Dots loading */
.loading-dots {
    display: inline-flex;
    gap: 0.4rem;
}

.loading-dots span {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
    background: currentColor;
    animation: dotPulse 1.4s ease-in-out infinite;
}

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

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* ========== MODAL/OVERLAY TRANSITIONS ========== */

/* Modal fade in */
.modal-fade-in {
    animation: modalFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Backdrop fade */
.backdrop-fade {
    animation: backdropFade 0.3s ease-out;
}

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

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

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Reveal on scroll */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ========== STAGGER ANIMATIONS ========== */

/* Stagger children animation */
.stagger-animation > * {
    opacity: 0;
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) 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; }

/* ========== LINK TRANSITIONS ========== */

/* Link with arrow that slides on hover */
.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.link-arrow i {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.link-arrow:hover i {
    transform: translateX(4px);
}

/* ========== FORM VALIDATION ANIMATIONS ========== */

/* Error shake */
.error-shake {
    animation: shake 0.5s ease-in-out;
}

/* Success checkmark */
.success-checkmark {
    animation: checkmark 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes checkmark {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* ========== ACCESSIBILITY ========== */

/* Disable animations for users who prefer 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;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ========== UTILITY CLASSES ========== */

/* Transition speeds */
.transition-fast { transition-duration: 0.15s !important; }
.transition-normal { transition-duration: 0.3s !important; }
.transition-slow { transition-duration: 0.5s !important; }

/* Easing functions */
.ease-in { transition-timing-function: cubic-bezier(0.4, 0, 1, 1) !important; }
.ease-out { transition-timing-function: cubic-bezier(0, 0, 0.2, 1) !important; }
.ease-in-out { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important; }
