/* =====================================================
   AGRISENSE — Modern Animations & Transitions
   Smooth entrance, hover, and interaction effects
   ===================================================== */

/* ── Global Animations ── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(61, 220, 104, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(61, 220, 104, 0); }
}

/* ── Landing Page Animations ── */
.landing-hero {
    animation: fadeInUp 0.8s var(--ease) forwards;
}

.hero-badge {
    animation: fadeInDown 0.6s var(--ease) forwards;
}

.hero-copy h1 {
    animation: fadeInUp 0.8s var(--ease) 0.1s forwards;
    opacity: 0;
}

.hero-copy > p {
    animation: fadeInUp 0.8s var(--ease) 0.2s forwards;
    opacity: 0;
}

.hero-actions {
    animation: fadeInUp 0.8s var(--ease) 0.3s forwards;
    opacity: 0;
}

.hero-stats {
    animation: fadeInUp 0.8s var(--ease) 0.4s forwards;
    opacity: 0;
}

.hero-stats > div {
    animation: scaleIn 0.6s var(--ease) forwards;
    opacity: 0;
}

.hero-stats > div:nth-child(1) { animation-delay: 0.5s; }
.hero-stats > div:nth-child(2) { animation-delay: 0.6s; }
.hero-stats > div:nth-child(3) { animation-delay: 0.7s; }

.sensor-card {
    animation: slideInLeft 0.6s var(--ease) forwards;
    opacity: 0;
}

.sensor-card:nth-child(1) { animation-delay: 0.3s; }
.sensor-card:nth-child(2) { animation-delay: 0.4s; }
.sensor-card:nth-child(3) { animation-delay: 0.5s; }

/* ── Feature Cards ── */
.feature-card {
    animation: fadeInUp 0.6s var(--ease) forwards;
    opacity: 0;
}

.feature-card:nth-child(1) { animation-delay: 0.2s; }
.feature-card:nth-child(2) { animation-delay: 0.4s; }
.feature-card:nth-child(3) { animation-delay: 0.6s; }

/* ── Auth Form Animations ── */
.auth-card {
    animation: scaleIn 0.5s var(--ease) forwards;
    opacity: 0;
}

.auth-card h2,
.auth-card > p {
    animation: fadeInDown 0.6s var(--ease) forwards;
    opacity: 0;
}

.auth-card h2 { animation-delay: 0.1s; }
.auth-card > p { animation-delay: 0.2s; }

.auth-card input,
.auth-card label,
.auth-card button,
.auth-card .flash {
    animation: fadeInUp 0.5s var(--ease) forwards;
    opacity: 0;
}

.auth-card input:nth-of-type(1) { animation-delay: 0.3s; }
.auth-card input:nth-of-type(2) { animation-delay: 0.4s; }
.auth-card input:nth-of-type(3) { animation-delay: 0.5s; }
.auth-card input:nth-of-type(4) { animation-delay: 0.6s; }

.auth-card button[type="submit"] { animation-delay: 0.7s; }

.auth-links a {
    animation: fadeInUp 0.5s var(--ease) forwards;
    opacity: 0;
}

.auth-links a:nth-child(1) { animation-delay: 0.8s; }
.auth-links a:nth-child(2) { animation-delay: 0.9s; }
.auth-links a:nth-child(3) { animation-delay: 1s; }

/* ── Button & Link Hover Effects ── */
.primary-action,
.secondary-action,
.nav-button {
    transition: all 0.3s var(--ease);
    position: relative;
    overflow: hidden;
}

.primary-action:hover,
.secondary-action:hover,
.nav-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(61, 220, 104, 0.3);
}

.primary-action::before,
.secondary-action::before,
.nav-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left 0.4s var(--ease);
}

.primary-action:hover::before,
.secondary-action:hover::before,
.nav-button:hover::before {
    left: 100%;
}

/* ── Form Input Focus Animation ── */
input,
textarea,
select {
    transition: all 0.3s var(--ease);
}

input:focus,
textarea:focus,
select:focus {
    transform: scale(1.01);
    box-shadow: 0 0 0 3px rgba(61, 220, 104, 0.2);
}

/* ── Card Animations ── */
.feature-card,
.sensor-card,
.auth-card {
    transition: all 0.3s var(--ease);
}

.feature-card:hover,
.sensor-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(61, 220, 104, 0.2);
}

/* ── Page Transition ── */
[data-spa-link] {
    transition: color 0.2s ease, opacity 0.2s ease;
}

[data-spa-link]:active {
    opacity: 0.7;
}

/* ── Flash Message Animation ── */
.flash {
    animation: slideInDown 0.5s var(--ease) forwards;
    opacity: 0;
}

/* ── Theme Toggle Animation ── */
.theme-toggle {
    transition: transform 0.3s var(--ease), color 0.3s ease;
}

.theme-toggle:hover {
    transform: rotate(20deg) scale(1.1);
}

/* ── Loading Pulse Animation ── */
.loading {
    animation: pulse 2s ease-in-out infinite;
}

/* ── Glow Effect for Active Elements ── */
.status-pill {
    animation: glow 2s infinite;
}

/* ── Smooth scroll behavior ── */
html {
    scroll-behavior: smooth;
}

/* ── Page Load Animation ── */
body {
    animation: fadeInUp 0.6s var(--ease) forwards;
}
