/* ========================================
   DeviceHeed - Modern Animations & Effects
   ======================================== */

/* === Keyframe Animations === */

@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 slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

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

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

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

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

@keyframes slideDown {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 500px;
        opacity: 1;
    }
}

/* === Button Animations === */

.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 102, 204, 0.3);
}

.btn:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0, 102, 204, 0.2);
}

/* Pulse animation for primary buttons */
.btn-primary {
    animation: pulse 2s ease-in-out infinite;
}

.btn-primary:hover {
    animation: none;
}

/* === Card Animations === */

.card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.05) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: var(--radius-lg);
    pointer-events: none;
}

.card:hover::after {
    opacity: 1;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 102, 204, 0.15);
}

/* Card icon animations */
.card-icon {
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.card:hover .card-icon {
    transform: scale(1.15) rotate(5deg);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--bg-white);
}

/* === Icon Animations === */

.icon-float {
    animation: float 3s ease-in-out infinite;
}

.icon-bounce {
    animation: bounce 2s infinite;
}

.icon-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.icon-rotate {
    animation: rotate 20s linear infinite;
}

/* === Navigation Animations === */

.navbar {
    transition: all 0.3s ease;
}

.navbar-menu a {
    position: relative;
    overflow: hidden;
}

.navbar-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.navbar-menu a:hover::after,
.navbar-menu a.active::after {
    transform: translateX(0);
}

/* === Hero Section Animations === */

.hero {
    position: relative;
    overflow: hidden;
}

.hero::before {
    animation: shimmer 3s infinite linear;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    background-size: 1000px 100%;
}

.hero h1 {
    animation: fadeInDown 0.8s ease-out;
}

.hero-subheadline {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-cta {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

/* === Timeline Animations === */

.timeline-item {
    opacity: 0;
    animation: fadeInLeft 0.6s ease-out forwards;
}

.timeline-item:nth-child(even) {
    animation: fadeInRight 0.6s ease-out forwards;
}

.timeline-number {
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
}

.timeline-number::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    transform: scale(0);
    transition: transform 0.4s ease;
    border-radius: 50%;
}

.timeline-item:hover .timeline-number {
    transform: scale(1.1) rotate(360deg);
}

.timeline-item:hover .timeline-number::before {
    transform: scale(1);
}

/* === Accordion Animations === */

.accordion-item {
    transition: all 0.3s ease;
}

.accordion-header {
    transition: all 0.3s ease;
}

.accordion-header:hover {
    background-color: var(--bg-light);
    transform: translateX(5px);
}

.accordion-icon {
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
    color: var(--primary-color);
}

.accordion-content {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Form Animations === */

.form-control {
    transition: all 0.3s ease;
    position: relative;
}

.form-control:focus {
    transform: scale(1.02);
    border-color: var(--primary-color);
}

.form-group {
    animation: fadeInUp 0.5s ease-out backwards;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }
.form-group:nth-child(5) { animation-delay: 0.5s; }
.form-group:nth-child(6) { animation-delay: 0.6s; }

/* === Badge Animations === */

.badge {
    animation: pulse 2s ease-in-out infinite;
    transition: all 0.3s ease;
}

.badge:hover {
    animation: none;
    transform: scale(1.1);
}

/* === Highlight Box Animations === */

.highlight-box {
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.highlight-box::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color), var(--primary-color));
    background-size: 400% 400%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: shimmer 3s ease infinite;
    border-radius: var(--radius-md);
}

.highlight-box:hover::before {
    opacity: 0.5;
}

.highlight-box:hover {
    transform: scale(1.02);
}

/* === Footer Animations === */

.footer-links a {
    position: relative;
    transition: all 0.3s ease;
}

.footer-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.6);
    transition: width 0.3s ease;
}

.footer-links a:hover::after {
    width: 100%;
}

.footer-links a:hover {
    transform: translateX(5px);
}

/* === Section Header Animations === */

.section-header {
    animation: fadeInDown 0.6s ease-out;
}

.section-title {
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

/* === Grid Animations === */

.grid > * {
    animation: scaleIn 0.5s ease-out backwards;
}

.grid > *:nth-child(1) { animation-delay: 0.1s; }
.grid > *:nth-child(2) { animation-delay: 0.2s; }
.grid > *:nth-child(3) { animation-delay: 0.3s; }
.grid > *:nth-child(4) { animation-delay: 0.4s; }
.grid > *:nth-child(5) { animation-delay: 0.5s; }
.grid > *:nth-child(6) { animation-delay: 0.6s; }

/* === CTA Section Animations === */

.cta-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: float 20s ease-in-out infinite;
}

/* === Loading States === */

.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}

/* === Scroll Reveal Animations === */

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* === Stagger Delays for Cards === */

[data-animate]:nth-child(1) { animation-delay: 0.1s; }
[data-animate]:nth-child(2) { animation-delay: 0.2s; }
[data-animate]:nth-child(3) { animation-delay: 0.3s; }
[data-animate]:nth-child(4) { animation-delay: 0.4s; }
[data-animate]:nth-child(5) { animation-delay: 0.5s; }
[data-animate]:nth-child(6) { animation-delay: 0.6s; }

/* === Gradient Background Animation === */

.gradient-animate {
    background: linear-gradient(270deg, var(--primary-color), var(--primary-light), var(--accent-color));
    background-size: 600% 600%;
    animation: gradientShift 8s ease infinite;
}

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

/* === Interactive Hover Effects === */

.interactive-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.interactive-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* === Particle Effect for Hero === */

.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    animation: particleFloat 15s infinite ease-in-out;
}

@keyframes particleFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(100px, -100px) scale(0.5);
    }
}

/* === Smooth Page Transitions === */

.page-transition {
    animation: fadeInUp 0.5s ease-out;
}

/* === Accessibility - Respect User Preferences === */

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

    .btn-primary,
    .badge,
    .icon-float,
    .icon-bounce,
    .icon-pulse,
    .icon-rotate {
        animation: none !important;
    }
}
