/**
 * Animations - Анимации и эффекты
 * 
 * Файл с анимациями и эффектами для улучшения пользовательского опыта
 */

/* === Fade In анимация === */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-in-out;
}

/* === Fade Out анимация === */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.animate-fadeOut {
    animation: fadeOut 0.3s ease-in-out;
}

/* === Slide Down анимация === */
@keyframes slideDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.animate-slideDown {
    animation: slideDown 0.3s ease-in-out;
}

/* === Slide Up анимация === */
@keyframes slideUp {
    from {
        transform: translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.animate-slideUp {
    animation: slideUp 0.3s ease-in-out;
}

/* === Slide In анимация (слева) === */
@keyframes slideInLeft {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.animate-slideInLeft {
    animation: slideInLeft 0.3s ease-in-out;
}

/* === Slide In анимация (справа) === */
@keyframes slideInRight {
    from {
        transform: translateX(20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.animate-slideInRight {
    animation: slideInRight 0.3s ease-in-out;
}

/* === Scale анимация === */
@keyframes scale {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.animate-scale {
    animation: scale 0.3s ease-in-out;
}

/* === Pulse эффект === */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.animate-pulse {
    animation: pulse 1.5s infinite;
}

/* === Shake эффект === */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.animate-shake {
    animation: shake 0.8s ease-in-out;
}

/* === Spinner анимация === */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* === Bounce эффект === */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.animate-bounce {
    animation: bounce 1s infinite;
}

/* === Fade In-Out эффект === */
@keyframes fadeInOut {
    0% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

.animate-fadeInOut {
    animation: fadeInOut 2s infinite;
}

/* === Выпадающее меню === */
.dropdown-menu {
    transform-origin: top;
    transition: transform 0.2s ease, opacity 0.2s ease;
    transform: scaleY(0);
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.dropdown-menu.show {
    transform: scaleY(1);
    opacity: 1;
    height: auto;
}

/* === Tooltip анимация === */
.tooltip {
    position: relative;
}

.tooltip-text {
    position: absolute;
    background-color: #252525;
    color: #e0e0e0;
    text-align: center;
    border-radius: 0.375rem;
    padding: 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(156, 163, 175, 0.2) #3a3a3a;
}

.tooltip-top {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    margin-bottom: 5px;
}

.tooltip-bottom {
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    margin-top: 5px;
}

.tooltip-left {
    top: 50%;
    right: 100%;
    transform: translateY(-50%) translateX(-5px);
    margin-right: 5px;
}

.tooltip-right {
    top: 50%;
    left: 100%;
    transform: translateY(-50%) translateX(5px);
    margin-left: 5px;
}

.tooltip:hover .tooltip-text {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.tooltip:hover .tooltip-left {
    transform: translateY(-50%) translateX(0);
}

.tooltip:hover .tooltip-right {
    transform: translateY(-50%) translateX(0);
}

/* === Ripple эффект для кнопок === */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: "";
    display: block;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: rgba(17, 17, 17, 0.3);
    border-radius: inherit;
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.btn-ripple:active::after {
    transform: scale(2);
    opacity: 0;
    transition: transform 0s, opacity 0.4s ease;
}

/* === Скелетон загрузки === */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #2a2a2a 25%, #333 50%, #2a2a2a 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.375rem;
}

.skeleton-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-button {
    height: 2.5rem;
    width: 6rem;
}

/* === Перетаскиваемые элементы === */
.draggable {
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.draggable:active {
    cursor: grabbing;
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* === Hover эффекты для карточек === */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.hover-scale {
    transition: transform 0.2s ease;
}

.hover-scale:hover {
    transform: scale(1.02);
}

/* === Анимации для модальных окон === */
.modal-backdrop {
    transition: background-color 0.3s ease;
}

.modal-content {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal-enter {
    opacity: 0;
    transform: scale(0.95);
}

.modal-enter-active {
    opacity: 1;
    transform: scale(1);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal-exit {
    opacity: 1;
    transform: scale(1);
}

.modal-exit-active {
    opacity: 0;
    transform: scale(0.95);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* === Toast уведомления === */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 350px;
}

.toast {
    background-color: #252525;
    border-radius: 0.375rem;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #4a90e2;
    animation: slideInRight 0.3s ease-in-out;
}

.toast-success {
    border-left-color: #4caf50;
}

.toast-error {
    border-left-color: #f44336;
}

.toast-warning {
    border-left-color: #ff9800;
}

.toast-info {
    border-left-color: #4a90e2;
}

.toast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.toast-title {
    font-weight: 500;
    display: flex;
    align-items: center;
}

.toast-close {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
}

.toast-body {
    color: #e0e0e0;
}

/* === Анимированные прогресс-бары === */
.progress-bar {
    height: 0.5rem;
    background-color: #2a2a2a;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: #4a90e2;
    border-radius: 9999px;
    transition: width 0.5s ease;
}

.progress-striped .progress-bar-fill {
    background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
    background-size: 1rem 1rem;
}

.progress-animated .progress-bar-fill {
    animation: progressAnimation 1s linear infinite;
}

@keyframes progressAnimation {
    from {
        background-position: 1rem 0;
    }
    to {
        background-position: 0 0;
    }
}

/* === Анимации для списков === */
.list-enter-item {
    opacity: 0;
    transform: translateX(-20px);
}

.list-enter-active-item {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.list-exit-item {
    opacity: 1;
    transform: translateX(0);
}

.list-exit-active-item {
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* === Анимация пульсирующего уведомления === */
@keyframes badgePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
    }
    70% {
        box-shadow: 0 0 0 5px rgba(244, 67, 54, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}

.badge-pulse {
    animation: badgePulse 1.5s infinite;
}

/* === Плавная смена цвета === */
.color-transition {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* === Простые transition-классы === */
.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-colors {
    transition-property: color, background-color, border-color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-opacity {
    transition-property: opacity;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-transform {
    transition-property: transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.duration-100 {
    transition-duration: 100ms;
}

.duration-200 {
    transition-duration: 200ms;
}

.duration-300 {
    transition-duration: 300ms;
}

.duration-500 {
    transition-duration: 500ms;
}

.duration-700 {
    transition-duration: 700ms;
}

.duration-1000 {
    transition-duration: 1000ms;
}

.ease-linear {
    transition-timing-function: linear;
}

.ease-in {
    transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
}

.ease-out {
    transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
}

.ease-in-out {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Трансформация для интерактивных элементов === */
.scale-95 {
    transform: scale(0.95);
}

.scale-100 {
    transform: scale(1);
}

.rotate-45 {
    transform: rotate(45deg);
}

.rotate-90 {
    transform: rotate(90deg);
}

.rotate-180 {
    transform: rotate(180deg);
}

.translate-y-1 {
    transform: translateY(0.25rem);
}

.translate-y-2 {
    transform: translateY(0.5rem);
}

.translate-y-4 {
    transform: translateY(1rem);
}

.translate-y-n1 {
    transform: translateY(-0.25rem);
}

.translate-y-n2 {
    transform: translateY(-0.5rem);
}

.translate-y-n4 {
    transform: translateY(-1rem);
}

/* === Spinners === */
.spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(156, 163, 175, 0.2) rgba(17, 17, 17, 0.2);
    border-left-color: rgba(156, 163, 175, 0.2);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-sm {
    width: 1rem;
    height: 1rem;
    border-width: 1px;
}

.spinner-lg {
    width: 3rem;
    height: 3rem;
    border-width: 3px;
}

/* === Вращение для иконок === */
.rotate-icon {
    transition: transform 0.3s ease;
}

.rotate-icon-180 {
    transform: rotate(180deg);
}

/* === Группы анимации === */
.animate-children > * {
    opacity: 0;
    transform: translateY(10px);
    animation-name: slideUp;
    animation-duration: 0.3s;
    animation-fill-mode: forwards;
    animation-timing-function: ease-in-out;
}

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

.animate-children > *:nth-child(2) {
    animation-delay: 0.2s;
}

.animate-children > *:nth-child(3) {
    animation-delay: 0.3s;
}

.animate-children > *:nth-child(4) {
    animation-delay: 0.4s;
}

.animate-children > *:nth-child(5) {
    animation-delay: 0.5s;
}

.animate-children > *:nth-child(6) {
    animation-delay: 0.6s;
}

.animate-children > *:nth-child(7) {
    animation-delay: 0.7s;
}

.animate-children > *:nth-child(8) {
    animation-delay: 0.8s;
}

.animate-children > *:nth-child(9) {
    animation-delay: 0.9s;
}

.animate-children > *:nth-child(10) {
    animation-delay: 1s;
}