/* ==========================================================================
   EvomniAlert — 訊息組件
   依附樣式系統：CLAUDE.md :root 變數（無變數時使用 fallback）
   ========================================================================== */

.evomnialert {
    /* 手動置中：站台 evomni-root.css 普遍含 *{margin:0} reset，會打掉 native
       modal dialog 透過 margin:auto + inset:0 達成的自動居中。改用 fixed +
       transform 自行定位，與 .member-dialog / dialog.index-popup 一致。 */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
}

.evomnialert::backdrop {
    background-color: rgba(0, 0, 0, 0.7);
}

.evomnialert *,
.evomnialert *::before,
.evomnialert *::after {
    box-sizing: border-box;
}

.evomnialert-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 530px;
    max-width: calc(100vw - 4rem);
    padding: 45px 90px;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 3px;
    font-family: var(--FontFamily, Roboto, "Noto Sans TC", sans-serif);
    font-size: var(--FontSizeBody, 16px);
    color: var(--TextColorPrimary, #333);
}

@media (max-width: 680px) {
    .evomnialert-wrapper {
        padding: 45px 36px;
    }
}

.evomnialert-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.evomnialert-close:focus,
.evomnialert-close:active {
    outline: none;
}

.evomnialert-close::before,
.evomnialert-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2px;
    background-color: #606266;
    transition: background-color 0.3s ease;
}

.evomnialert-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.evomnialert-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

@media (hover: hover) {
    .evomnialert-close:hover::before,
    .evomnialert-close:hover::after {
        background-color: var(--ColorPrimary, #000);
    }
}

.evomnialert-icon {
    position: relative;
    display: block;
    width: 63px;
    height: 63px;
    margin: 0 auto 24px;
}

.evomnialert-icon > svg,
.evomnialert-icon > img {
    display: block;
    width: 100%;
    height: 100%;
}

.evomnialert-title {
    text-align: center;
    color: var(--TextColorPrimary, #303133);
    margin-bottom: 0;
}

.evomnialert-title .title {
    display: block;
    font-weight: 500;
    font-size: 24px;
}

.evomnialert-title .title-desc {
    margin-top: 8px;
    margin-bottom: 0;
    font-size: var(--FontSizeBody, 14px);
    color: #606266;
}

.evomnialert-footer {
    margin-top: 24px;
}

.evomnialert-footer[hidden] {
    display: none;
}

.evomnialert-confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 18px;
    border: 0;
    line-height: 1.5;
    background-color: var(--BtnPrimaryBg, #000);
    color: var(--BtnPrimaryTextColor, #fff);
    font-size: var(--BtnFontSize, 16px);
    cursor: pointer;
    transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
}

.evomnialert-confirm:active,
.evomnialert-confirm:focus,
.evomnialert-confirm:visited {
    color: var(--BtnPrimaryTextColor, #fff);
}

@media (hover: hover) {
    .evomnialert-confirm:hover {
        background-color: var(--BtnPrimaryHoverBg, #606266);
        color: var(--BtnPrimaryHoverTextColor, #fff);
    }
}

/* 白名單標籤的內嵌樣式（desc 內允許的 <a>） */
.evomnialert-title a {
    color: var(--ColorPrimary, #409eff);
    text-decoration: underline;
}

@media (hover: hover) {
    .evomnialert-title a:hover {
        color: var(--ColorPrimaryHover, #000);
    }
}

/* type 差異（目前僅 error 有視覺差異，其他共用） */
.evomnialert[data-type="error"] .evomnialert-title .title {
    color: #EB5757;
}

/* ==========================================================================
   fade 淡入淡出動畫
   - 開啟：opacity 0 → 1，輕微上移
   - 關閉：加 .is-closing 後 opacity 1 → 0，JS 於動畫結束後呼叫 dialog.close()
   ========================================================================== */
.evomnialert[open] .evomnialert-wrapper {
    animation: evomnialert-in 0.22s ease-out both;
}

.evomnialert[open]::backdrop {
    animation: evomnialert-backdrop-in 0.22s ease-out both;
}

.evomnialert.is-closing .evomnialert-wrapper {
    animation: evomnialert-out 0.18s ease-in both;
}

.evomnialert.is-closing::backdrop {
    animation: evomnialert-backdrop-out 0.18s ease-in both;
}

@keyframes evomnialert-in {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes evomnialert-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
}

@keyframes evomnialert-backdrop-in {
    from {
        background-color: rgba(0, 0, 0, 0);
    }
    to {
        background-color: rgba(0, 0, 0, 0.7);
    }
}

@keyframes evomnialert-backdrop-out {
    from {
        background-color: rgba(0, 0, 0, 0.7);
    }
    to {
        background-color: rgba(0, 0, 0, 0);
    }
}

/* 尊重使用者偏好：減少動態效果時關閉動畫 */
@media (prefers-reduced-motion: reduce) {
    .evomnialert[open] .evomnialert-wrapper,
    .evomnialert.is-closing .evomnialert-wrapper,
    .evomnialert[open]::backdrop,
    .evomnialert.is-closing::backdrop {
        animation: none;
    }
}
