/**
 * Animationen
 */

/* Fade In */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Slide In */
.slide-in {
    animation: slideIn 0.3s ease forwards;
}

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

/* Slide Up */
.slide-up {
    animation: slideUp 0.4s ease forwards;
}

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

/* Scale In */
.scale-in {
    animation: scaleIn 0.3s ease forwards;
}

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

/* Staggered Animation für Grid Items */
.posts-grid .post-card {
    opacity: 0;
    animation: slideUp 0.4s ease forwards;
}

.posts-grid .post-card:nth-child(1) { animation-delay: 0.05s; }
.posts-grid .post-card:nth-child(2) { animation-delay: 0.1s; }
.posts-grid .post-card:nth-child(3) { animation-delay: 0.15s; }
.posts-grid .post-card:nth-child(4) { animation-delay: 0.2s; }
.posts-grid .post-card:nth-child(5) { animation-delay: 0.25s; }
.posts-grid .post-card:nth-child(6) { animation-delay: 0.3s; }
.posts-grid .post-card:nth-child(7) { animation-delay: 0.35s; }
.posts-grid .post-card:nth-child(8) { animation-delay: 0.4s; }
.posts-grid .post-card:nth-child(n+9) { animation-delay: 0.45s; }

/* Pulse Animation für Favoriten */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.post-favorite-btn.animate {
    animation: pulse 0.3s ease;
}

/* Shake Animation für Fehler */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.5s ease;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-tertiary) 25%,
        var(--color-border) 50%,
        var(--color-bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
}

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

/* Progress Bar Animation */
.progress-fill {
    transition: width 0.3s ease;
}

.progress-fill.indeterminate {
    width: 30% !important;
    animation: indeterminate 1.5s infinite ease-in-out;
}

@keyframes indeterminate {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(400%);
    }
}

/* Hover Lift Effect */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

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

.ripple:active::after {
    width: 300px;
    height: 300px;
    opacity: 1;
    transition: 0s;
}

/* Toast Animations */
.toast {
    animation: slideInRight 0.3s ease;
}

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

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

/* Modal Animations */
.modal-overlay {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay .modal {
    transition: transform 0.3s ease;
}

/* Lightbox Animations */
.lightbox {
    animation: fadeIn 0.3s ease;
}

.lightbox[hidden] {
    display: none;
}

.lightbox-content img {
    animation: scaleIn 0.3s ease;
}

/* Drop Zone Animations */
.drop-zone {
    transition: all 0.3s ease;
}

.drop-zone.dragover {
    transform: scale(1.02);
}

/* Button Press Effect */
.btn:active {
    transform: scale(0.98);
}

/* Tag Chip Animation */
.tag-chip {
    transition: all 0.2s ease;
}

.tag-chip:hover {
    transform: translateY(-2px);
}

/* Search Clear Animation */
.clear-search {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.clear-search:hover {
    transform: translateY(-50%) scale(1.1);
}

/* Checkbox/Toggle Animations */
input[type="checkbox"] {
    transition: all 0.2s ease;
}

/* Focus Ring Animation */
@keyframes focusRing {
    0% {
        box-shadow: 0 0 0 0 var(--color-primary);
    }
    100% {
        box-shadow: 0 0 0 4px transparent;
    }
}

*:focus-visible {
    animation: focusRing 0.3s ease forwards;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: var(--spacing-sm);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--color-text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.16s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.6;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Success Checkmark Animation */
.checkmark {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: var(--color-success);
    stroke-miterlimit: 10;
    animation: checkmarkFill 0.4s ease-in-out 0.4s forwards, checkmarkScale 0.3s ease-in-out 0.9s both;
}

.checkmark__circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: var(--color-success);
    fill: none;
    animation: checkmarkStroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark__check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: checkmarkStroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

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

@keyframes checkmarkScale {
    0%, 100% {
        transform: none;
    }
    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}

@keyframes checkmarkFill {
    100% {
        box-shadow: inset 0 0 0 30px var(--color-success-light);
    }
}

/* Smooth Color Transitions for Theme Toggle */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.main-header,
.modal,
.toast,
.post-card,
.form-section,
.post-info {
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
