/* ===================================
   AIFortess - Animations & Effects
   =================================== */

/* Scan Line Effect on Buttons */
.btn-primary,
.btn-secondary {
    position: relative;
    overflow: hidden;
}

.btn-primary::before,
.btn-secondary::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.btn-primary:hover::before,
.btn-secondary:hover::before {
    animation: scanLine 1.5s infinite;
    opacity: 1;
}

@keyframes scanLine {
    0% {
        transform: translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateY(100%) rotate(45deg);
    }
}

/* Glow Pulse Animation */
.btn-primary {
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 152, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 152, 0, 0.6), 0 0 30px rgba(255, 152, 0, 0.4);
    }
}

/* Card Hover Lift */
.feature-card,
.service-card,
.use-case-card,
.why-card,
.risk-card {
    position: relative;
}

.feature-card::after,
.service-card::after,
.use-case-card::after,
.why-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, transparent, rgba(25, 118, 210, 0.4), rgba(255, 152, 0, 0.4), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-card:hover::after,
.service-card:hover::after,
.use-case-card:hover::after,
.why-card:hover::after {
    opacity: 1;
}

/* Fade In Animations */
.fade-in {
    animation: fadeIn 0.8s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s ease forwards;
}

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

.fade-in-down {
    animation: fadeInDown 0.8s ease forwards;
}

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

.fade-in-left {
    animation: fadeInLeft 0.8s ease forwards;
}

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

.fade-in-right {
    animation: fadeInRight 0.8s ease forwards;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(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; }
.stagger-6 { animation-delay: 0.6s; }

/* Gradient Shift on Cards */
.service-card.featured {
    background: linear-gradient(135deg,
        rgba(25, 118, 210, 0.05) 0%,
        rgba(255, 152, 0, 0.05) 100%);
    background-size: 200% 200%;
    animation: gradientShift 5s ease infinite;
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Terminal Typing Effect */
.terminal-line.typing {
    overflow: hidden;
    border-right: 2px solid var(--neon-green);
    white-space: nowrap;
    animation: typing 2s steps(40) 1s forwards, cursorBlink 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes cursorBlink {
    0%, 100% {
        border-color: var(--neon-green);
    }
    50% {
        border-color: transparent;
    }
}

/* Icon Spin on Hover */
.btn:hover .btn-icon {
    animation: iconSpin 0.5s ease;
}

@keyframes iconSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Neon Border Animation */
.neon-border {
    position: relative;
}

.neon-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(45deg,
        #1976D2,
        #FF9800,
        #1976D2);
    background-size: 300% 300%;
    animation: neonBorder 3s ease infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

@keyframes neonBorder {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Floating Animation */
.floating {
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Scale on Hover */
.scale-hover {
    transition: transform 0.3s ease;
}

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

/* Shimmer Effect */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Number Counter Animation */
.stat-value {
    animation: countUp 1s ease-out forwards;
}

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

/* Badge Slide In */
.badge {
    animation: slideIn 0.5s ease forwards;
}

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

/* Use Case Number Reveal */
.use-case-number {
    position: relative;
    overflow: hidden;
}

.use-case-card:hover .use-case-number {
    animation: numberReveal 0.5s ease;
}

@keyframes numberReveal {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px) scale(1.1);
    }
}

/* Risk Icon Bounce */
.risk-card:hover .risk-icon {
    animation: iconBounce 0.5s ease;
}

@keyframes iconBounce {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-10px);
    }
    50% {
        transform: translateY(-5px);
    }
    75% {
        transform: translateY(-7px);
    }
}

/* Why Icon Rotate */
.why-card:hover .why-icon {
    animation: iconRotate 0.6s ease;
}

@keyframes iconRotate {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.2);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Nav Link Underline Slide */
.nav-link::after {
    transform-origin: left;
}

/* Terminal Dot Pulse */
.terminal-dot:nth-child(1) {
    animation: dotPulse 1.5s ease-in-out infinite;
}

.terminal-dot:nth-child(2) {
    animation: dotPulse 1.5s ease-in-out 0.3s infinite;
}

.terminal-dot:nth-child(3) {
    animation: dotPulse 1.5s ease-in-out 0.6s infinite;
}

@keyframes dotPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.9);
    }
}

/* Comparison VS Badge Spin */
.comparison-divider span {
    transition: transform 0.5s ease;
}

.comparison-table:hover .comparison-divider span {
    transform: rotate(360deg);
}

/* Footer Social Icon Hover */
.footer-social a {
    position: relative;
}

.footer-social a::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    background: linear-gradient(135deg, #1976D2, #FF9800);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.footer-social a:hover::before {
    opacity: 1;
}

/* Scroll Reveal Classes (Applied via JS) */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.8s ease;
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.8s ease;
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

/* Mobile Menu Slide Animation */
@media (max-width: 768px) {
    .nav-menu.active .nav-link {
        animation: slideInRight 0.3s ease forwards;
    }

    .nav-menu.active .nav-link:nth-child(1) { animation-delay: 0.1s; }
    .nav-menu.active .nav-link:nth-child(2) { animation-delay: 0.2s; }
    .nav-menu.active .nav-link:nth-child(3) { animation-delay: 0.3s; }
    .nav-menu.active .nav-link:nth-child(4) { animation-delay: 0.4s; }
    .nav-menu.active .nav-link:nth-child(5) { animation-delay: 0.5s; }

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

/* Background Glow Effects */
.glow-blue {
    box-shadow: 0 0 20px rgba(25, 118, 210, 0.4);
}

.glow-orange {
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.4);
}

.glow-green {
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
}

/* Loading Spinner (for future use) */
.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(25, 118, 210, 0.1);
    border-top-color: #1976D2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Particle Effect Background (Optional) */
@keyframes particleFloat {
    0%, 100% {
        transform: translate(0, 0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translate(100px, -100px);
        opacity: 0;
    }
}

/* Text Typing Cursor */
.cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: #FF9800;
    margin-left: 2px;
    animation: cursorBlink 1s infinite;
}

/* Smooth Color Transitions */
* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-duration: 0.2s;
    transition-timing-function: ease;
}

/* Disable transitions on certain elements */
.terminal-line,
.btn::before,
.nav-link::after {
    transition: none;
}

/* 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;
    }
}
