/**
 * PSKOV State University - Animations
 * Smooth, professional animations and transitions
 */

/* ========================================
   KEYFRAME ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }
}

/* ========================================
   ANIMATION CLASSES
   ======================================== */

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

.animate-fade-in-down {
    animation: fadeInDown 0.8s ease-out;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.8s ease-out;
}

.animate-fade-in-right {
    animation: fadeInRight 0.8s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.5s ease-out;
}

.animate-bounce {
    animation: bounce 2s ease-in-out infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Delay Classes */
.delay-100 {
    animation-delay: 100ms;
}

.delay-200 {
    animation-delay: 200ms;
}

.delay-300 {
    animation-delay: 300ms;
}

.delay-400 {
    animation-delay: 400ms;
}

.delay-500 {
    animation-delay: 500ms;
}

/* ========================================
   SCROLL ANIMATIONS (Intersection Observer)
   ======================================== */

.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-animate.active {
    opacity: 1;
    transform: translateY(0);
}

.scroll-animate-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-animate-left.active {
    opacity: 1;
    transform: translateX(0);
}

.scroll-animate-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-animate-right.active {
    opacity: 1;
    transform: translateX(0);
}

.scroll-animate-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-animate-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* ========================================
   HOVER EFFECTS
   ======================================== */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.hover-grow {
    transition: transform 0.3s ease;
}

.hover-grow:hover {
    transform: scale(1.05);
}

.hover-shrink {
    transition: transform 0.3s ease;
}

.hover-shrink:hover {
    transform: scale(0.95);
}

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.5);
}

/* ========================================
   IMAGE EFFECTS
   ======================================== */

.img-zoom-container {
    overflow: hidden;
    border-radius: var(--radius-xl);
}

.img-zoom {
    transition: transform 0.5s ease;
}

.img-zoom-container:hover .img-zoom {
    transform: scale(1.1);
}

.img-overlay {
    position: relative;
    overflow: hidden;
}

.img-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.8) 0%, rgba(255, 215, 0, 0.6) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.img-overlay:hover::after {
    opacity: 1;
}

/* ============================================
   CUSTOM CURSOR (Optional)
   ============================================ */
.custom-cursor {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-primary);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transition: transform 0.2s ease;
}

.custom-cursor.hover {
    transform: scale(1.5);
    background: var(--color-primary);
    opacity: 0.3;
}

/* ============================================
   ENHANCED PAGE ENTRANCE ANIMATIONS
   ============================================ */
@keyframes pageSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pageZoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.page-enter {
    animation: pageSlideUp 0.6s ease-out;
}

.page-zoom-enter {
    animation: pageZoomIn 0.5s ease-out;
}

/* ============================================
   CARD FLIP ANIMATIONS
   ============================================ */
.card-flip-container {
    perspective: 1000px;
}

.card-flip {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-flip:hover {
    transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
    backface-visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
}

.card-flip-back {
    transform: rotateY(180deg);
}

/* ============================================
   ENHANCED BUTTON ANIMATIONS
   ============================================ */
@keyframes buttonPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(139, 21, 56, 0.7);
    }

    50% {
        box-shadow: 0 0 0 15px rgba(139, 21, 56, 0);
    }
}

.btn-pulse {
    animation: buttonPulse 2s infinite;
}

@keyframes buttonShake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.btn-shake:hover {
    animation: buttonShake 0.5s;
}

/* ============================================
   ENHANCED SCROLL ANIMATIONS
   ============================================ */
.scroll-reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-reveal-scale.revealed {
    opacity: 1;
    transform: scale(1);
}

.scroll-reveal-rotate {
    opacity: 0;
    transform: rotate(-10deg) translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-reveal-rotate.revealed {
    opacity: 1;
    transform: rotate(0) translateY(0);
}

/* ============================================
   IMAGE HOVER EFFECTS
   ============================================ */
.img-hover-zoom {
    overflow: hidden;
    position: relative;
}

.img-hover-zoom img {
    transition: transform 0.5s ease;
}

.img-hover-zoom:hover img {
    transform: scale(1.15);
}

.img-hover-brightness {
    position: relative;
    overflow: hidden;
}

.img-hover-brightness::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0);
    transition: background 0.3s ease;
}

.img-hover-brightness:hover::after {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================
   TEXT ANIMATIONS
   ============================================ */
@keyframes textGlow {

    0%,
    100% {
        text-shadow: 0 0 5px rgba(139, 21, 56, 0.5);
    }

    50% {
        text-shadow: 0 0 20px rgba(139, 21, 56, 0.8), 0 0 30px rgba(212, 175, 55, 0.6);
    }
}

.text-glow {
    animation: textGlow 2s ease-in-out infinite;
}

@keyframes textSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.text-slide-in {
    animation: textSlideIn 0.8s ease-out;
}

/* ============================================
   LOADING SPINNER VARIATIONS
   ============================================ */
@keyframes spinnerDots {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.spinner-dots {
    display: inline-flex;
    gap: 8px;
}

.spinner-dots span {
    width: 12px;
    height: 12px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: spinnerDots 1.4s infinite;
}

.spinner-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.spinner-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ============================================
   SECTION DIVIDERS WITH ANIMATION
   ============================================ */
@keyframes dividerExpand {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

.animated-divider {
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    animation: dividerExpand 1.5s ease-out;
}

/* ============================================
   ENHANCED CARD ANIMATIONS
   ============================================ */
.card-slide-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.card-slide-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.card-bounce-in {
    animation: bounceIn 0.8s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

/* ============================================
   BACKGROUND ANIMATIONS
   ============================================ */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.animated-gradient {
    background: linear-gradient(-45deg, var(--color-primary), var(--color-primary-dark), var(--color-secondary), var(--color-primary));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* ============================================
   ICON ANIMATIONS
   ============================================ */
@keyframes iconBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.icon-bounce {
    animation: iconBounce 2s ease-in-out infinite;
}

@keyframes iconRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.icon-rotate {
    animation: iconRotate 3s linear infinite;
}

.icon-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ========================================
   LOADING ANIMATIONS
   ======================================== */

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-gray-200);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

.skeleton {
    background: linear-gradient(90deg,
            var(--color-gray-200) 0%,
            var(--color-gray-100) 50%,
            var(--color-gray-200) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* ========================================
   PARALLAX EFFECTS
   ======================================== */

.parallax {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.parallax-slow {
    transform: translateZ(-1px) scale(2);
}

/* ========================================
   TEXT EFFECTS
   ======================================== */

.gradient-text {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.typing-effect {
    overflow: hidden;
    border-right: 2px solid var(--color-primary);
    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: var(--color-primary);
    }
}

/* ========================================
   BUTTON ANIMATIONS
   ======================================== */

.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-shine:hover::before {
    left: 100%;
}

/* ========================================
   CARD ANIMATIONS
   ======================================== */

.card-flip {
    perspective: 1000px;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.card-flip-back {
    transform: rotateY(180deg);
}

/* ========================================
   MODAL ANIMATIONS
   ======================================== */

.modal-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.modal-slide-up {
    animation: slideInUp 0.4s ease-out;
}

/* ========================================
   PROGRESS ANIMATIONS
   ======================================== */

.progress-bar {
    position: relative;
    height: 8px;
    background: var(--color-gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-radius: var(--radius-full);
    transition: width 1s ease-out;
}

/* ========================================
   NOTIFICATION ANIMATIONS
   ======================================== */

.notification-enter {
    animation: fadeInRight 0.4s ease-out;
}

.notification-exit {
    animation: fadeInRight 0.4s ease-out reverse;
}

/* ========================================
   STAGGER ANIMATIONS
   ======================================== */

.stagger-item {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-item.active {
    animation: fadeInUp 0.6s ease-out forwards;
}

.stagger-item:nth-child(1) {
    animation-delay: 0.1s;
}

.stagger-item:nth-child(2) {
    animation-delay: 0.2s;
}

.stagger-item:nth-child(3) {
    animation-delay: 0.3s;
}

.stagger-item:nth-child(4) {
    animation-delay: 0.4s;
}

.stagger-item:nth-child(5) {
    animation-delay: 0.5s;
}

.stagger-item:nth-child(6) {
    animation-delay: 0.6s;
}