/* === 外層遮罩 === */
.notification-modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    box-sizing: border-box;
}

.notification-modal-wrapper * {
    box-sizing: border-box;
}

.notification-modal-wrapper[hidden],
.notification-modal-wrapper [hidden] {
    display: none !important;
}

/* === 背景遮罩 === */
.notification-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(12, 14, 31, 0.48);
}

/* === Modal 主體容器 === */
/* Figma: 952 × 680px；小螢幕由 wrapper 安全邊距限制 */
.notification-modal-container {
    position: relative;
    width: min(952px, 100%);
    height: min(680px, 100%);
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(12, 14, 31, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* === Header 區域（標題 + 關閉按鈕） === */
/* 不使用 header tag，避免 header.css 的全站 header padding: 0 !important 覆蓋此區塊。 */
.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    min-height: 130px;
    padding: 40px 24px 24px;
    flex-shrink: 0;
}

/* Figma: Title, 56×42, Content/CN/H2, Noto Sans TC, 700, 28px, line-height 42px, color #0C0E1F */
.notification-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    line-height: 42px; /* 150% */
    letter-spacing: 0;
    color: #0C0E1F;
}

.notification-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #4C4F5E;
    border-radius: 4px;
}

.notification-close-btn:hover,
.notification-close-btn:focus,
.notification-tab-btn:focus,
.notification-read-all-btn:focus,
.notification-empty-action:focus,
.notification-alert-toggle-btn:focus {
    outline: none;
}

/* === 頁籤區 (Tabs) === */
.notification-tabs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 46px;
    margin: 0 24px;
    border-bottom: 1px solid #D9DADD;
    flex-shrink: 0;
}

.notification-tabs-group {
    display: flex;
    gap: 24px;
    height: 100%;
}

/**
 * Figma: Tab 文字約 16px, Noto Sans TC
 * 已加上專屬前綴 .notification-tab-btn，避免與全站 button.css 的 .tab-btn 衝突。
 */
.notification-tab-btn {
    background-color: #FFFFFF;
    border: none;
    border-radius: 0;
    height: 100%;
    padding: 0 12px;
    font-size: 16px;
    font-weight: 500;
    color: #5F616E;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    line-height: 24px; /* 150% */
}

.notification-tab-btn.is-active {
    color: #0C0E1F;
    font-weight: 700;
}

/* 頁籤文字維持內聯 */
.notification-tab-text {
    display: inline-block;
}

/* Active 底線 */
.notification-tab-btn.is-active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 4px;
    border-radius: 4px 4px 0 0;
    background-color: #0C0E1F;
}

/* 頁籤紅點 (未讀指示) */
.notification-unread-dot {
    width: 10px;
    height: 10px;
    background-color: #DB3A45;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.notification-tab-btn .notification-unread-dot {
    align-self: flex-start;
    margin-top: 13px; /* 對齊 48px 高度中 24px line-height 文字頂部 */
}

/* 「全部已讀」按鈕 */
.notification-read-all-btn {
    background: none;
    border: none;
    color: #0089B3;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    line-height: 21px;
}

.notification-read-all-btn:disabled,
.notification-read-all-btn.is-disabled {
    color: #A9ACB7;
    cursor: not-allowed;
    pointer-events: none;
}

/* === 列表面板區 === */
.notification-panels {
    min-height: 0;
    margin: 20px 24px 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.notification-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.notification-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* === 通知項目 === */
.notification-item {
    display: flex;
    align-items: center;
    min-height: 96px;
    padding: 12px;
    border-bottom: 1px solid #D9DADD;
    gap: 12px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.notification-item:hover {
    background-color: #F8FBFB;
}

.notification-item:last-child {
    border-bottom-color: #D9DADD;
}

/* 已讀狀態 */
.notification-item.is-read .notification-item-dot-container .notification-unread-dot {
    visibility: hidden;
}

/* 紅點容器：寬度 12px，垂直置中 */
.notification-item-dot-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 12px;
    flex-shrink: 0;
}

/* 列表項目內的未讀紅點：寬高 12px */
.notification-item-dot-container .notification-unread-dot {
    width: 12px;
    height: 12px;
}

/* 內容區 */
.notification-item-content-wrapper {
    flex: 1;
    min-width: 0; /* 確保 text-overflow 生效 */
}

/* Figma: 標題約 16px, 700, color #0C0E1F, Noto Sans TC */
.notification-item-title {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 700;
    color: #0C0E1F;
    line-height: 24px; /* 150% */
}

/* Figma: 描述約 14px, 400, color #4B5563 */
.notification-item-desc {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 400;
    color: #4B5563;
    line-height: 21px; /* 150% */
}

/* 單行截斷 */
.text-truncate-1 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    display: block;
}

/* Figma: 日期 14px, color #9CA3AF */
.notification-item-date {
    margin: 0;
    font-size: 14px;
    color: #5F616E;
    line-height: 21px;
}

/* === 空狀態 === */
.notification-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 24px 12px;
}

.notification-empty-title {
    margin: 0 0 4px 0;
    font-size: 20px;
    font-weight: 500;
    line-height: 30px;
    color: #0C0E1F;
}

.notification-empty-desc {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    color: #494A57;
}

.notification-empty-action {
    width: 160px;
    height: 48px;
    margin-top: 20px;
    padding: 12px 24px;
    border: 0;
    border-radius: 12px;
    background-color: #0089B3;
    color: #FFFFFF !important;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    line-height: 24px;
    cursor: pointer;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* === 個人化通知雙欄佈局 === */
.personal-notification-layout {
    display: flex;
    gap: 28px;
    flex: 1;
    min-height: 0;
}

/* 左側 Banner 區塊：上方留白 12px */
.personal-banner-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 268px;
    flex-shrink: 0;
    padding-top: 12px; /* 圖片上方 12px */
}

/* Banner 卡片 (268px x 356px, 圓角 12px, 邊框 1px solid #F8FBFB) */
.personal-banner-card {
    width: 268px;
    height: 356px;
    border-radius: 12px;
    border: 1px solid #F8FBFB;
    overflow: hidden;
    position: relative;
    background-color: #F8FBFB;
    box-sizing: border-box;
}

.personal-banner-slides {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease-in-out;
}

.personal-banner-slide {
    min-width: 100%;
    height: 100%;
    position: relative;
    flex-shrink: 0;
}

.personal-banner-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.personal-banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.personal-banner-img.banner-mob {
    display: none;
}

/* 輪播指示點 (Dots) - 與卡片間距 12px */
.personal-banner-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    height: 6px;
}

/* 預設點：6px x 6px #757680 */
.personal-banner-dot-btn {
    width: 6px;
    height: 6px;
    border-radius: 3px;
    background-color: #757680;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.25s ease;
}

/* Active 點：12px x 6px #0089B3 膠囊狀 */
.personal-banner-dot-btn.is-active {
    width: 12px;
    height: 6px;
    border-radius: 3px;
    background-color: #0089B3;
}

/* 右側通知清單區 (608px x 386px) */
.personal-list-section {
    width: 608px;
    height: 386px;
    overflow-y: auto;
    flex-shrink: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.personal-list-section .notification-list {
    width: 100%;
}

.personal-list-section .notification-item:first-child {
    margin-top: 12px;
}

/* 個人化通知項目：分隔線 #D9DBDC，水平間距鏈條 [16px Padding] [12px Gap] [12px Dot] [12px Gap] */
.personal-list-section .notification-item {
    border-bottom: 1px solid #D9DBDC;
    padding-left: 16px;
    padding-right: 12px;
    gap: 12px;
}

.personal-list-section .notification-item-dot-container {
    margin-left: 12px;
}

/* === 底部警語區 === */
.notification-alert {
    display: flex;
    align-items: center;
    min-height: 56px;
    margin: 16px 24px 24px;
    padding: 16px;
    background-color: #F4FBFF;
    border-radius: 12px;
    gap: 8px;
    flex-shrink: 0;
}

.notification-alert:has(.notification-alert-toggle-btn[aria-expanded="true"]) {
    align-items: flex-start;
}

/* 桌面版展開時採絕對定位浮層展示，避免擠壓 .notification-panels 產生垂直滾軸 */
@media (min-width: 769px) {
    .notification-alert:has(.notification-alert-toggle-btn[aria-expanded="true"]) {
        position: absolute;
        bottom: 24px;
        left: 24px;
        right: 24px;
        margin: 0;
        z-index: 10;
    }

    /* 警語展開採 absolute 脫離文檔流時，保持面板原本的下邊距，避免列表往下延伸覆蓋 alert 原本區塊 */
    .notification-modal-container:has(.notification-alert-toggle-btn[aria-expanded="true"]) .notification-panels {
        margin-bottom: 96px;
    }
}

.notification-alert-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-alert-content {
    flex: 1;
    min-width: 0;
}

/* 警語文字 */
.notification-alert-text {
    margin: 0;
    font-size: 14px;
    color: #123347;
    font-weight: 400;
    line-height: 22px;
    text-align: start;
    transition: max-height 0.3s ease;
}

/* 警語文字單行截斷（收合時） */
.notification-alert-text.is-collapsed {
    overflow: hidden;
    display: block;
    white-space: nowrap;
    text-overflow: clip;
    max-height: 22px;
}

.notification-alert-toggle-btn {
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    width: 24px;
    height: 24px;
    padding: 2px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.notification-alert-toggle-btn img {
    width: 11.67px;
    height: 6.27px;
}

.notification-alert-toggle-btn[aria-expanded="true"] {
    transform: rotate(180deg);
    margin-top: 3px;
}

/* === 捲軸美化 (Webkit) === */
.notification-panels::-webkit-scrollbar {
    width: 6px;
}

.notification-panels::-webkit-scrollbar-track {
    background: transparent;
}

.notification-panels::-webkit-scrollbar-thumb {
    background-color: #D1D5DB;
    border-radius: 10px;
}

/* === 通知詳細內容頁 === */
.notification-detail-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* 詳細頁狀態下 Header 緊湊對齊，高度精準鎖定 952 × 106px */
.notification-modal-container:has(.notification-detail-view:not([hidden])) .notification-header {
    height: 106px;
    min-height: 106px;
    padding: 40px 24px 24px;
}

/* 內容滾動區：四邊外距統一維持 24px */
.notification-detail-body {
    flex: 1;
    min-height: 0;
    margin: 24px;
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* 捲軸美化 (Webkit) */
.notification-detail-body::-webkit-scrollbar {
    width: 6px;
}

.notification-detail-body::-webkit-scrollbar-track {
    background: transparent;
}

.notification-detail-body::-webkit-scrollbar-thumb {
    background-color: #D9DBDC;
    border-radius: 3px;
}

/* 發布日期：字級 14px, 顏色 #5E5F6B, 行高 20px, 與主標題間距 8px */
.notification-detail-date {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    color: #5E5F6B;
}

/* 詳細主標題：字級 20px, 字重 500, 顏色 #0C0E1F, 行高 30px, 與內文間距 20px */
.notification-detail-title {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 500;
    line-height: 30px;
    color: #0C0E1F;
}

/* 詳細內文：保留後台富文本字級與行高 */
.notification-detail-content {
    word-break: break-word;
    white-space: pre-wrap;
    color: #5E5F6B;
}

.notification-detail-content p,
.notification-detail-content ul,
.notification-detail-content ol {
    margin: 0;
}

.notification-detail-content a,
.notification-detail-content a:hover {
    color: #007AA7;
}

.notification-detail-content a span,
.notification-detail-content a span:hover {
    color: #007AA7;
}

.notification-detail-content ul,
.notification-detail-content ol,
.notification-detail-content p,
.notification-detail-content div::before,
.notification-detail-content span {
    color: #5E5F6B;
    font-size: 16px;
}



.notification-detail-content ul {
    list-style: none;
    padding-inline-start: 0;
}

.notification-detail-content ol {
    list-style: none;
    padding-inline-start: 0;
    line-height: revert;
    counter-reset: editor-list;
}

.notification-detail-content li {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 4px;
    list-style-type: none;
}

.notification-detail-content ul > li::before {
    content: '•';
}

.notification-detail-content ul > li {
    column-gap: 8px;
}

.notification-detail-content ol > li {
    counter-increment: editor-list;
}

.notification-detail-content ol > li::before {
    content: counters(editor-list, '.') '.';
    text-align: right;
}

.notification-detail-content li > * {
    grid-column: 2;
}

/* 當列表設定為置中或置右時，縮減內容欄為 max-content 並透過 justify-content 讓標號與文字一起對齊移動 */
.notification-detail-content li.tsao-align-center {
    grid-template-columns: max-content minmax(0, max-content);
    justify-content: center;
}

.notification-detail-content li.tsao-align-right {
    grid-template-columns: max-content minmax(0, max-content);
    justify-content: end;
}

/* 底部操作區：高 96px, padding 24px, 頂部分隔線 #D9DADD, 靠右對齊 */
.notification-detail-footer {
    height: 96px;
    padding: 24px;
    border-top: 1px solid #D9DADD;
    background-color: #FFFFFF;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
}

/* 「回通知主頁」按鈕：160px × 48px, 圓角 12px, 邊框 1.5px solid #007AA7, 顏色 #007AA7 */
.notification-back-btn {
    width: 160px;
    height: 48px;
    padding: 12px 16px;
    border: 1.5px solid #007AA7;
    border-radius: 12px;
    background-color: #FFFFFF;
    color: #007AA7;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    outline: none;
}

/* 專案規範 Hover / Active / Focus-visible */
@media (min-width: 769px) {
    .notification-back-btn:hover {
        background-color: #F4FBFF;
        color: #007AA7;
        text-decoration: none;
    }
}

.notification-back-btn:active {
    background-color: #E5F7FF;
}

.notification-back-btn:focus {
    outline: none;
}

@media (max-width: 768px) {
    .notification-modal-wrapper {
        padding: 0;
        align-items: flex-end;
    }

    .notification-modal-container {
        width: 100%;
        height: calc(100% - 60px);
        border-radius: 16px 16px 0 0;
        box-shadow: none;
    }

    .notification-header {
        min-height: auto;
        padding: 32px 20px 20px;
    }

    .notification-title {
        font-size: 20px;
        font-weight: 700;
        line-height: 30px;
    }

    .notification-close-btn {
        top: 20px;
        right: 12px;
        width: 24px;
        height: 24px;
        padding: 0;
    }

    .notification-close-btn svg {
        width: 14px;
        height: 14px;
    }

    .notification-tabs {
        height: 48px;
        margin: 0 20px;
    }

    .notification-tabs-group {
        gap: 4px;
    }

    .notification-tab-btn {
        padding: 0 8px;
        font-size: 16px;
    }

    .notification-read-all-btn {
        font-size: 16px;
    }

    .notification-panels {
        margin: 20px 20px 0;
        padding: 0;
    }

    .notification-item {
        min-height: 0;
        padding: 12px;
    }

    .notification-alert {
        min-height: 36px;
        margin: 12px 20px 20px;
        padding: 16px;
    }

    .notification-alert-icon {
        width: 24px;
        height: 24px;
    }

    .notification-alert-icon img {
        width: 20px;
        height: 20px;
    }

    .notification-alert-text {
        font-size: 16px;
        line-height: 24px;
    }

    .notification-alert-text.is-collapsed {
        max-height: 24px;
    }

    /* 個人化通知手機版單欄自適應 */
    .personal-notification-layout {
        flex-direction: column;
        gap: 20px;
        margin: 0 0 16px;
    }

    .personal-banner-section {
        width: 100%;
        padding: 0;
    }

    .personal-banner-card {
        width: 100%;
        max-width: 100%;
        aspect-ratio: 350 / 196;
        height: auto;
        box-sizing: border-box;
    }

    .personal-banner-slides,
    .personal-banner-slide,
    .personal-banner-link,
    .personal-banner-img {
        height: 100%;
    }

    .personal-banner-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .personal-banner-img.banner-web {
        display: none;
    }

    .personal-banner-img.banner-mob {
        display: block;
    }

    .personal-list-section {
        width: 100%;
        height: auto;
        max-height: none;
        padding-top: 0;
    }

    .personal-list-section .notification-item {
        padding-left: 12px;
    }

    .personal-list-section .notification-item:first-child {
        margin-top: 0;
    }

    .personal-list-section .notification-item-dot-container {
        margin-left: 0;
    }

    /* 詳細內容頁手機版調整 */
    .notification-detail-body {
        margin: 20px;
        padding: 0;
    }

    .notification-detail-title {
        font-size: 18px;
        line-height: 26px;
        margin-bottom: 20px;
    }

    .notification-detail-footer {
        height: auto;
        min-height: 80px;
        padding: 16px 20px;
    }

    .notification-back-btn {
        width: 100%;
    }
}

