/* ===================================
   MICRO-INTERACTIONS & ANIMATIONS
   Premium UI interactions for InterRize
   =================================== */

/* ==================
   1. BUTTON INTERACTIONS
   ================== */

/* Ripple Effect on Buttons */
.btn,
.btn-primary,
.btn-secondary,
button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
}

.btn:hover,
.btn-primary:hover,
.btn-secondary:hover,
button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(161, 0, 255, 0.3);
}

.btn:active,
.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(161, 0, 255, 0.2);
}

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

.btn:active::before,
.btn-primary:active::before {
    width: 300px;
    height: 300px;
}

/* Pulse animation for CTA buttons */
@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(161, 0, 255, 0.7);
    }

    50% {
        box-shadow: 0 0 0 15px rgba(161, 0, 255, 0);
    }
}

.btn-primary.pulse {
    animation: pulse 2s infinite;
}

/* ==================
   2. CARD INTERACTIONS
   ================== */

/* Card hover effects */
.card,
.service-card,
.product-card,
.insight-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.card:hover,
.service-card:hover,
.product-card:hover,
.insight-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(161, 0, 255, 0.2);
}

/* Card shine effect */
.card::after,
.service-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.card:hover::after,
.service-card:hover::after {
    left: 100%;
}

/* ==================
   3. FORM INTERACTIONS
   ================== */

/* Input focus animations */
input,
textarea,
select {
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #a100ff;
    box-shadow: 0 0 0 4px rgba(161, 0, 255, 0.1);
    transform: scale(1.01);
}

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

.form-group label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    color: #888;
    font-size: 16px;
}

.form-group input:focus~label,
.form-group input:not(:placeholder-shown)~label {
    top: -10px;
    left: 8px;
    font-size: 12px;
    color: #a100ff;
    background: white;
    padding: 0 4px;
}

/* Input validation animations */
input.success,
textarea.success {
    border-color: #10b981;
    animation: successShake 0.4s ease;
}

input.error,
textarea.error {
    border-color: #ef4444;
    animation: errorShake 0.4s ease;
}

@keyframes successShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

@keyframes errorShake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-6px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(6px);
    }
}

/* Checkbox/Radio custom animations */
input[type="checkbox"],
input[type="radio"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #a100ff;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="checkbox"]:checked::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    color: white;
    font-weight: bold;
    animation: checkPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

input[type="checkbox"]:checked {
    background: #a100ff;
    border-color: #a100ff;
}

@keyframes checkPop {
    to {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ==================
   4. LINK INTERACTIONS
   ================== */

/* Underline animation */
a {
    position: relative;
    text-decoration: none;
    transition: color 0.3s ease;
}

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

a:hover::after {
    width: 100%;
}

/* Navigation link hover */
.nav-menu a {
    transition: all 0.3s ease;
}

.nav-menu a:hover {
    color: #a100ff;
    transform: translateY(-2px);
}

/* ==================
   5. IMAGE INTERACTIONS
   ================== */

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

.image-zoom img {
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

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

/* Image overlay fade */
.image-overlay {
    position: relative;
    overflow: hidden;
}

.image-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, transparent 0%, rgba(86, 5, 145, 0.8) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.image-overlay:hover::before {
    opacity: 1;
}

/* ==================
   6. LOADING ANIMATIONS
   ================== */

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(161, 0, 255, 0.1);
    border-top-color: #a100ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #a100ff;
    border-radius: 50%;
    animation: dotBounce 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;
}

@keyframes dotBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

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

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

    100% {
        background-position: -200% 0;
    }
}

/* ==================
   7. NOTIFICATION ANIMATIONS
   ================== */

/* Toast notifications */
.toast {
    position: fixed;
    bottom: -100px;
    right: 20px;
    padding: 16px 24px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    z-index: 9999;
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

@keyframes slideUp {
    to {
        bottom: 20px;
    }
}

.toast.hiding {
    animation: slideDown 0.3s ease forwards;
}

@keyframes slideDown {
    to {
        bottom: -100px;
        opacity: 0;
    }
}

/* ==================
   8. SCROLL ANIMATIONS
   ================== */

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

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

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

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

/* Slide in from right */
.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Scale in */
.scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

/* ==================
   9. ICON ANIMATIONS
   ================== */

/* Icon bounce on hover */
.icon-bounce {
    transition: transform 0.3s ease;
}

.icon-bounce:hover {
    animation: bounce 0.6s ease;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Icon rotate on hover */
.icon-rotate {
    transition: transform 0.3s ease;
}

.icon-rotate:hover {
    transform: rotate(360deg);
}

/* Icon shake */
.icon-shake:hover {
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-4px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(4px);
    }
}

/* ==================
   10. TOOLTIP ANIMATIONS
   ================== */

.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) scale(0);
    padding: 8px 12px;
    background: #1a1a1a;
    color: white;
    font-size: 14px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
    z-index: 1000;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%) scale(0);
    border: 6px solid transparent;
    border-top-color: #1a1a1a;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.tooltip:hover::before,
.tooltip:hover::after {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

/* ==================
   11. PROGRESS ANIMATIONS
   ================== */

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(161, 0, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #560591, #a100ff);
    border-radius: 2px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.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: shimmer 2s infinite;
}

/* ==================
   12. DROPDOWN ANIMATIONS
   ================== */

.dropdown-content {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ==================
   13. MODAL ANIMATIONS
   ================== */

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal {
    animation: modalFadeIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ==================
   14. HOVER GLOW EFFECTS
   ================== */

.glow-on-hover {
    position: relative;
    transition: all 0.3s ease;
}

.glow-on-hover::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, #560591, #a100ff, #560591);
    border-radius: inherit;
    opacity: 0;
    filter: blur(10px);
    transition: opacity 0.3s ease;
    z-index: -1;
}

.glow-on-hover:hover::before {
    opacity: 0.7;
}

/* ==================
   15. TEXT ANIMATIONS
   ================== */

/* Typing effect */
.typing-effect {
    overflow: hidden;
    border-right: 2px solid #a100ff;
    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: #a100ff;
    }
}

/* Gradient text animation */
.gradient-text-animated {
    background: linear-gradient(90deg, #560591, #a100ff, #560591);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* ==================
   16. PERFORMANCE
   ================== */

/* Enable GPU acceleration */
.hw-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}