/**
 * Error and Success Message Styles
 * Стили для сообщений об ошибках и успехе
 */

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-100%);
    }
}

.error-message-module,
.ok-message-module {
    position: fixed;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 96%;
    max-width: 500px;
    z-index: 9999;
    margin: 0;
    padding: 20px;
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease-out;
}

.error-message-module .btn-close,
.ok-message-module .btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    opacity: 0.5;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-message-module .btn-close:hover,
.ok-message-module .btn-close:hover {
    opacity: 1;
}

/* Мобильные устройства (< 992px): всегда по центру для всех страниц */
@media (max-width: 991px) {
    .error-message-module,
    .ok-message-module {
        left: 50% !important;
        width: 96% !important;
        max-width: 500px !important;
        transform: translateX(-50%) !important;
        right: auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* Страницы входа и восстановления (page-auth): всегда по центру на всех устройствах */
body.page-auth .error-message-module,
body.page-auth .ok-message-module {
    left: 50% !important;
    width: 96% !important;
    max-width: 500px !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Desktop (>= 992px): центрирование относительно header только для страниц админки (не page-auth) */
@media (min-width: 992px) {
    /* Для страниц админки - сдвиг вправо относительно sidebar */
    body:not(.page-auth) .error-message-module,
    body:not(.page-auth) .ok-message-module {
        left: calc(300px + (100% - 332px) / 2) !important;
        width: calc(100% - 332px) !important;
        max-width: 500px !important;
        transform: translateX(-50%) !important;
        right: auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Для страниц входа/восстановления - всегда по центру даже на десктопе */
    body.page-auth .error-message-module,
    body.page-auth .ok-message-module {
        left: 50% !important;
        width: 96% !important;
        max-width: 500px !important;
        transform: translateX(-50%) !important;
        right: auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* Темная тема: стили для h1 в окнах ошибки и успеха */
.theme-dark .error-message-module h1,
.theme-dark .ok-message-module h1 {
    color: var(--text-primary-light) !important;
}
