/* ===================================================================
   VoxAssist Animations
   Purpose: Purposeful micro-interactions and loading animations
   ================================================================ */

/* ===================================================================
   Shimmer Animation for Skeleton Loading States
   ================================================================ */

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

.skeleton {
    position: relative;
    overflow: hidden;
    background: linear-gradient(
        90deg,
        #e5e7eb 0%,
        #f3f4f6 50%,
        #e5e7eb 100%
    );
    background-size: 200% 100%;
}

.dark .skeleton {
    background: linear-gradient(
        90deg,
        #374151 0%,
        #4b5563 50%,
        #374151 100%
    );
    background-size: 200% 100%;
}

.animate-shimmer {
    animation: shimmer 2s ease-in-out infinite;
}

/* ===================================================================
   Reduced Motion Support
   Purpose: Respect user's prefers-reduced-motion preference
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        background: #e5e7eb;
        animation: none;
    }

    .dark .skeleton {
        background: #374151;
        animation: none;
    }

    .animate-shimmer {
        animation: none;
    }
}

/* ===================================================================
   Screen Reader Only Class
   Purpose: Hide content visually but keep it accessible
   ================================================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ===================================================================
   Micro-Interactions (T122-T127)
   Purpose: Purposeful feedback animations for user actions
   ================================================================ */

/* T122: Button Press Micro-Interaction */
@keyframes button-press {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.97);
    }
    100% {
        transform: scale(1);
    }
}

button:active:not(:disabled),
.btn:active:not(:disabled) {
    animation: button-press 0.15s ease-in-out;
}

/* T123: Input Focus Micro-Interaction */
@keyframes input-glow {
    from {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
    to {
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    }
}

input:focus,
textarea:focus,
select:focus {
    animation: input-glow 0.2s ease-in-out forwards;
    transition: box-shadow 0.2s ease-in-out;
}

/* T124: Form Validation Success Micro-Interaction */
@keyframes checkmark-fade-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.validation-success,
.success-checkmark {
    animation: checkmark-fade-in 0.3s ease-in-out;
}

/* T125: Form Validation Error Micro-Interaction */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-4px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(4px);
    }
}

.validation-error,
.error-message {
    animation: shake 0.4s ease-in-out;
}

/* T126: Navigation Item Hover Micro-Interaction */
@keyframes nav-background-fade {
    from {
        background-color: transparent;
    }
    to {
        background-color: rgba(99, 102, 241, 0.1);
    }
}

.nav-item:hover,
.navigation-item:hover {
    animation: nav-background-fade 0.2s ease-in-out forwards;
    transition: background-color 0.2s ease-in-out;
}

/* T127: All animations use ease-in-out (no bounce/elastic) */
/* Verified: All animations above use ease-in-out timing function */

/* ===================================================================
   Reduced Motion Support for Micro-Interactions
   Purpose: Disable micro-interactions when user prefers reduced motion
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
    button:active:not(:disabled),
    .btn:active:not(:disabled) {
        animation: none;
    }

    input:focus,
    textarea:focus,
    select:focus {
        animation: none;
    }

    .validation-success,
    .success-checkmark {
        animation: none;
    }

    .validation-error,
    .error-message {
        animation: none;
    }

    .nav-item:hover,
    .navigation-item:hover {
        animation: none;
    }

    /* Still allow transitions but make them instant */
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
