/* ============================================================================
   PROGHAMA TECH - MODERN ANIMATIONS & TRANSITIONS
   ============================================================================
   Professional animations that enhance UX without compromising performance
   ========================================================================== */

/* ============================================================================
   1. KEYFRAME ANIMATIONS
   ============================================================================ */

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Slide Up Animation */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide Down Animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide Left Animation */
@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide Right Animation */
@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Zoom In Animation */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Bounce Animation */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(220, 20, 60, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(220, 20, 60, 0.6);
    }
}

/* Gradient Shift Animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================================
   2. UTILITY ANIMATION CLASSES
   ============================================================================ */

/* Fade In Utilities */
.animate-fade-in {
    animation: fadeIn 0.6s ease-in-out forwards;
}

.animate-fade-in-slow {
    animation: fadeIn 1s ease-in-out forwards;
}

.animate-fade-in-fast {
    animation: fadeIn 0.3s ease-in-out forwards;
}

/* Slide Animations */
.animate-slide-up {
    animation: slideUp 0.6s ease-out forwards;
}

.animate-slide-down {
    animation: slideDown 0.6s ease-out forwards;
}

.animate-slide-left {
    animation: slideLeft 0.6s ease-out forwards;
}

.animate-slide-right {
    animation: slideRight 0.6s ease-out forwards;
}

/* Zoom Animation */
.animate-zoom-in {
    animation: zoomIn 0.6s ease-out forwards;
}

/* Bounce Animation */
.animate-bounce {
    animation: bounce 1s ease-in-out infinite;
}

/* Pulse Animation */
.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Glow Animation */
.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

/* ============================================================================
   3. STAGGERED ANIMATIONS (For lists/grids)
   ============================================================================ */

.animate-stagger > * {
    animation: slideUp 0.6s ease-out forwards;
    opacity: 0;
}

.animate-stagger > *:nth-child(1) { animation-delay: 0.1s; }
.animate-stagger > *:nth-child(2) { animation-delay: 0.2s; }
.animate-stagger > *:nth-child(3) { animation-delay: 0.3s; }
.animate-stagger > *:nth-child(4) { animation-delay: 0.4s; }
.animate-stagger > *:nth-child(5) { animation-delay: 0.5s; }
.animate-stagger > *:nth-child(6) { animation-delay: 0.6s; }
.animate-stagger > *:nth-child(n+7) { animation-delay: 0.7s; }

/* ============================================================================
   4. SCROLL REVEAL ANIMATIONS
   ============================================================================ */

.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scroll-reveal.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Alternative reveal animations */
.scroll-reveal-up {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scroll-reveal-up.in-view {
    opacity: 1;
    transform: translateY(0);
}

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: all 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scroll-reveal-left.in-view {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition: all 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scroll-reveal-right.in-view {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-zoom {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scroll-reveal-zoom.in-view {
    opacity: 1;
    transform: scale(1);
}

/* ============================================================================
   5. ENHANCED COMPONENT ANIMATIONS
   ============================================================================ */

/* Card Hover Effects */
.card {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

/* Button Animations */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease-in-out !important;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    pointer-events: none;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(220, 20, 60, 0.2);
}

.btn:active {
    transform: translateY(-1px);
}

/* Primary Button Animation */
.btn-primary {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.btn-primary:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(220, 20, 60, 0.3);
}

/* ============================================================================
   6. NAVIGATION ANIMATIONS
   ============================================================================ */

/* Navbar Slide Down */
.navbar {
    animation: slideDown 0.5s ease-out;
}

.navbar.sticky-nav {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease-out;
}

/* Offcanvas mobile menu full-height fix */
.offcanvas {
    height: 100vh !important;
    max-height: 100vh !important;
}

.offcanvas-body {
    max-height: calc(100vh - 4.5rem) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    padding-bottom: 1rem !important;
}

@media (max-width: 576px) {
    .offcanvas {
        width: 100vw !important;
    }
}

/* Nav Link Underline Animation */
.navbar-nav .nav-link {
    position: relative;
    transition: color 0.3s ease-in-out;
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--bs-primary);
    transition: width 0.3s ease-in-out;
}

.navbar-nav .nav-link:hover::after {
    width: 100%;
}

.navbar-nav .nav-link.active::after {
    width: 100%;
}

/* ============================================================================
   7. FORM ANIMATIONS
   ============================================================================ */

/* Input Focus Animation */
.form-control,
.form-select {
    transition: all 0.3s ease-in-out;
    border-color: rgba(220, 20, 60, 0.3);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(220, 20, 60, 0.25);
    animation: pulse 0.3s ease-in-out;
}

/* Form Label Animation */
.form-floating > label {
    transition: all 0.3s ease-in-out;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: var(--bs-primary);
}

/* ============================================================================
   8. LOADING & SPINNER ANIMATIONS
   ============================================================================ */

.spinner-border {
    animation: rotate 1s linear infinite;
}

.page-loader {
    animation: fadeIn 0.5s ease-in-out;
}

.page-loader__logo {
    animation: bounce 2s ease-in-out infinite;
}

.page-loader__text {
    animation: slideUp 0.8s ease-out 0.3s forwards;
    opacity: 0;
}

.page-loader.is-hidden {
    opacity: 0;
    pointer-events: none;
}

/* ============================================================================
   9. BACK TO TOP BUTTON ANIMATION
   ============================================================================ */

#backToTop {
    transition: all 0.3s ease-in-out;
    animation: fadeIn 0.3s ease-in-out;
}

#backToTop:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(220, 20, 60, 0.3);
}

/* ============================================================================
   10. TEXT ANIMATIONS
   ============================================================================ */

/* Typing Animation */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.animate-typing {
    animation: typing 3s steps(40, end) forwards;
    white-space: nowrap;
    overflow: hidden;
    border-right: 3px solid var(--bs-primary);
}

/* Gradient Text Animation */
.animate-gradient-text {
    background: linear-gradient(90deg, var(--bs-primary), #2E7D9A, var(--bs-primary));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
}

/* ============================================================================
   11. HERO SECTION ANIMATIONS
   ============================================================================ */

.hero-content {
    animation: slideUp 0.8s ease-out;
}

.hero-content h1 {
    animation: slideUp 0.8s ease-out 0.1s forwards;
    opacity: 0;
}

.hero-content p {
    animation: slideUp 0.8s ease-out 0.2s forwards;
    opacity: 0;
}

.hero-content .btn {
    animation: slideUp 0.8s ease-out 0.3s forwards;
    opacity: 0;
}

.hero-image {
    animation: zoomIn 0.8s ease-out 0.1s forwards;
    opacity: 0;
}

/* ============================================================================
   12. SOCIAL ICONS ANIMATION
   ============================================================================ */

.social-links a {
    transition: all 0.3s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.social-links a:hover {
    transform: translateY(-8px) rotate(5deg) scale(1.1);
}

/* ============================================================================
   13. BADGE & BADGE PULSE
   ============================================================================ */

.badge {
    transition: all 0.3s ease-in-out;
    animation: slideUp 0.6s ease-out;
}

.badge.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ============================================================================
   14. TESTIMONIAL & CAROUSEL ANIMATIONS
   ============================================================================ */

.carousel-item {
    animation: fadeIn 0.6s ease-in-out;
}

.testimonial {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.testimonial:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

/* ============================================================================
   15. MODAL ANIMATIONS
   ============================================================================ */

.modal.fade {
    animation: fadeIn 0.3s ease-in-out;
}

.modal-content {
    animation: slideUp 0.4s ease-out;
}

/* ============================================================================
   16. SECTION ANIMATIONS
   ============================================================================ */

.section {
    position: relative;
}

.section h2 {
    animation: slideUp 0.8s ease-out;
}

/* ============================================================================
   17. RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Optimize animations for smaller screens */
@media (max-width: 768px) {
    .animate-stagger > * {
        animation-delay: 0.05s !important;
    }

    .card:hover {
        transform: translateY(-4px);
    }

    .btn:hover {
        transform: translateY(-2px);
    }

    .social-links a:hover {
        transform: translateY(-4px) rotate(5deg);
    }
}

/* ============================================================================
   18. PERFORMANCE OPTIMIZATION
   ============================================================================ */

/* Use will-change for better performance on animated elements */
.animate-fade-in,
.animate-slide-up,
.animate-slide-down,
.animate-slide-left,
.animate-slide-right,
.animate-zoom-in {
    will-change: opacity, transform;
}

/* GPU acceleration for smooth animations */
.card,
.btn,
.scroll-reveal,
.navbar {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}
