/* ===================================
   Animations CSS
   All animation and transition effects
   =================================== */

/* ===================================
   Fade In Animations
   =================================== */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
}

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s ease forwards;
}

.fade-in-down {
    opacity: 0;
    transform: translateY(-30px);
    animation: fadeInDown 0.8s ease forwards;
}

.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
    animation: fadeInLeft 0.8s ease forwards;
}

.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
    animation: fadeInRight 0.8s ease forwards;
}

/* Keyframes */
@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===================================
   Scale Animations
   =================================== */
.scale-in {
    opacity: 0;
    transform: scale(0.9);
    animation: scaleIn 0.6s ease forwards;
}

@keyframes scaleIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===================================
   Slide Animations
   =================================== */
.slide-in-left {
    transform: translateX(-100%);
    animation: slideInLeft 0.6s ease forwards;
}

.slide-in-right {
    transform: translateX(100%);
    animation: slideInRight 0.6s ease forwards;
}

@keyframes slideInLeft {
    to {
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    to {
        transform: translateX(0);
    }
}

/* ===================================
   Bounce Animations
   =================================== */
.bounce {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

/* ===================================
   Pulse Animations
   =================================== */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ===================================
   Shake Animation
   =================================== */
.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

/* ===================================
   Rotate Animations
   =================================== */
.rotate-in {
    opacity: 0;
    transform: rotate(-180deg);
    animation: rotateIn 0.8s ease forwards;
}

@keyframes rotateIn {
    to {
        opacity: 1;
        transform: rotate(0);
    }
}

/* ===================================
   Flip Animations
   =================================== */
.flip {
    animation: flip 1s ease;
}

@keyframes flip {
    0% {
        transform: perspective(400px) rotateY(0);
    }
    50% {
        transform: perspective(400px) rotateY(180deg);
    }
    100% {
        transform: perspective(400px) rotateY(360deg);
    }
}

/* ===================================
   Glow Effect
   =================================== */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px rgba(26, 77, 143, 0.2),
                    0 0 10px rgba(26, 77, 143, 0.2),
                    0 0 15px rgba(26, 77, 143, 0.2);
    }
    to {
        box-shadow: 0 0 10px rgba(26, 77, 143, 0.4),
                    0 0 20px rgba(26, 77, 143, 0.4),
                    0 0 30px rgba(26, 77, 143, 0.4);
    }
}

/* ===================================
   Floating Animation
   =================================== */
.float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* ===================================
   Gradient Animation
   =================================== */
.gradient-animate {
    background: linear-gradient(270deg, #1a4d8f, #2563b8, #1a4d8f);
    background-size: 400% 400%;
    animation: gradientShift 10s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ===================================
   Text Animations
   =================================== */
.text-focus-in {
    animation: textFocusIn 1s cubic-bezier(0.55, 0.085, 0.68, 0.53) both;
}

@keyframes textFocusIn {
    0% {
        filter: blur(12px);
        opacity: 0;
    }
    100% {
        filter: blur(0);
        opacity: 1;
    }
}

.text-shadow-pop {
    animation: textShadowPop 0.6s both;
}

@keyframes textShadowPop {
    0% {
        text-shadow: 0 0 #1a4d8f, 0 0 #1a4d8f, 0 0 #1a4d8f, 0 0 #1a4d8f;
        transform: translateX(0) translateY(0);
    }
    100% {
        text-shadow: 1px 1px #1a4d8f, 2px 2px #1a4d8f, 3px 3px #1a4d8f, 4px 4px #1a4d8f;
        transform: translateX(-4px) translateY(-4px);
    }
}

/* ===================================
   Number Counter Animation
   =================================== */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.count-up {
    animation: countUp 1s ease-out;
}

/* ===================================
   Loading Animations
   =================================== */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: #1a4d8f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.dots-loading {
    display: inline-flex;
    gap: 5px;
}

.dots-loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #1a4d8f;
    animation: dotsPulse 1.4s infinite ease-in-out both;
}

.dots-loading span:nth-child(1) {
    animation-delay: -0.32s;
}

.dots-loading span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dotsPulse {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* ===================================
   Ripple Effect
   =================================== */
.ripple {
    position: relative;
    overflow: hidden;
}

.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;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* ===================================
   Hover Effects
   =================================== */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px 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);
}

/* ===================================
   Border Animations
   =================================== */
.border-animate {
    position: relative;
    border: 2px solid transparent;
}

.border-animate::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #1a4d8f, #2563b8, #25d366, #1a4d8f);
    background-size: 400%;
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: borderGradient 3s linear infinite;
}

.border-animate:hover::before {
    opacity: 1;
}

@keyframes borderGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ===================================
   Progress Bar Animation
   =================================== */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1a4d8f, #2563b8);
    border-radius: 10px;
    animation: progressFill 2s ease-out forwards;
}

@keyframes progressFill {
    from {
        width: 0%;
    }
    to {
        width: var(--progress-width, 100%);
    }
}

/* ===================================
   Shimmer Effect (Loading State)
   =================================== */
.shimmer {
    background: linear-gradient(90deg,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s linear infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ===================================
   Typewriter Effect
   =================================== */
.typewriter {
    overflow: hidden;
    border-left: 0.15em solid #1a4d8f;
    white-space: nowrap;
    margin: 0 auto;
    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: #1a4d8f;
    }
}

/* ===================================
   Slide Up on Scroll
   =================================== */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ===================================
   Stagger Animation Delays
   =================================== */
.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;
}

/* ===================================
   Card Flip Animation
   =================================== */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* ===================================
   Attention Seekers
   =================================== */
.heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(0.9);
    }
    20%, 40% {
        transform: scale(1.1);
    }
}

.wobble {
    animation: wobble 1s ease;
}

@keyframes wobble {
    0%, 100% {
        transform: translateX(0);
    }
    15% {
        transform: translateX(-25px) rotate(-5deg);
    }
    30% {
        transform: translateX(20px) rotate(3deg);
    }
    45% {
        transform: translateX(-15px) rotate(-3deg);
    }
    60% {
        transform: translateX(10px) rotate(2deg);
    }
    75% {
        transform: translateX(-5px) rotate(-1deg);
    }
}

/* ===================================
   SVG Drawing Animation
   =================================== */
.draw-svg {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: draw 3s ease-out forwards;
}

@keyframes draw {
    to {
        stroke-dashoffset: 0;
    }
}

/* ===================================
   Blur In Animation
   =================================== */
.blur-in {
    filter: blur(10px);
    opacity: 0;
    animation: blurIn 1s ease forwards;
}

@keyframes blurIn {
    to {
        filter: blur(0);
        opacity: 1;
    }
}

/* ===================================
   Elastic Animation
   =================================== */
.elastic {
    animation: elastic 1s ease-out;
}

@keyframes elastic {
    0% {
        transform: scale(0);
    }
    55% {
        transform: scale(1.2);
    }
    70% {
        transform: scale(0.9);
    }
    85% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* ===================================
   Zoom In/Out
   =================================== */
.zoom-in {
    opacity: 0;
    transform: scale(0.5);
    animation: zoomIn 0.6s ease forwards;
}

.zoom-out {
    opacity: 1;
    transform: scale(1);
    animation: zoomOut 0.6s ease forwards;
}

@keyframes zoomIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomOut {
    to {
        opacity: 0;
        transform: scale(0.5);
    }
}

/* ===================================
   Slide & Fade Combined
   =================================== */
.slide-fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.slide-fade-up.active {
    opacity: 1;
    transform: translateY(0);
}

/* ===================================
   Image Parallax Effect
   =================================== */
.parallax-image {
    transition: transform 0.5s ease-out;
}

/* ===================================
   Button Animations
   =================================== */
.btn-hover-fill {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-hover-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.2);
    transition: left 0.3s ease;
    z-index: -1;
}

.btn-hover-fill:hover::before {
    left: 100%;
}

/* ===================================
   Mobile Menu Animation
   =================================== */
.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* ===================================
   Scroll Animations (Intersection Observer)
   =================================== */
[data-animate] {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-animate].animated {
    opacity: 1;
}

[data-animate="fade-up"].animated {
    transform: translateY(0);
}

[data-animate="fade-left"].animated {
    transform: translateX(0);
}

[data-animate="fade-right"].animated {
    transform: translateX(0);
}

[data-animate="scale"].animated {
    transform: scale(1);
}

/* ===================================
   Performance Optimization
   =================================== */
.will-animate {
    will-change: transform, opacity;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
