/* ===== 登入頁面樣式 — 左圖右表單版型 ===== */
:root {
    --primary: #2e7d32;
    --primary-light: #4caf50;
    --primary-lighter: #a5d6a7;
    --primary-lightest: #e8f5e9;
    --primary-bg: #f1f8e9;
    --text-dark: #1b3d1e;
    --text-primary: #2d4a30;
    --text-secondary: #5a7d5e;
    --text-muted: #7d9a81;
}

body.login-page {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
    background: #f5f8f5;
    overflow: hidden;
}

/* ===== 桌面版：左右分割 ===== */
.login-wrapper {
    min-height: 100vh;
    width: 100%;
}

/* --- 左側背景圖片區 --- */
.login-left-image {
    flex: 1;
    background-image: url('/images/bg_login.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-left-image__top {
    padding: 2rem 2.5rem;
}

.login-left-image__logo {
    display: inline-block;
}

.login-left-image__overlay {
    padding: 0 3rem 1rem;
}

.login-left-image__content {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    padding: 2rem 2.5rem;
    max-width: 600px;
}

.login-left-image__content::before {
    content: "";
    position: absolute;
    inset: -20px;
    background-image: url('/images/bg_login.png');
    background-size: cover;
    background-position: center;
    filter: blur(8px) brightness(0.6);
    z-index: 0;
}

.login-left-image__line {
    position: relative;
    z-index: 1;
    width: 60px;
    height: 3px;
    background: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.75rem;
}

.login-left-image__title {
    position: relative;
    z-index: 1;
    font-family: 'Playfair Display', serif;
    font-size: 2.25rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.5rem;
}

.login-left-image__desc {
    position: relative;
    z-index: 1;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    line-height: 1.7;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    margin: 0;
}

.login-left-image__footer {
    position: relative;
    z-index: 1;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    padding: 1rem 2rem;
}

/* --- 右側表單區 --- */
.login-right-form {
    width: 38%;
    min-width: 420px;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #ffffff;
    padding: 3rem 3.5rem;
    position: relative;
    z-index: 2;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.06);
}

.login-right-form__inner {
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
}

/* ===== 共用元件 ===== */

/* --- 標題區 --- */
.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    margin-bottom: 0.75rem;
}

.login-header h1 {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.env-badge {
    display: inline-block;
    background: var(--primary-lightest);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.2rem 0.75rem;
    border-radius: 20px;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0;
}

/* --- 錯誤提示 --- */
.alert-login {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 10px;
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.alert-login__icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-login .validation-summary-errors ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* --- 表單 --- */
.login-form .form-label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
}

.login-form .input-group-text {
    background: #f8faf8;
    border: 1.5px solid #dde5dd;
    border-right: none;
    border-radius: 10px 0 0 10px;
    padding: 0.625rem 0.75rem;
}

.login-form .form-control {
    border: 1.5px solid #dde5dd;
    border-left: none;
    border-radius: 0 10px 10px 0;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* 密碼欄位有 toggle 按鈕時 */
.login-form .input-group .form-control:not(:last-child) {
    border-radius: 0;
}

.btn-toggle-password {
    background: #f8faf8;
    border: 1.5px solid #dde5dd;
    border-left: none;
    border-radius: 0 10px 10px 0;
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-toggle-password:hover {
    background: #eef3ee;
}

.login-form .input-group:focus-within .input-group-text,
.login-form .input-group:focus-within .form-control,
.login-form .input-group:focus-within .btn-toggle-password {
    border-color: var(--primary);
}

.login-form .form-control:focus {
    box-shadow: none;
}

.login-form .input-group:focus-within {
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
    border-radius: 10px;
}

.login-form .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.login-form .form-check-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* --- 登入按鈕 --- */
.btn-login {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
    width: 100%;
    transition: background 0.2s, transform 0.1s;
    letter-spacing: 0.5px;
}

.btn-login:hover {
    background: var(--primary-light);
    color: #fff;
}

.btn-login:active {
    transform: scale(0.98);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* --- 頁尾 --- */
.login-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 2rem;
}

/* ===== 手機版 ===== */
.login-mobile {
    min-height: 100vh;
    flex-direction: column;
    position: relative;
}

.login-mobile__bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('/images/bg_login.png');
    background-size: cover;
    background-position: center;
    filter: blur(2px) brightness(0.7);
    z-index: 0;
}

.login-mobile__card {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.96);
    margin: auto 1rem;
    padding: 2rem 1.5rem;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    max-width: 440px;
    width: calc(100% - 2rem);
    align-self: center;
}

/* ===== 登入頁公告區 ===== */
.login-announcements {
    border-top: 1px solid #e0e0e0;
    padding-top: 1rem;
}

.login-announcements__header {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.login-announcements__list {
    max-height: 160px;
    overflow-y: auto;
}

.login-announcements__item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.82rem;
    border-bottom: 1px solid #f0f0f0;
}

.login-announcements__item:last-child {
    border-bottom: none;
}

.login-announcements__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--primary);
    flex-shrink: 0;
    margin-top: 7px;
}

.login-announcements__title {
    color: var(--text-dark);
    font-weight: 500;
    line-height: 1.4;
}

.login-announcements__content {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.3;
    margin-top: 2px;
}

.login-announcements__date {
    color: var(--text-muted);
    font-family: monospace;
    flex-shrink: 0;
    margin-left: auto;
}

/* ===== RWD ===== */
@media (max-width: 1439px) {
    .login-right-form {
        padding: 2.5rem 3rem;
    }

    .login-left-image__title {
        font-size: 2rem;
    }
}

@media (max-width: 1023px) {
    .login-right-form {
        width: 45%;
        min-width: 380px;
        padding: 2rem 2.5rem;
    }

    .login-left-image__title {
        font-size: 1.75rem;
    }

    .login-left-image__overlay {
        padding: 0 2rem 1rem;
    }
}

@media (max-width: 575px) {
    .login-mobile__card {
        padding: 1.75rem 1.25rem;
        border-radius: 14px;
    }

    .login-header h1 {
        font-size: 1.25rem;
    }
}

@media (max-width: 374px) {
    .login-mobile__card {
        margin: auto 0.5rem;
        padding: 1.5rem 1rem;
    }
}
