/* ==========================================================================
   AutomateIT - Animation Library
   ========================================================================== */

/* --- Keyframes --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

@keyframes checkmark {
    0% { stroke-dashoffset: 100; }
    100% { stroke-dashoffset: 0; }
}

@keyframes ripple {
    0% { transform: scale(0); opacity: 0.5; }
    100% { transform: scale(4); opacity: 0; }
}

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

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

/* --- Animation Utilities --- */
.animate-fade-in { animation: fadeIn 0.6s ease forwards; }
.animate-fade-in-up { animation: fadeInUp 0.6s ease forwards; }
.animate-fade-in-down { animation: fadeInDown 0.5s ease forwards; }
.animate-fade-in-left { animation: fadeInLeft 0.6s ease forwards; }
.animate-fade-in-right { animation: fadeInRight 0.6s ease forwards; }
.animate-slide-down { animation: slideDown 0.4s ease forwards; }
.animate-slide-up { animation: slideUp 0.4s ease forwards; }
.animate-scale-in { animation: scaleIn 0.5s ease forwards; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* --- Stagger Delays --- */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }

/* --- Scroll Reveal --- */
.scroll-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-reveal.reveal-left {
    transform: translateX(-20px);
}

.scroll-reveal.reveal-left.revealed {
    transform: translateX(0);
}

.scroll-reveal.reveal-right {
    transform: translateX(20px);
}

.scroll-reveal.reveal-right.revealed {
    transform: translateX(0);
}

.scroll-reveal.reveal-scale {
    transform: scale(0.9);
}

.scroll-reveal.reveal-scale.revealed {
    transform: scale(1);
}

/* --- Stagger children --- */
.stagger-children .scroll-reveal:nth-child(1) { transition-delay: 0s; }
.stagger-children .scroll-reveal:nth-child(2) { transition-delay: 0.1s; }
.stagger-children .scroll-reveal:nth-child(3) { transition-delay: 0.2s; }
.stagger-children .scroll-reveal:nth-child(4) { transition-delay: 0.3s; }
.stagger-children .scroll-reveal:nth-child(5) { transition-delay: 0.4s; }
.stagger-children .scroll-reveal:nth-child(6) { transition-delay: 0.5s; }

/* --- Loading / Skeleton --- */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner--dark {
    border-color: rgba(0,0,0,0.1);
    border-top-color: var(--primary, #F76100);
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    font-size: 14px;
    font-weight: 500;
    animation: slideInRight 0.3s ease forwards;
    min-width: 300px;
    max-width: 440px;
    border-left: 4px solid #F76100;
}

.toast--success { border-left-color: #10b981; }
.toast--error { border-left-color: #dc2626; }
.toast--warning { border-left-color: #f59e0b; }

.toast.removing {
    animation: slideOutRight 0.3s ease forwards;
}

.toast svg {
    flex-shrink: 0;
}

.toast__message {
    flex: 1;
}

.toast__close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.toast__close:hover {
    opacity: 1;
}

/* --- Back to Top --- */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary, #F76100);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(247, 97, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(247, 97, 0, 0.4);
}

/* --- Cookie Banner --- */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 20px 24px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    animation: slideUp 0.4s ease;
}

.cookie-banner__text {
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
}

.cookie-banner__text a {
    color: #F76100;
    text-decoration: underline;
}

.cookie-banner__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.cookie-banner__btn {
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.cookie-banner__btn--accept {
    background: #F76100;
    color: white;
}

.cookie-banner__btn--accept:hover {
    background: #e05500;
}

.cookie-banner__btn--decline {
    background: #f3f4f6;
    color: #374151;
}

.cookie-banner__btn--decline:hover {
    background: #e5e7eb;
}

/* --- 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-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .animate-float,
    .animate-pulse {
        animation: none;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .toast-container {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }

    .toast {
        min-width: auto;
    }

    .cookie-banner {
        flex-direction: column;
        text-align: center;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
    }
}
