﻿/* ============================
   БАЗОВЫЕ СТИЛИ МОДАЛЬНОГО ОКНА
============================ */

.alvilModal_overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6) !important;
    display: flex !important;
    justify-content: center;
    align-items: center;
    z-index: 2147483647 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.alvilModal_window {
    position: relative;
    border-radius: 14px;
    padding: 24px;
    max-width: 90%;
    width: 420px;
    box-sizing: border-box;
    overflow: visible !important;
    transition: all 0.3s ease;
    background-blend-mode: normal;
}

/* Кнопка закрытия */
.alvilModal_close {
    position: absolute;
    cursor: pointer;
    user-select: none;
    z-index: 20;
    transition: all 0.2s ease;
}

/* Заголовок */
.alvilModal_title {
    margin: 0 0 12px 0;
    padding: 0;
    position: relative;
    z-index: 5;
}

/* Текст */
.alvilModal_message {
    margin: 0 0 16px 0;
    line-height: 1.5;
    position: relative;
    z-index: 5;
}

/* Фото */
.alvilModal_image {
    display: block;
    position: relative;
    z-index: 5;
    transition: all 0.3s ease;
}

/* Кнопка перехода */
.alvilModal_btn {
    display: block;
    padding: 12px 18px;
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    margin-top: 16px;
    transition: all 0.2s ease;
    position: relative;
    z-index: 5;
}

/* ============================
   АНИМАЦИИ ПОЯВЛЕНИЯ
============================ */

.anim-fade {
    animation: alvilFadeIn 0.35s ease forwards;
}

@keyframes alvilFadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.anim-zoom {
    animation: alvilZoomIn 0.35s ease forwards;
}

@keyframes alvilZoomIn {
    from {
        opacity: 0;
        transform: scale(0.7);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.anim-slide-up {
    animation: alvilSlideUp 0.35s ease forwards;
}

@keyframes alvilSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.anim-slide-down {
    animation: alvilSlideDown 0.35s ease forwards;
}

@keyframes alvilSlideDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.anim-slide-left {
    animation: alvilSlideLeft 0.35s ease forwards;
}

@keyframes alvilSlideLeft {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.anim-slide-right {
    animation: alvilSlideRight 0.35s ease forwards;
}

@keyframes alvilSlideRight {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.anim-bounce {
    animation: alvilBounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes alvilBounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.98);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.anim-flip {
    animation: alvilFlipIn 0.5s ease forwards;
    transform-style: preserve-3d;
    backface-visibility: visible;
}

@keyframes alvilFlipIn {
    from {
        opacity: 0;
        transform: perspective(400px) rotateX(90deg);
    }

    to {
        opacity: 1;
        transform: perspective(400px) rotateX(0deg);
    }
}

.anim-glow {
    animation: alvilGlowIn 0.4s ease forwards;
}

@keyframes alvilGlowIn {
    from {
        opacity: 0;
        box-shadow: 0 0 0px rgba(255,255,255,0);
    }

    to {
        opacity: 1;
        box-shadow: 0 0 30px rgba(255,255,255,0.3);
    }
}

/* ============================
   СТЕКЛЯННЫЙ СТИЛЬ (GLASS)
============================ */

.alvilModal_glass {
    backdrop-filter: blur(12px);
    background: rgba(255,255,255,0.25) !important;
    border: 1px solid rgba(255,255,255,0.4) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25) !important;
}

/* ============================
   РАЗМЫТЫЙ ФОН (BLUR OVERLAY)
============================ */

.alvilModal_overlay-blur {
    backdrop-filter: blur(8px);
    background-color: rgba(0,0,0,0.3) !important;
}

/* ============================
   ЭФФЕКТ СВЕЧЕНИЯ ДЛЯ КНОПКИ
============================ */

.alvilModal_btn-glow {
    animation: alvilPulse 2s infinite;
}

@keyframes alvilPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0,123,255,0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0,123,255,0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0,123,255,0);
    }
}

/* ============================
   ЭФФЕКТ ВРАЩЕНИЯ КРЕСТИКА
============================ */

.alvilModal_close-rotate:hover span {
    transform: rotate(90deg);
    transition: transform 0.3s ease;
}

/* ============================
   ПРОГРЕСС-БАР АВТО-ЗАКРЫТИЯ
============================ */

.alvilModal_progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(0,0,0,0.1);
    overflow: hidden;
    z-index: 15;
}

.alvilModal_progress-fill {
    width: 100%;
    height: 100%;
    transition: width linear;
}

/* ============================
   КНОПКА "БОЛЬШЕ НЕ ПОКАЗЫВАТЬ"
============================ */

.alvilModal_dont-show {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    padding: 5px;
    transition: 0.2s;
}

/* ============================
   ВОЛНИСТЫЕ РАМКИ
============================ */

/* Волнистая рамка (Wave) */
.alvilModal_window.wave-border {
    border-style: none !important;
    position: relative;
}

    .alvilModal_window.wave-border::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        right: 0;
        pointer-events: none;
        background: repeating-linear-gradient(45deg, var(--wave-color, #cccccc), var(--wave-color, #cccccc) var(--wave-size, 8px), transparent var(--wave-size, 8px), transparent calc(var(--wave-size, 8px) * 2));
        height: var(--wave-size, 8px);
        bottom: calc(var(--wave-width, 4px) * -1);
    }

/* Зигзаг (Zigzag) */
.alvilModal_window.zigzag-border {
    border-style: none !important;
    position: relative;
}

    .alvilModal_window.zigzag-border::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        right: 0;
        pointer-events: none;
        background: repeating-linear-gradient(135deg, var(--wave-color, #cccccc), var(--wave-color, #cccccc) calc(var(--wave-size, 8px) / 2), transparent calc(var(--wave-size, 8px) / 2), transparent var(--wave-size, 8px));
        height: var(--wave-size, 8px);
        bottom: calc(var(--wave-width, 4px) * -1);
    }

/* Фестоны (Scallop) */
.alvilModal_window.scallop-border {
    border-style: none !important;
    position: relative;
}

    .alvilModal_window.scallop-border::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        right: 0;
        pointer-events: none;
        background: radial-gradient(circle at 50% 0, var(--wave-color, #cccccc) calc(var(--wave-size, 8px) / 3), transparent calc(var(--wave-size, 8px) / 3));
        background-size: var(--wave-size, 8px) calc(var(--wave-size, 8px) / 2);
        background-repeat: repeat-x;
        height: var(--wave-size, 8px);
        bottom: calc(var(--wave-width, 4px) * -1);
    }

/* ============================
   АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ
============================ */

@media (max-width: 768px) {
    .alvilModal_window {
        width: 90% !important;
        max-width: 90% !important;
        padding: 20px !important;
        border-radius: 20px !important;
        bottom: auto !important;
        top: auto !important;
        transform: none !important;
    }

    .alvilModal_close {
        width: 36px !important;
        height: 36px !important;
    }

        .alvilModal_close span {
            font-size: 24px !important;
        }

    .alvilModal_title {
        font-size: 1.4rem !important;
        margin-bottom: 10px !important;
    }

    .alvilModal_message {
        font-size: 0.95rem !important;
        margin-bottom: 14px !important;
    }

    .alvilModal_btn {
        padding: 10px 16px !important;
        font-size: 14px !important;
    }

    .alvilModal_image {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* ============================
   ПРЕДПРОСМОТР В АДМИНКЕ
============================ */

.preview-overlay {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.preview-window {
    position: relative;
    padding: 24px;
    background: #ffffff;
    border-radius: 14px;
    width: 420px;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    transition: all 0.3s ease;
    overflow: visible !important;
    background-blend-mode: normal;
}

.preview-close {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 28px;
    cursor: pointer;
    z-index: 20;
}

.preview-btn {
    display: block;
    padding: 12px 18px;
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    margin-top: 16px;
}

/* Адаптивность для превью в админке */
@media (max-width: 768px) {
    .preview-window {
        width: 90% !important;
        padding: 16px !important;
    }
}

/* ============================
   ДОПОЛНИТЕЛЬНЫЕ СТИЛИ ДЛЯ ФОНА
============================ */

/* Для изображений и градиентов */
.alvilModal_window[style*="url("] {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Для градиентов */
.alvilModal_window[style*="gradient"] {
    background-blend-mode: normal;
}

/* ============================
   СТИЛИ ДЛЯ HTML-КОНТЕНТА В ТЕКСТЕ
============================ */

.alvilModal_message strong,
.alvilModal_message b {
    font-weight: bold;
}

.alvilModal_message em,
.alvilModal_message i {
    font-style: italic;
}

.alvilModal_message a {
    color: inherit;
    text-decoration: underline;
}

.alvilModal_message ul,
.alvilModal_message ol {
    margin: 10px 0;
    padding-left: 20px;
}

.alvilModal_message p {
    margin: 0 0 10px 0;
}

    .alvilModal_message p:last-child {
        margin-bottom: 0;
    }
