/* KampusPlaza Animations & Transitions */

/* Loading Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes slideInLeft {
    from {
        transform: translateX(-30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0,0,0);
    }
    40%, 43% {
        transform: translate3d(0, -10px, 0);
    }
    70% {
        transform: translate3d(0, -5px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

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

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

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-slide-up {
    animation: slideInUp 0.6s ease-out forwards;
}

.animate-slide-down {
    animation: slideInDown 0.6s ease-out forwards;
}

.animate-slide-left {
    animation: slideInLeft 0.6s ease-out forwards;
}

.animate-slide-right {
    animation: slideInRight 0.6s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.4s ease-out forwards;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-bounce {
    animation: bounce 1s infinite;
}

.animate-rotate {
    animation: rotate 1s linear infinite;
}

/* Staggered animations */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.hover-scale {
    transition: transform 0.3s ease;
}

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

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(27, 85, 226, 0.3);
}

.hover-fade {
    transition: opacity 0.3s ease;
}

.hover-fade:hover {
    opacity: 0.8;
}

/* Button Animations */
.btn-animated {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-animated:hover::before {
    left: 100%;
}

.btn-bounce:hover {
    animation: bounce 0.6s;
}

/* Loading Skeletons */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text.large {
    height: 1.5em;
}

.skeleton-text.small {
    height: 0.8em;
    width: 60%;
}

.skeleton-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.skeleton-image {
    width: 100%;
    height: 200px;
}

/* Page Transitions */
.page-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease;
}

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

.page-exit-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

/* Modal Animations */
.modal-fade {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s ease;
}

.modal-fade.show {
    opacity: 1;
    transform: scale(1);
}

/* Form Animations */
.form-group {
    transition: all 0.3s ease;
}

.form-control {
    transition: all 0.3s ease;
    border: 2px solid #e0e0e0;
}

.form-control:focus {
    border-color: #1b55e2;
    box-shadow: 0 0 0 3px rgba(27, 85, 226, 0.1);
    transform: translateY(-1px);
}

.form-control.error {
    border-color: #ff4757;
    animation: shake 0.5s ease-in-out;
}

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

/* Image Animations */
.image-zoom {
    overflow: hidden;
}

.image-zoom img {
    transition: transform 0.5s ease;
}

.image-zoom:hover img {
    transform: scale(1.1);
}

.image-fade {
    transition: opacity 0.3s ease;
}

.image-fade:hover {
    opacity: 0.9;
}

/* Card Animations */
.card-hover {
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border-color: #1b55e2;
}

/* Progress Animations */
.progress-bar {
    transition: width 0.6s ease;
}

@keyframes progress {
    0% { width: 0%; }
    100% { width: var(--progress-width); }
}

.progress-animate .progress-bar {
    animation: progress 1s ease forwards;
}

/* Toast Animations */
.toast-enter {
    transform: translateX(100%);
    opacity: 0;
}

.toast-enter-active {
    transform: translateX(0);
    opacity: 1;
    transition: all 0.3s ease;
}

.toast-exit {
    transform: translateX(0);
    opacity: 1;
}

.toast-exit-active {
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
}

/* Accordion Animations */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-content.open {
    max-height: 1000px;
}

/* Tab Animations */
.tab-content {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.tab-content.active {
    opacity: 1;
    transform: translateY(0);
}

/* Dropdown Animations */
.dropdown-menu {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.dropdown-menu.show {
    opacity: 1;
    transform: translateY(0);
}

/* Search Animations */
.search-results {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.search-results.show {
    opacity: 1;
    transform: translateY(0);
}

/* Notification Animations */
.notification {
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

/* Loader Animations */
.loader {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1b55e2;
    border-radius: 50%;
    animation: rotate 1s linear infinite;
    margin: 20px auto;
}

.dots-loader {
    display: inline-block;
}

.dots-loader::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Scroll Animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Success/Error Animations */
.success-checkmark {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #4CAF50;
    position: relative;
    margin: 20px auto;
}

.success-checkmark::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 18px;
    width: 10px;
    height: 15px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
    animation: checkmark 0.6s ease forwards;
}

@keyframes checkmark {
    0% { height: 0; }
    100% { height: 15px; }
}

.error-x {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #f44336;
    position: relative;
    margin: 20px auto;
}

.error-x::before,
.error-x::after {
    content: '';
    position: absolute;
    top: 22px;
    left: 15px;
    width: 20px;
    height: 3px;
    background: white;
    border-radius: 2px;
}

.error-x::before {
    transform: rotate(45deg);
    animation: x-mark1 0.6s ease forwards;
}

.error-x::after {
    transform: rotate(-45deg);
    animation: x-mark2 0.6s ease forwards;
}

@keyframes x-mark1 {
    0% { width: 0; }
    100% { width: 20px; }
}

@keyframes x-mark2 {
    0% { width: 0; }
    100% { width: 20px; }
}

/* Utility Classes */
.no-animation {
    animation: none !important;
    transition: none !important;
}

.animation-paused {
    animation-play-state: paused;
}

.animation-running {
    animation-play-state: running;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .btn-animated::before {
        background: linear-gradient(90deg, transparent, rgba(0,0,0,0.2), transparent);
    }
}
