/* animations.css - Стили анимаций */

/* Анимация отрисовки линий */
@keyframes draw {
    to {
        stroke-dashoffset: 0;
    }
}

/* Анимация появления элементов */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Анимации для математической доски */
@keyframes formula-pulsate {

    0%,
    100% {
        opacity: 1;
        background-color: rgba(100, 180, 160, 0.15);
    }

    50% {
        opacity: 0.8;
        background-color: rgba(100, 180, 160, 0.2);
    }
}

.formula-pulse {
    animation: formula-pulsate 2s ease-in-out infinite;
}

/* Анимации для математической доски */
.math-board-container {
    position: relative;
    width: 100%;
    height: 350px;
    background-color: #1a2635;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    perspective: 1000px;
}

/* Градиентные края доски */
.board-edge-gradient {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(26, 38, 53, 0) 50%, rgba(26, 38, 53, 0.9) 100%);
    pointer-events: none;
    z-index: 10;
}

/* Легкое свечение по периметру */
.board-glow-edge {
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 20px rgba(100, 255, 200, 0.1);
    pointer-events: none;
    z-index: 5;
}

/* Фоновая сетка для математического вида */
.math-grid {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(100, 255, 180, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(100, 255, 180, 0.07) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Анимация для области формул */
.formulas-area {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    overflow: hidden;
}

/* Прогресс трекер */
#progress-tracker {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(90deg, rgba(100, 255, 180, 0.3), rgba(140, 220, 255, 0.7));
    transition: width 0.6s ease-out;
}

/* Формулы в анимации */
.formula-element {
    position: absolute;
    color: rgba(220, 255, 240, 0.9);
    font-family: 'CMU Serif', Georgia, serif;
    font-size: 16px;
    text-shadow: 0 0 3px rgba(120, 255, 200, 0.4);
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    padding: 8px 12px;
    border-radius: 4px;
    z-index: 20;
}

.formula-element.visible {
    opacity: 1;
    transform: scale(1);
}

/* Анимации для результатов */
.fade-in {
    animation: fadeIn 0.5s ease-in-out forwards;
}

.slide-up {
    animation: slideUp 0.5s ease-in-out forwards;
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* НОВЫЕ АНИМАЦИИ ДЛЯ ПЕРЕХОДОВ МЕЖДУ ИНТЕРФЕЙСАМИ */

/* Анимация для перехода между формой и результатами */
@keyframes slideLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes slideRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Классы для применения анимаций */
.slide-left {
    animation: slideLeft 400ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.slide-right {
    animation: slideRight 400ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.slide-in-from-right {
    animation: slideInFromRight 400ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.slide-in-from-left {
    animation: slideInFromLeft 400ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Контейнеры для переходов */
.transition-container {
    position: relative;
    overflow: hidden;
    width: 100%;
    min-height: 200px;
}

/* Стили для панелей */
.calculator-panel,
.results-panel {
    position: relative;
    width: 100%;
    transition: transform 400ms cubic-bezier(0.4, 0, 0.2, 1),
        opacity 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* При переключении между панелями JS должен добавлять класс 'animating' к transition-container */
.transition-container.animating .calculator-panel,
.transition-container.animating .results-panel {
    position: absolute;
    top: 0;
    left: 0;
}

/* Состояния панелей */
.calculator-panel.active {
    transform: translateX(0);
    opacity: 1;
}

.calculator-panel.hidden {
    transform: translateX(-100%);
    opacity: 0;
}

.results-panel.active {
    transform: translateX(0);
    opacity: 1;
}

.results-panel.hidden {
    transform: translateX(100%);
    opacity: 0;
}