@use  '../../assets/styles/index' as *;

.root {
    --uui-modals-shadow: var(--uui-shadow-level-3);
    --uui-modals-bg: var(--uui-surface-main);
    --uui-modals-title: var(--uui-text-primary);

    --uui-modals-title-font: var(--uui-font);
    --uui-modals-title-font-weight: 600;
    --uui-modals-title-font-size: 18px;
    --uui-modals-title-line-height: 24px;

    --uui-modals-width: 420px;
    --uui-modals-max-height: 80vh;
    --uui-modals-mobile-max-height: 100dvh;

    --uui-modals-border-radius: calc(var(--uui-border-radius) * 2);
}

.modal-blocker {
    animation-duration: 0.3s;
    animation-name: animateModalBlocker;
    opacity: 1;
    transition: all 0.3s ease-out;
    background-color: var(--uui-overlay);

    @keyframes animateModalBlocker {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

.modal {
    width: var(--uui-modals-width);

    &:global(.uui-modal-window) {
        background-color: var(--uui-modals-bg);
        overflow: auto;
        border-radius: var(--uui-modals-border-radius);
        max-width: 100vw;
        box-shadow: var(--uui-modals-shadow);

        @media (max-width: 720px) {
            position: fixed;
            inset-inline-start: 0;
            inset-block-end: 0;
            min-width: 100vw;
            border-bottom-left-radius: 0;
            border-bottom-right-radius: 0;
        }

        :global(.uui-shadow-top)::before {
            background: var(--uui-divider);
            height: 1px;
        }

        :global(.uui-shadow-bottom)::after {
            background: var(--uui-divider);
            height: 1px;
        }
    }
}

.modal-footer {
    --uui-modals-footer-border: 1px solid var(--uui-divider);

    --uui-modals-footer-column-gap: 12px;
    --uui-modals-footer-padding: 24px;
    --uui-modals-footer-vertical-padding: 12px;
    //
    display: flex;
    border-bottom-left-radius: var(--uui-modals-border-radius);
    border-bottom-right-radius: var(--uui-modals-border-radius);
    padding: var(--uui-modals-footer-vertical-padding) var(--uui-modals-footer-padding);
    column-gap: var(--uui-modals-footer-column-gap);

    @media (max-width: 720px) {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    &.border-top {
        border-top: var(--uui-modals-footer-border);
    }
}

.modal-header {
    --uui-modals-header-border: 1px solid var(--uui-divider);

    --uui-modals-header-column-gap: 12px;
    --uui-modals-header-padding: 24px;
    --uui-modals-header-vertical-padding: 18px;
    //
    display: flex;
    border-top-left-radius: var(--uui-modals-border-radius);
    border-top-right-radius: var(--uui-modals-border-radius);
    padding: var(--uui-modals-header-vertical-padding) var(--uui-modals-header-padding);
    column-gap: var(--uui-modals-header-column-gap);

    &.border-bottom {
        border-bottom: var(--uui-modals-header-border);
    }

    :global(.uui-modal-title) {
        font-family: var(--uui-modals-title-font);
        font-size: var(--uui-modals-title-font-size);
        line-height: var(--uui-modals-title-line-height);
        font-weight: var(--uui-modals-title-font-weight);
        color: var(--uui-modals-title);
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
