/* ===================================
   MICRO-INTERACTIONS & ANIMATIONS
   Smooth transitions and feedback
   =================================== */

/* ===================================
   BUTTON ANIMATIONS
   =================================== */

.btn-primary,
.btn-secondary {
    position: relative;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover,
.btn-secondary:hover {
    transform: translateY(-1px);
}

.btn-primary:active,
.btn-secondary:active {
    transform: translateY(0) scale(0.98);
}

/* Ripple effect on click */
.btn-primary::after,
.btn-secondary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

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

/* ===================================
   PANEL TRANSITIONS
   =================================== */

/* Slide up from bottom (mobile) */
.slide-up-enter {
    transform: translateY(100%);
    opacity: 0;
}

.slide-up-enter-active {
    transform: translateY(0);
    opacity: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-up-exit {
    transform: translateY(0);
    opacity: 1;
}

.slide-up-exit-active {
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Fade transition */
.fade-enter {
    opacity: 0;
}

.fade-enter-active {
    opacity: 1;
    transition: opacity 0.2s ease;
}

.fade-exit {
    opacity: 1;
}

.fade-exit-active {
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* ===================================
   TAB SWITCHING ANIMATIONS
   =================================== */

.tab-content {
    animation: tabFadeIn 0.3s ease;
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* ===================================
   LOADING STATES
   =================================== */

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-gray-200);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.spinner-small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.loading-overlay {
    position: fixed;
    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: 9999;
    animation: fadeIn 0.2s ease;
}

.skeleton {
    background: linear-gradient(90deg,
            var(--color-gray-200) 25%,
            var(--color-gray-100) 50%,
            var(--color-gray-200) 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;
    }
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-card {
    height: 200px;
    border-radius: 12px;
}

/* ===================================
   SUCCESS/ERROR ANIMATIONS
   =================================== */

.checkmark {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: var(--color-success);
    stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px var(--color-success);
    animation: fillCheck 0.4s ease-in-out 0.4s forwards, scaleCheck 0.3s ease-in-out 0.9s both;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: var(--color-success);
    fill: none;
    animation: strokeCheck 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: strokeCheck 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes strokeCheck {
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes scaleCheck {

    0%,
    100% {
        transform: none;
    }

    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}

@keyframes fillCheck {
    100% {
        box-shadow: inset 0px 0px 0px 30px var(--color-success);
    }
}

/* Success flash */
.success-flash {
    animation: flashSuccess 0.5s ease;
}

@keyframes flashSuccess {

    0%,
    100% {
        background-color: transparent;
    }

    50% {
        background-color: rgba(0, 132, 137, 0.1);
    }
}

/* Error shake */
.error-shake {
    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);
    }
}

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

.hover-lift {
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.hover-grow {
    transition: transform 0.2s;
}

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

/* ===================================
   PULSING ANIMATIONS
   =================================== */

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 56, 92, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 56, 92, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 56, 92, 0);
    }
}

.pulse-subtle {
    animation: pulseSubtle 2s infinite;
}

@keyframes pulseSubtle {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

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

.scroll-fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ===================================
   TOGGLE ANIMATIONS
   =================================== */

.toggle-switch {
    width: 50px;
    height: 26px;
    background: var(--color-gray-400);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: var(--color-primary);
}

.toggle-handle {
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active .toggle-handle {
    transform: translateX(24px);
}

/* ===================================
   PROGRESS ANIMATIONS
   =================================== */

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--color-gray-200);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.progress-indeterminate {
    animation: indeterminate 1.5s infinite;
}

@keyframes indeterminate {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(400%);
    }
}