*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.login-page {
    --amber: #e0b462;
    --amber-deep: #c8923a;
    --amber-soft: #f3e2c0;
    --ink: #3a4a63;
    --ink-soft: #6b7a92;
    --muted: #9aa3b2;
    --line: #e7e3dc;
    --field-bg: #f5f3f0;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 16px 64px;
    font-family: 'Noto Sans TC', '微軟正黑體', 'Microsoft JhengHei', sans-serif;
    color: var(--ink);
    background: url(/image/background.jpg) no-repeat center/cover;
    position: relative;
    overflow-x: hidden;
}

.login-container {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

/* ===== 校徽 / 標題 ===== */
.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 10px;
    display: block;
}

.login-portal {
    margin-top: 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--amber-deep);
    letter-spacing: 1px;
}

    .login-portal.warning {
        color: #c83a3a;
    }

/* ===== 登入卡片 ===== */
.login-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 30px 28px 26px;
    box-shadow: 0 18px 48px rgba(120, 95, 40, .12);
}

.login-field {
    margin-bottom: 14px;
}

.login-field-label {
    display: block;
    font-size: 12px;
    color: var(--ink-soft);
    margin-bottom: 6px;
    letter-spacing: .5px;
}

/* 身份別提示 */
.identity-hint {
    background: #f7ece9;
    border: 1px solid #f0dcd6;
    border-radius: 9px;
    padding: 13px 14px;
    font-size: 13px;
    color: #b08a82;
}

/* 一般輸入框 */
.login-input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    background: var(--field-bg);
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 14px;
    color: var(--ink);
    font-family: inherit;
    outline: none;
    transition: border-color .15s, background .15s, box-shadow .15s;
}

.login-input::placeholder {
    color: #a7adb8;
}

.login-input:focus {
    background: #fff;
    border-color: var(--amber);
    box-shadow: 0 0 0 3px rgba(224, 180, 98, .18);
}

/* 密碼欄（含顯示切換） */
.input-group {
    position: relative;
}

.input-group .login-input {
    padding-right: 44px;
}

.toggle-pw {
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 46px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-pw:hover {
    color: var(--ink-soft);
}

/* 驗證碼欄（輸入框 + 圖片並排） */
.captcha-group {
    position:relative;
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.captcha-group .login-input {
    flex: 1;
}

.captcha-img {
    height: 46px;
    width: 110px;
    border-radius: 9px;
    border: 1px solid var(--line);
    object-fit: cover;
    cursor: pointer;
    background: var(--amber-soft);
    flex-shrink: 0;
}

.captchaRefresh {
    position:absolute;
    right:0;
    bottom:0;
}

/* 欄位驗證錯誤訊息 */
.login-field .field-validation-error {
    display: block;
    color: #d6604a;
    font-size: 12px;
    margin-top: 5px;
}

/* ===== 按鈕 ===== */
.btn-login {
    width: 100%;
    height: 48px;
    margin-top: 6px;
    border: none;
    border-radius: 9px;
    background: linear-gradient(135deg, #e6bc6e 0%, #d9a94a 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: filter .15s, box-shadow .15s;
    box-shadow: 0 6px 16px rgba(217, 169, 74, .35);
    font-family: inherit;
}

.btn-login:hover {
    filter: brightness(1.04);
}

.btn-forgot {
    width: 100%;
    height: 46px;
    margin-top: 12px;
    border: 1px solid var(--amber);
    border-radius: 9px;
    background: #fff;
    color: var(--amber-deep);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    transition: background .15s;
    font-family: inherit;
}

.btn-forgot:hover {
    background: #fdf8ee;
}

/* ===== 注意事項卡片 ===== */
.notice-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px 18px;
    margin-top: 20px;
    box-shadow: 0 8px 24px rgba(120, 95, 40, .08);
}

.notice-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.notice-list {
    list-style: none;
}

.notice-list li {
    position: relative;
    padding-left: 16px;
    font-size: 0.85rem;
    color: var(--ink-soft);
    line-height: 1.7;
    margin-bottom: 6px;
}

.notice-list li:last-child {
    margin-bottom: 0;
}

.notice-list li::before {
    content: "•";
    position: absolute;
    left: 2px;
    color: var(--amber-deep);
}

.notice-list .em {
    color: var(--amber-deep);
    font-weight: 700;
}

.notice-list a {
    color: var(--amber-deep);
    font-weight: 700;
}

/* ===== 兩欄版面：左登入 / 右公告（/EPortal/Index） ===== */
.login-container-wide {
    max-width: 1000px;
}

.login-grid {
    display: grid;
    grid-template-columns: 420px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

    .login-grid > .login-col:only-child {
        grid-column: 1/-1;
        justify-self: center;
        width: 100%;
        max-width: 420px;
    }

.login-col {
    min-width: 0;
}

/* 每欄第一張卡片對齊頂端（.notice-card 預設有 margin-top） */
.login-col > .notice-card:first-child {
    margin-top: 0;
}

/* ===== 公告清單 ===== */
.notice-feed {
    max-height: 60vh;
    overflow-y: auto;
    margin: 0 -4px;
}

.notice-entry {
    border-top: 1px solid var(--line);
}

.notice-entry:first-child {
    border-top: none;
}

/* 內容過長才是 details：整個收合區塊都可點 */
details.notice-entry > summary {
    display: block;
    cursor: pointer;
    list-style: none;
}

/* 隱藏瀏覽器預設三角形 */
details.notice-entry > summary::-webkit-details-marker {
    display: none;
}

details.notice-entry > summary::marker {
    content: "";
}

details.notice-entry > summary:hover .notice-entry-title {
    color: var(--amber-deep);
}

/* ── 標題列（圓點＋標題＋日期＋箭頭） ── */
.notice-entry-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 4px 5px;
    color: var(--ink);
}

/* 只有標題（無內文）時補回下方留白 */
.notice-entry-head:only-child {
    padding-bottom: 11px;
}

/* 前置圓點 */
.notice-entry-head::before {
    content: "";
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--amber);
}

/* 展開箭頭：只有可展開的公告才有 */
details.notice-entry .notice-entry-head::after {
    content: "";
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    margin-right: 3px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: translateY(-2px) rotate(45deg);
    transition: transform .18s;
}

details.notice-entry[open] .notice-entry-head::after {
    transform: translateY(2px) rotate(-135deg);
}

details.notice-entry[open] .notice-entry-head {
    color: var(--amber-deep);
    font-weight: 600;
}

.notice-entry-title {
    flex: 1;
    min-width: 0;
    transition: color .15s;
}

/* 收合中的公告標題只佔一行，超出以 … 截斷 */
details.notice-entry:not([open]) .notice-entry-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notice-entry-body,
.notice-entry-preview {
    padding: 0 6px 14px 18px;
    line-height: 1.75;
    color: var(--ink-soft);
    white-space: pre-wrap;
    word-break: break-word;
}

/* 展開後摘要換成全文 */
details.notice-entry[open] .notice-entry-preview {
    display: none;
}

@media (max-width: 900px) {
    .login-grid {
        grid-template-columns: 1fr;
    }
        .login-grid .login-col.announcementWrap {
            order: 1;
        }

        .login-grid .login-col:not(.announcementWrap) {
            order: 2;
        }

    .login-container-wide {
        max-width: 420px;
    }

    .login-col > .notice-card:first-child {
        margin-top: 20px;
    }

    .notice-feed {
        max-height: none;
    }
}

@media (max-width: 480px) {
    .login-page {
        padding: 28px 12px 48px;
    }

    .login-card {
        padding: 24px 20px 22px;
    }
}
