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

body {
    font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei UI', 'Segoe UI', system-ui, sans-serif;
    background: #f5f1eb;
}

/* ── Layout ── */
.login-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Left Panel ── */
.login-left {
    flex: 0 0 45%;
    background: linear-gradient(150deg, #2a1508 0%, #3d2010 50%, #52280f 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 3rem 4rem;
    position: relative;
    overflow: hidden;
}

/* Decorative blobs */
.blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.18;
    filter: blur(40px);
}
.blob-1 { width: 480px; height: 480px; background: #6a3c1a; top: -140px; right: -120px; }
.blob-2 { width: 320px; height: 320px; background: #4e2c10; bottom: -80px; left: -80px; }
.blob-3 { width: 220px; height: 220px; background: #5c3418; top: 40%; left: 55%; }

/* Grid dots pattern */
.login-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 28px 28px;
}

.brand-icon {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, #8a4e24, #b86830);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1.75rem;
    box-shadow: 0 8px 24px rgba(138,78,36,0.45), inset 0 1px 0 rgba(255,255,255,0.12);
    position: relative; z-index: 1;
}

.brand-icon i { font-size: 1.6rem; color: #fff; }

.brand-name {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    position: relative; z-index: 1;
    margin-bottom: 0.4rem;
}

.brand-subtitle {
    font-size: 1rem;
    color: #c8a882;
    margin-bottom: 2.5rem;
    position: relative; z-index: 1;
}

.feature-list {
    list-style: none;
    position: relative; z-index: 1;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #d4b898;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.feature-list li .feat-icon {
    width: 30px; height: 30px;
    background: rgba(138,78,36,0.3);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.feature-list li .feat-icon i { font-size: 0.85rem; color: #c8a882; }

.left-footer {
    position: absolute;
    bottom: 2rem; left: 4rem;
    font-size: 0.78rem;
    color: #7a5c40;
    z-index: 1;
}

/* ── Right Panel ── */
.login-right {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: #f7f4ef;
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.login-card-header { margin-bottom: 2rem; }

.login-card-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #2d2420;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.login-card-header p {
    color: #6b5c52;
    font-size: 0.9rem;
}

/* Form */
.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a3f38;
    margin-bottom: 0.4rem;
}

.input-group {
    box-shadow: 0 1px 3px rgba(45,36,32,0.06);
    border-radius: 10px;
    overflow: hidden;
}

.input-group-text {
    background: #f0ebe4;
    border: 1.5px solid #e5ddd4;
    border-right: none;
    color: #9a8880;
    padding: 0 1rem;
}

.input-group .form-control {
    border: 1.5px solid #e5ddd4;
    border-left: none;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    color: #2d2420;
    background: #fdfbf8;
}

.input-group .form-control:focus {
    border-color: #8a4e24;
    box-shadow: none;
    outline: none;
}

.input-group:focus-within .input-group-text {
    border-color: #8a4e24;
    color: #8a4e24;
}

.input-group:focus-within .form-control { border-color: #8a4e24; }

.toggle-pw {
    background: #f0ebe4;
    border: 1.5px solid #e5ddd4;
    border-left: none;
    color: #9a8880;
    padding: 0 0.9rem;
    cursor: pointer;
    transition: color 0.15s;
}

.toggle-pw:hover { color: #8a4e24; }
.input-group:focus-within .toggle-pw { border-color: #8a4e24; }

/* Remember me */
.form-check-input:checked { background-color: #8a4e24; border-color: #8a4e24; }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(138,78,36,0.15); }
.form-check-label { font-size: 0.87rem; color: #5c4e46; cursor: pointer; }

/* Login Button */
.btn-login {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.97rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: none;
    border-radius: 10px;
    background: #a0683a;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
    box-shadow: 0 4px 12px rgba(160,104,58,0.25);
}

.btn-login:hover:not(:disabled) {
    background: #8c5830;
}

.btn-login:active:not(:disabled) { background: #784a28; }

.btn-login:disabled {
    background: #cfa882;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-login .spinner-border { width: 1rem; height: 1rem; border-width: 0.15em; }

/* Divider */
.form-divider {
    display: flex;
    align-items: center;
    margin: 0.5rem 0;
    color: #c4b8ae;
    font-size: 0.8rem;
}

.form-divider::before,
.form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5ddd4;
}

.form-divider span { padding: 0 0.75rem; }

/* 密碼欄位的 toggle-pw 在 is-invalid 時同步紅框 */
.form-control.is-invalid ~ .toggle-pw {
    border-color: #dc3545;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .login-left { display: none; }
    .login-right {
        flex: 0 0 100%;
        background: #f7f4ef;
        align-items: flex-start;
        padding: 2.5rem 1.5rem;
    }
    .login-card { max-width: 100%; }
}

/* PWA 安裝按鈕 */
.btn-pwa-install {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.72rem;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: transparent;
    border: 1.5px solid rgba(160,104,58,0.4);
    border-radius: 10px;
    color: #a0683a;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-pwa-install:hover {
    background: rgba(160,104,58,0.07);
    border-color: #a0683a;
}
.btn-pwa-install:active { transform: scale(0.98); }
