body.dark-theme {
    --bg-color: #1a1d21; --surface-color: #2c2f33; --primary-text: #e0e0e0; --secondary-text: #a9a9a9;
    --border-color: #4f545c; --error-color: #ff5c5c; --accent-color: #007bff;
}
body.light-theme {
    --bg-color: #f4f7f9; --surface-color: #ffffff; --primary-text: #333; --secondary-text: #555;
    --border-color: #ddd; --error-color: #d93025; --accent-color: #007bff;
}
@keyframes fadeIn { from { opacity: 0; transform: scale(0.98) translateY(-10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
body {
    margin: 0; font-family: 'Kanit', sans-serif; background-color: var(--bg-color); color: var(--primary-text);
    display: flex; justify-content: center; align-items: center; min-height: 100vh;
    padding: 20px; box-sizing: border-box; transition: background-color 0.3s, color 0.3s;
}
#theme-toggle {
    position: fixed; top: 20px; right: 20px; background: var(--surface-color); border: 1px solid var(--border-color);
    color: var(--primary-text); width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 18px;
    display: flex; justify-content: center; align-items: center; z-index: 1000; transition: all 0.3s;
}
#theme-toggle:hover { transform: scale(1.1); }
.login-container {
    background-color: var(--surface-color); padding: 40px; border-radius: 8px; border: 1px solid var(--border-color);
    width: 100%; max-width: 420px; box-sizing: border-box; transition: all 0.3s; animation: fadeIn 0.7s ease-out forwards;
}
.logo-container { text-align: center; margin-bottom: 24px; color: var(--primary-text); }
.logo-container img { height: 40px; width: auto; opacity: 0.9; }
h1 { text-align: center; color: var(--primary-text); margin: 0 0 10px 0; font-weight: 500; font-size: 2rem; }
.subtitle { text-align: center; color: var(--secondary-text); margin: 0 0 30px 0; }
.form-group { margin-bottom: 20px; }
label { display: block; color: var(--secondary-text); margin-bottom: 8px; font-weight: 400; }
input[type="text"], input[type="password"] {
    width: 100%; padding: 12px; background-color: var(--bg-color); color: var(--primary-text);
    border: 1px solid var(--border-color); border-radius: 4px; box-sizing: border-box; font-family: 'Kanit', sans-serif; transition: all 0.3s;
}
input:focus { border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25); outline: none; }
input.input-error { border-color: var(--error-color); }
input.input-error:focus { box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.25); }
.error-message { color: var(--error-color); font-size: 14px; display: block; min-height: 20px; padding-top: 4px; }
.password-wrapper { position: relative; }
.password-wrapper input { padding-right: 45px; }
#togglePassword { position: absolute; top: 50%; right: 15px; transform: translateY(-50%); cursor: pointer; color: var(--secondary-text); transition: color 0.2s; }
button[type="submit"] {
    width: 100%; padding: 12px; margin-top: 10px; background-color: var(--accent-color); color: white;
    border: none; border-radius: 4px; font-size: 16px; font-family: 'Kanit', sans-serif; font-weight: 500;
    cursor: pointer; transition: all 0.2s;
}
button[type="submit"]:hover { background-color: #0056b3; }
button:disabled { background-color: #555; cursor: not-allowed; }
@media (max-width: 480px) {
    body { padding: 0; align-items: flex-start; padding-top: 5vh; }
    .login-container { width: 100%; max-width: 100%; padding: 30px 20px; border-radius: 0; border: none; }
    #theme-toggle { top: 15px; right: 15px; }
    h1 { font-size: 1.8rem; }
}

.footer-link { text-align: center; }
.footer-link a { color: var(--secondary-text); text-decoration: none; font-size: 0.875rem; }
.footer-link a:hover { text-decoration: underline; }