/* =========================================================
   DS · Overlays
   弹窗 / 抽屉 / Toast 的统一结构与进出场。
   ========================================================= */

.ds-modal {
    position: fixed;
    inset: 0;
    z-index: var(--ds-z-modal);
    display: grid;
    place-items: center;
    padding: var(--ds-space-4);
    background: var(--color-modal-backdrop);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--ds-motion-base) var(--ds-ease-standard);
}

.ds-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.ds-modal__dialog {
    width: min(560px, 94vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--ds-radius-lg);
    background: var(--ds-color-surface-raised);
    box-shadow: var(--ds-shadow-lg);
    transform: translateY(10px) scale(0.97);
    opacity: 0;
    transition:
        transform var(--ds-motion-slow) var(--ds-ease-emphasized),
        opacity var(--ds-motion-base) var(--ds-ease-standard);
}

.ds-modal.is-open .ds-modal__dialog {
    transform: none;
    opacity: 1;
}

.ds-modal__dialog.is-sm { width: min(420px, 94vw); }
.ds-modal__dialog.is-lg { width: min(760px, 94vw); }
.ds-modal__dialog.is-xl { width: min(960px, 96vw); }

.ds-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-space-3);
    min-height: 52px;
    padding: 0 var(--ds-space-4);
    border-bottom: 1px solid var(--ds-color-border-light);
    font-size: var(--ds-text-lg);
    font-weight: var(--ds-font-weight-semibold);
    color: var(--ds-text-primary);
}

.ds-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: var(--ds-space-4);
    overflow-y: auto;
}

.ds-modal__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--ds-space-2);
    padding: var(--ds-space-3) var(--ds-space-4);
    border-top: 1px solid var(--ds-color-border-light);
}

.ds-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: var(--ds-z-drawer);
    width: min(440px, 92vw);
    display: flex;
    flex-direction: column;
    background: var(--ds-color-surface-raised);
    box-shadow: var(--ds-shadow-lg);
    transform: translateX(100%);
    transition: transform var(--ds-motion-slow) var(--ds-ease-emphasized);
}

.ds-drawer.is-open { transform: none; }

.ds-drawer__header,
.ds-drawer__footer {
    display: flex;
    align-items: center;
    gap: var(--ds-space-2);
    padding: var(--ds-space-3) var(--ds-space-4);
    border-bottom: 1px solid var(--ds-color-border-light);
}

.ds-drawer__footer {
    border-bottom: 0;
    border-top: 1px solid var(--ds-color-border-light);
    justify-content: flex-end;
}

.ds-drawer__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: var(--ds-space-4);
}

.ds-toast-stack {
    position: fixed;
    top: var(--ds-space-4);
    right: var(--ds-space-4);
    z-index: var(--ds-z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-2);
    pointer-events: none;
}

.ds-toast {
    display: flex;
    align-items: center;
    gap: var(--ds-space-2);
    min-width: 220px;
    max-width: 380px;
    padding: 10px 14px;
    border-radius: var(--ds-radius-md);
    background: var(--ds-color-surface-raised);
    box-shadow: var(--ds-shadow-md);
    color: var(--ds-text-primary);
    font-size: var(--ds-text-body);
    pointer-events: auto;
    animation: ds-toast-in var(--ds-motion-slow) var(--ds-ease-spring) both;
}

.ds-toast.is-success i { color: var(--ds-color-success); }
.ds-toast.is-warning i { color: var(--ds-color-warning); }
.ds-toast.is-danger i { color: var(--ds-color-danger); }

@keyframes ds-toast-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to { opacity: 1; transform: none; }
}
