/* Micro-interactions CSS for School Bench Pro */

/* Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Burst Animation */
.btn-burst {
    position: relative;
    overflow: visible;
}

.burst-animation {
    position: absolute;
    width: 10px;
    height: 10px;
    background: currentColor;
    border-radius: 50%;
    opacity: 0;
    animation: burst 1s ease-out;
    pointer-events: none;
}

@keyframes burst {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        transform: scale(5);
        opacity: 0;
    }
}

/* Page Transitions */
.page-transition-in {
    animation: pageIn 0.5s ease-out forwards;
}

.page-transition-out {
    animation: pageOut 0.5s ease-in forwards;
}

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

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

/* Typewriter Effect */
.typewriter {
    visibility: hidden;
    border-right: 2px solid #3b82f6;
    animation: blink 0.7s step-end infinite;
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

/* Rotating Words */
.rotating-words {
    position: relative;
    height: 1.5em;
    overflow: hidden;
}

.rotating-words .word {
    position: absolute;
    width: 100%;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.rotating-words .word.active {
    opacity: 1;
    transform: translateY(0);
}

/* Magnetic Effect */
.magnetic {
    transition: transform 0.3s ease-out;
}

/* Progress Bar Animation */
.progress-animated {
    width: 0;
    transition: width 2s ease-out;
}

/* Skeleton Loader Fade */
.skeleton-loader.loaded {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

/* Enhanced Focus States */
.focus-scale:focus {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

.focus-glow:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5), 0 0 20px rgba(59, 130, 246, 0.3);
    transition: box-shadow 0.2s ease;
}

/* Smooth Scroll Indicator */
.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(to right, #3b82f6, #a855f7);
    transition: width 0.2s ease;
    z-index: 9999;
}

/* Tooltip Animations */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #1f2937;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    border: 6px solid transparent;
    border-top-color: #1f2937;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

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

/* Smooth Link Underline */
.link-underline {
    position: relative;
    text-decoration: none;
}

.link-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.3s ease;
}

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

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

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

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

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Card Tilt Effect */
.card-tilt {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.card-tilt:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* Smooth Height Transition */
.collapse {
    overflow: hidden;
    transition: height 0.3s ease;
}

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

.loading-dots span {
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
    animation: loading-bounce 1.4s ease-in-out infinite both;
}

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

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

@keyframes loading-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Smooth Number Transitions */
.number-transition {
    display: inline-block;
    transition: transform 0.3s ease;
}

.number-transition.changing {
    transform: rotateX(90deg);
}

/* Interactive Background */
.interactive-bg {
    position: relative;
    overflow: hidden;
}

.interactive-bg::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1), transparent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.interactive-bg:hover::before {
    width: 200%;
    height: 200%;
}