/* ===========================
   ANIMATIONS STYLESHEET
   =========================== */

/* ===========================
   KEYFRAME ANIMATIONS
   =========================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    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.5;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) translateX(0px);
    }
    25% {
        transform: translateY(-20px) translateX(10px);
    }
    50% {
        transform: translateY(-40px) translateX(0px);
    }
    75% {
        transform: translateY(-20px) translateX(-10px);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(6, 182, 212, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(6, 182, 212, 0.4);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes rotateSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ===========================
   ENTRANCE ANIMATIONS
   =========================== */

.navbar {
    animation: slideInDown 0.6s ease-out;
}

.hero {
    animation: fadeIn 0.8s ease-out;
}

.hero-text {
    animation: slideInLeft 0.7s ease-out 0.2s both;
}

.hero-visual {
    animation: slideInRight 0.7s ease-out 0.2s both;
}

.control-panel {
    animation: slideInUp 0.6s ease-out 0.3s both;
}

.footer {
    animation: slideInUp 0.8s ease-out;
}

/* ===========================
   CARD ANIMATIONS
   =========================== */

.app-card {
    animation: scaleIn 0.4s ease-out;
}

.app-card:nth-child(1) {
    animation-delay: 0s;
}

.app-card:nth-child(2) {
    animation-delay: 0.05s;
}

.app-card:nth-child(3) {
    animation-delay: 0.1s;
}

.app-card:nth-child(4) {
    animation-delay: 0.15s;
}

.app-card:nth-child(5) {
    animation-delay: 0.2s;
}

.app-card:nth-child(n+6) {
    animation-delay: 0.25s;
}

/* ===========================
   INTERACTIVE ANIMATIONS
   =========================== */

/* Button Press Effect */
button {
    transition: all var(--transition-base);
}

button:active {
    transform: scale(0.98);
}

/* Link Hover Glow */
a {
    transition: all var(--transition-base);
}

a:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Input Focus */
input {
    transition: all var(--transition-base);
}

input:focus {
    animation: glow 1s ease-in-out;
}

/* ===========================
   STATE TRANSITIONS
   =========================== */

/* Fade out animation */
.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Fade in animation */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* ===========================
   LOADING STATES
   =========================== */

.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-surface),
        var(--color-bg-secondary),
        var(--color-surface)
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* ===========================
   SMOOTH TRANSITIONS
   =========================== */

* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: var(--transition-base);
}

/* Disable transitions for reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===========================
   RESPONSIVE ANIMATIONS
   =========================== */

@media (max-width: 768px) {
    .app-card {
        animation: scaleIn 0.3s ease-out;
    }

    .navbar {
        animation: slideInDown 0.4s ease-out;
    }

    .control-panel {
        animation: slideInUp 0.4s ease-out 0.2s both;
    }
}

@media (prefers-reduced-motion: reduce) {
    .deco-box {
        animation: none;
    }

    .app-card {
        animation: none;
    }

    .navbar {
        animation: none;
    }

    .hero {
        animation: none;
    }
}

/* ===========================
   HOVER EFFECTS
   =========================== */

@media (hover: hover) and (pointer: fine) {
    .app-card {
        animation: none;
    }

    .app-card:hover {
        animation: none;
    }
}

/* ===========================
   SCROLL ANIMATIONS
   =========================== */

/* Intersection Observer animations will be handled by JavaScript */
.scroll-in {
    opacity: 0;
    transform: translateY(20px);
}

.scroll-in.visible {
    animation: fadeIn 0.6s ease-out forwards;
}
