/* =========================================
   ТОСТЫ (УВЕДОМЛЕНИЯ)
   ========================================= */
#roerich-toast-container {
    position: fixed;
    top: 6.5rem; /* Ниже шапки сайта */
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none; /* Чтобы клики проходили сквозь контейнер, если он пуст */
}

.roerich-toast {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(243, 240, 223, 0.85));
    backdrop-filter: blur(16px);
    border-left: 4px solid var(--color-roerich-ultramarine);
    border-radius: var(--radius-md, 0.75rem);
    box-shadow: var(--elevation-layer-3);
    padding: 1rem 1.5rem;
    font-family: var(--font-utility);
    color: var(--color-abyss-ink);
    font-size: var(--text-p-readable);
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease;
    pointer-events: auto;
}

.roerich-toast.show {
    transform: translateX(0);
    opacity: 1;
}

/* Модификаторы для тостов */
.roerich-toast.success { border-left-color: var(--color-mystic-violet); }
.roerich-toast.error { border-left-color: var(--color-cinnabar-red); }




/* =========================================
   УНИВЕРСАЛЬНАЯ МОДАЛКА (АРТЕФАКТ)
   ========================================= */
#roerich-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(10, 17, 40, 0.4); /* Abyss Ink с прозрачностью */
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
}

#roerich-modal-overlay.roerich-modal-hidden {
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(0px);
}

.roerich-modal-artifact {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(243, 240, 223, 0.8));
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg, 1.5rem);
    box-shadow: var(--elevation-layer-4);
    padding: 2.5rem;
    width: 90%;
    max-width: 450px;
    transform: scale(1) translateY(0);
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#roerich-modal-overlay.roerich-modal-hidden .roerich-modal-artifact {
    transform: scale(0.9) translateY(20px);
}

.roerich-modal-icon {
    position: absolute;
    top: -1.8rem;
    left: -1rem;
    width: 60px;
    height: 60px;
    background: var(--color-snow-summit);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--elevation-layer-2);
    transform: rotate(-3deg);
    z-index: 10;
}

.roerich-modal-title {
    font-family: var(--font-majestic);
    color: var(--color-roerich-ultramarine);
    font-size: calc(var(--text-h2-epic) * 0.8);
    margin: 0 0 1rem 0;
    line-height: 1.1;
}

.roerich-modal-body {
    font-size: calc(var(--text-p-readable) );
    font-family: var(--font-utility);
    color: var(--color-abyss-ink);
    margin: 0 0 2rem 0;
    line-height: 1.5;
}

.roerich-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}


/* =========================================
   СПЕЦИФИЧНЫЕ КНОПКИ МОДАЛКИ
   ========================================= */
.roerich-btn-ghost {
    background: transparent;
    border: none;
    color: var(--color-roerich-ultramarine);
    font-family: var(--font-utility);
    font-weight: 700;
    padding: 0.75rem 1.2rem;
    border-radius: var(--radius-sm, 0.5rem);
    cursor: pointer;
    transition: background 0.2s;
}

.roerich-btn-ghost:hover {
    background: rgba(0, 80, 136, 0.05);
}

.roerich-btn-fiery {
    background: var(--color-cinnabar-red);
    color: var(--color-snow-summit);
    border: none;
    font-family: var(--font-utility);
    font-weight: 800;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm, 0.5rem);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(200, 55, 55, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.roerich-btn-fiery:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(200, 55, 55, 0.45);
}

.roerich-btn-primary {
    background: var(--color-roerich-ultramarine);
    color: var(--color-snow-summit);
    border: none;
    font-family: var(--font-utility);
    font-weight: 800;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm, 0.5rem);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 80, 136, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.roerich-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 80, 136, 0.35);
}


/* =========================================
   ГЛОБАЛЬНЫЙ МОБИЛЬНЫЙ ОПТИМИЗАТОР (≤ 768px)
   ========================================= */
@media (max-width: 992px) {
    /* --- Оптимизация тостов --- */
    #roerich-toast-container {
        top: auto;
        bottom: 5rem;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        align-items: center;
        width: max-content;
        max-width: 90vw;
    }
    /* На мобилках он выезжает снизу, а не сбоку */
    .roerich-toast {
        transform: translateY(120%);
    }

    .roerich-toast {
        padding: 0.75rem 1.25rem; /* Более аккуратные отступы */
        transform: translateY(100%);
        width: 100%;
        text-align: center;
    }

    .roerich-toast.show {
        transform: translateY(0);
    }

    /* --- Оптимизация карточки модалки --- */
    .roerich-modal-artifact {
        padding: 2.75rem 1.5rem 1.5rem 1.5rem; /* Аккуратный внутренний паддинг, не сжимает текст */
        width: 88%;
    }

    /* --- Уменьшение декоративной иконки --- */
    .roerich-modal-icon {
        width: 50px;
        height: 50px;
        top: -1.4rem;
        left: 0.5rem; /* Сдвинули чуть внутрь, чтобы не вылезала за экран смартфона */
    }
    .roerich-modal-icon svg {
        width: 22px;
        height: 22px;
    }

    /* --- Сжатие вертикальных гапов текста --- */
    .roerich-modal-title {
        margin: 0 0 0.6rem 0; /* Меньше отступ снизу */
    }

    .roerich-modal-body {
        margin: 0 0 1.25rem 0; /* Значительно уменьшили пустоту перед кнопками */
    }

    /* --- Оптимизация блока кнопок на мобилке --- */
    .roerich-modal-actions {
        flex-direction: row;       /* Возвращаем кнопки в один ряд вместо тяжелого вертикального стека */
        justify-content: flex-end; /* Выравниваем по правому краю */
        gap: 0.5rem;               /* Минимальный аккуратный зазор между ними */
    }

    /* --- Компактные и изящные мобильные кнопки --- */
    .roerich-modal-actions button {
        width: auto;               /* Убираем растягивание на 100% ширины */
        padding: 0.5rem 1rem;      /* Делаем их тонкими и аккуратными */
        min-height: 38px;          /* Оптимальная высота, чтобы кнопка не выглядела огромной, но по ней можно было попасть */
        font-size: 0.9rem;         /* Чуть уменьшаем шрифт, чтобы он соответствовал мобильному тексту */
    }
}