/* =============================================
   AutoGate Pro - Animations
   Premium Automatic Doors Website
   ============================================= */

/* =============================================
   Base Animation States
   ============================================= */

.animate-fade-in,
.animate-slide-up,
.animate-on-scroll {
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-fade-in {
    transform: translateY(20px);
}

.animate-slide-up {
    transform: translateY(40px);
}

.animate-on-scroll {
    transform: translateY(30px);
}

/* Animated States */
.animate-fade-in.animate,
.animate-slide-up.animate,
.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Animation Delays */
.delay-1 {
    transition-delay: 0.1s;
}

.delay-2 {
    transition-delay: 0.2s;
}

.delay-3 {
    transition-delay: 0.3s;
}

.delay-4 {
    transition-delay: 0.4s;
}

.delay-5 {
    transition-delay: 0.5s;
}

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

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide In Left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide In Right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Pulse */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Float */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Glow */
@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(212, 168, 83, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(212, 168, 83, 0.6);
    }
}

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Rotate */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Bounce */
@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-15px);
    }

    60% {
        transform: translateY(-7px);
    }
}

/* =============================================
   Button Micro-Interactions
   ============================================= */

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

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

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

.btn-primary {
    background-size: 200% auto;
    transition: all 0.3s ease, background-position 0.5s ease;
}

.btn-primary:hover {
    background-position: right center;
}

/* CTA Pulse Effect */
.nav-link.nav-cta {
    animation: subtle-pulse 3s ease-in-out infinite;
}

@keyframes subtle-pulse {

    0%,
    100% {
        box-shadow: 0 4px 15px rgba(212, 168, 83, 0.2);
    }

    50% {
        box-shadow: 0 4px 25px rgba(212, 168, 83, 0.4);
    }
}

/* =============================================
   Card Hover Effects
   ============================================= */

.service-card {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.service-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
            rgba(212, 168, 83, 0.1) 0%,
            transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: inherit;
}

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

/* Icon Animation */
.service-icon {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.service-card:hover .service-icon {
    transform: scale(1.1) rotate(5deg);
}

.service-icon svg {
    transition: stroke 0.3s ease;
}

.service-card:hover .service-icon svg {
    stroke: var(--gold-light);
}

/* =============================================
   Gallery Animations
   ============================================= */

.gallery-item {
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-item::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
    border-radius: inherit;
    transition: border-color 0.3s ease;
    z-index: 2;
    pointer-events: none;
}

.gallery-item:hover::before {
    border-color: var(--gold);
}

.gallery-overlay {
    transform: translateY(10px);
}

.gallery-item:hover .gallery-overlay {
    transform: translateY(0);
}

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

.timeline-item {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.timeline-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-number {
    transition: all 0.4s ease;
}

.timeline-item:hover .timeline-number {
    color: rgba(212, 168, 83, 0.3);
    transform: scale(1.1);
}

.timeline-icon {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.timeline-item:hover .timeline-icon {
    transform: scale(1.15);
    background: rgba(212, 168, 83, 0.2);
}

/* Line Animation */
.timeline::before {
    animation: line-grow 1s ease-out forwards;
    transform-origin: left;
}

@keyframes line-grow {
    from {
        transform: translateX(-50%) scaleX(0);
    }

    to {
        transform: translateX(-50%) scaleX(1);
    }
}

/* =============================================
   Benefit Items Animation
   ============================================= */

.benefit-item {
    position: relative;
}

.benefit-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gradient-gold);
    transform: scaleY(0);
    transition: transform 0.4s ease;
    border-radius: 2px;
}

.benefit-item:hover::before {
    transform: scaleY(1);
}

.benefit-icon {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.benefit-item:hover .benefit-icon {
    transform: scale(1.1);
    background: rgba(212, 168, 83, 0.2);
}

/* =============================================
   Testimonial Animations
   ============================================= */

.testimonial-card {
    animation: none;
}

.testimonial-card.active {
    animation: fadeInScale 0.5s ease forwards;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.testimonial-card.exit {
    animation: fadeOutScale 0.5s ease forwards;
}

@keyframes fadeOutScale {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

.testimonial-quote {
    animation: float 4s ease-in-out infinite;
}

.dot {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dot:hover {
    transform: scale(1.3);
}

.dot.active {
    transform: scale(1.2);
}

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

.form-group label {
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    animation: input-focus 0.3s ease;
}

@keyframes input-focus {
    0% {
        box-shadow: 0 0 0 0 rgba(212, 168, 83, 0.4);
    }

    100% {
        box-shadow: 0 0 0 4px rgba(212, 168, 83, 0);
    }
}

/* Success Animation */
.form-group.success input,
.form-group.success select,
.form-group.success textarea {
    border-color: #2ecc71;
    animation: success-pulse 0.5s ease;
}

@keyframes success-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.4);
    }

    100% {
        box-shadow: 0 0 0 4px rgba(46, 204, 113, 0);
    }
}

/* Error Shake */
.form-group.error input,
.form-group.error select,
.form-group.error textarea {
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

/* Button Loading State */
.btn-submit.loading {
    pointer-events: none;
}

.btn-submit.loading .btn-text {
    transform: translateY(-100%);
}

.btn-submit.loading .btn-loading {
    transform: translateY(0);
}

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

.navbar {
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-link {
    position: relative;
}

.nav-link::after {
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Mobile Menu Animation */
.nav-menu.active {
    animation: slideDown 0.4s ease forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hamburger Animation */
.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

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

.hero-content>* {
    animation: fadeInUp 0.8s ease forwards;
    opacity: 0;
}

.hero-badge {
    animation-delay: 0.2s;
}

.hero-title {
    animation-delay: 0.4s;
}

.hero-subtitle {
    animation-delay: 0.6s;
}

.hero-buttons {
    animation-delay: 0.8s;
}

.hero-stats {
    animation-delay: 1s;
}

/* Parallax like effect on scroll */
.hero-bg {
    transition: transform 0.1s linear;
}

/* Stats Counter Animation */
.stat-number.counting {
    animation: count-pulse 0.3s ease;
}

@keyframes count-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

/* Scroll Indicator Animation */
.scroll-indicator {
    animation: fadeIn 1s ease 1.5s forwards;
    opacity: 0;
}

/* =============================================
   Scroll Progress Indicator
   ============================================= */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--gradient-gold);
    z-index: 1001;
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 0.1s linear;
}

/* =============================================
   Loading Screen (Optional)
   ============================================= */

.page-loader {
    position: fixed;
    inset: 0;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-logo {
    font-size: 48px;
    color: var(--gold);
    animation: pulse 1.5s ease infinite;
}

/* =============================================
   Smooth Scroll Behavior
   ============================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* =============================================
   Stagger Animation Helper
   ============================================= */

.stagger-children>*:nth-child(1) {
    transition-delay: 0.1s;
}

.stagger-children>*:nth-child(2) {
    transition-delay: 0.15s;
}

.stagger-children>*:nth-child(3) {
    transition-delay: 0.2s;
}

.stagger-children>*:nth-child(4) {
    transition-delay: 0.25s;
}

.stagger-children>*:nth-child(5) {
    transition-delay: 0.3s;
}

.stagger-children>*:nth-child(6) {
    transition-delay: 0.35s;
}