.emadrese-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    direction: rtl;
}

    .emadrese-modal.hidden {
        display: none;
    }

.emadrese-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(3px);
}

.emadrese-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 680px;
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.32);
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    animation: emadreseModalIn 0.18s ease-out;
}

html.dark .emadrese-modal__dialog {
    background: #1f2937;
    color: #e5e7eb;
}

.emadrese-modal__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    color: #ffffff;
}

.emadrese-modal__header--success {
    background: linear-gradient(135deg, #059669, #10b981);
}

.emadrese-modal__header--danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.emadrese-modal__header--warning {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

.emadrese-modal__header--info {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.emadrese-modal__icon {
    width: 3rem;
    height: 3rem;
    min-width: 3rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .emadrese-modal__icon svg {
        width: 1.6rem;
        height: 1.6rem;
    }

.emadrese-modal__title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.emadrese-modal__subtitle {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    opacity: 0.85;
}

.emadrese-modal__close {
    margin-right: auto;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 999px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.18);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

    .emadrese-modal__close:hover {
        background: rgba(255, 255, 255, 0.28);
    }

.emadrese-modal__body {
    padding: 1.75rem 1.5rem;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

.emadrese-modal__message {
    margin: 0;
    color: #334155;
    font-size: 1rem;
    line-height: 2;
    white-space: pre-line;
}

html.dark .emadrese-modal__message {
    color: #d1d5db;
}

.emadrese-modal__footer {
    padding: 1rem 1.5rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
}

html.dark .emadrese-modal__footer {
    border-top-color: #374151;
}

@keyframes emadreseModalIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }

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

@media (max-width: 640px) {
    .emadrese-modal {
        align-items: flex-start;
        padding: .75rem;
    }

    .emadrese-modal__dialog {
        max-width: 100%;
        max-height: calc(100vh - 1.5rem);
        max-height: calc(100dvh - 1.5rem);
    }

    .emadrese-modal__header {
        padding: 1rem;
    }

    .emadrese-modal__body {
        padding: 1.25rem 1rem;
    }

    .emadrese-modal__footer {
        padding: 1rem;
    }

        .emadrese-modal__footer .btn {
            width: 100%;
        }
}
