/**
 * Professional Subtle Animations & Micro-interactions
 * For Insurance System - Modern UI Enhancement
 */

/* ============================================
   FADE-IN ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animation classes with stagger delays */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
    opacity: 0;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease-out forwards;
    opacity: 0;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.6s ease-out forwards;
    opacity: 0;
}

.animate-fade-in-right {
    animation: fadeInRight 0.6s ease-out forwards;
    opacity: 0;
}

/* Stagger delays for sequential animations */
.animate-fade-in-up:nth-child(1),
.animate-fade-in:nth-child(1) { animation-delay: 0.1s; }

.animate-fade-in-up:nth-child(2),
.animate-fade-in:nth-child(2) { animation-delay: 0.2s; }

.animate-fade-in-up:nth-child(3),
.animate-fade-in:nth-child(3) { animation-delay: 0.3s; }

.animate-fade-in-up:nth-child(4),
.animate-fade-in:nth-child(4) { animation-delay: 0.4s; }

.animate-fade-in-up:nth-child(5),
.animate-fade-in:nth-child(5) { animation-delay: 0.5s; }

.animate-fade-in-up:nth-child(6),
.animate-fade-in:nth-child(6) { animation-delay: 0.6s; }

/* ============================================
   CARD HOVER EFFECTS
   ============================================ */

.card-hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform, box-shadow;
}

.card-hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

.card-hover-glow {
    transition: box-shadow 0.3s ease;
    will-change: box-shadow;
}

.card-hover-glow:hover {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15) !important;
}

.card-hover-scale {
    transition: transform 0.3s ease;
    will-change: transform;
}

.card-hover-scale:hover {
    transform: scale(1.02);
}

/* ============================================
   LOADING STATES & SKELETON LOADERS
   ============================================ */

@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

.skeleton-loader {
    animation: shimmer 1.2s ease-in-out infinite;
    background: linear-gradient(
        to right,
        #f0f0f0 0%,
        #e8e8e8 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 800px 100%;
    border-radius: 4px;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    width: 100%;
}

.skeleton-text-short {
    height: 14px;
    margin-bottom: 8px;
    width: 60%;
}

.skeleton-heading {
    height: 24px;
    margin-bottom: 12px;
    width: 40%;
}

.skeleton-card {
    height: 120px;
    border-radius: 8px;
}

.skeleton-circle {
    border-radius: 50%;
    height: 48px;
    width: 48px;
}

/* ============================================
   GRAPH & CHART ANIMATIONS
   ============================================ */

@keyframes drawLine {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes growBar {
    from {
        transform: scaleY(0);
        transform-origin: bottom;
    }
    to {
        transform: scaleY(1);
        transform-origin: bottom;
    }
}

@keyframes fadeInPath {
    from {
        opacity: 0;
        fill-opacity: 0;
    }
    to {
        opacity: 1;
        fill-opacity: 1;
    }
}

@keyframes drawCircle {
    from {
        stroke-dashoffset: 314;
    }
    to {
        stroke-dashoffset: 0;
    }
}

/* Progressive number count animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-count {
    animation: countUp 0.8s ease-out;
}

/* ============================================
   INPUT FOCUS EFFECTS
   ============================================ */

.form-control-animated,
.form-select-animated,
.modern-form-control {
    transition: all 0.3s ease;
    position: relative;
}

.form-control-animated:focus,
.form-select-animated:focus,
.modern-form-control:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
    transform: translateY(-1px);
}

/* Glowing border effect */
@keyframes glowBorder {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    }
}

.form-control-animated:focus,
.modern-form-control:focus {
    animation: glowBorder 2s ease-in-out infinite;
}

/* Label float effect */
.form-floating-animated label {
    transition: all 0.3s ease;
}

.form-floating-animated input:focus ~ label,
.form-floating-animated select:focus ~ label,
.form-floating-animated input:not(:placeholder-shown) ~ label {
    transform: translateY(-1.5rem) scale(0.85);
    color: #3b82f6;
}

/* ============================================
   BUTTON RIPPLE & INTERACTIONS
   ============================================ */

.btn-ripple {
    position: relative;
    overflow: hidden;
    transform: translate3d(0, 0, 0);
}

.btn-ripple:after {
    content: "";
    display: block;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, #fff 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform 0.5s, opacity 1s;
}

.btn-ripple:active:after {
    transform: scale(0, 0);
    opacity: 0.3;
    transition: 0s;
}

/* Button hover effects */
.btn-hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-hover-lift:active {
    transform: translateY(0);
}

/* ============================================
   PAGE TRANSITIONS
   ============================================ */

@keyframes pageTransitionIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pageTransitionOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

body {
    transition: opacity 0.3s ease;
}

body.page-transitioning {
    /* Removed opacity fade to prevent translucent state */
}

body.page-loaded {
    /* No animation - instant load */
}

.page-content {
    /* No animation - instant load */
}

/* ============================================
   LOADING SPINNER
   ============================================ */

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    animation: spin 1s linear infinite;
}

.spinner-subtle {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* ============================================
   PULSE ANIMATION
   ============================================ */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ============================================
   BOUNCE ANIMATION (Subtle)
   ============================================ */

@keyframes subtleBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.animate-bounce-subtle {
    animation: subtleBounce 1s ease-in-out;
}

/* ============================================
   SLIDE ANIMATIONS
   ============================================ */

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

.animate-slide-out-right {
    animation: slideOutRight 0.3s ease-out;
}

/* ============================================
   PROGRESS BAR ANIMATION
   ============================================ */

@keyframes progressBar {
    from {
        width: 0%;
    }
}

.animate-progress {
    animation: progressBar 1.5s ease-out forwards;
}

/* ============================================
   NOTIFICATION ANIMATIONS
   ============================================ */

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-enter {
    animation: slideInDown 0.3s ease-out;
}

/* ============================================
   TOOLTIP ANIMATIONS
   ============================================ */

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.tooltip-animated {
    animation: tooltipFadeIn 0.2s ease-out;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Smooth transitions for all interactive elements */
.transition-smooth {
    transition: all 0.3s ease;
}

.transition-fast {
    transition: all 0.15s ease;
}

.transition-slow {
    transition: all 0.5s ease;
}

/* Hover brightness effect */
.hover-brighten:hover {
    filter: brightness(1.1);
}

.hover-dim:hover {
    filter: brightness(0.95);
}

/* Scale on hover */
.hover-scale-sm:hover {
    transform: scale(1.05);
}

.hover-scale-md:hover {
    transform: scale(1.1);
}

/* 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;
    }
}

/* ============================================
   DARK MODE SUPPORT (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .skeleton-loader {
        background: linear-gradient(
            to right,
            #2a2a2a 0%,
            #333333 20%,
            #2a2a2a 40%,
            #2a2a2a 100%
        );
    }
}
