|
4 | 4 | <meta charset="UTF-8"> |
5 | 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
6 | 6 | <title>/*[|template_title|]*/0</title> |
7 | | - <meta name="theme-color" content="#1a3a5c"> |
| 7 | + <meta name="theme-color" id="meta-theme" content="#0f172a"> |
8 | 8 |
|
9 | 9 | <!-- do not cache this page --> |
10 | 10 | <meta http-equiv="cache-control" content="max-age=0"> |
|
29 | 29 | --radius: 20px; |
30 | 30 | --radius-lg: 24px; |
31 | 31 | } |
| 32 | + [data-theme="dark"] { |
| 33 | + --bg: #0f172a; |
| 34 | + --surface: #1e293b; |
| 35 | + --border: #334155; |
| 36 | + --ink: #f1f5f9; |
| 37 | + --ink-muted: #94a3b8; |
| 38 | + --accent: #93c5fd; |
| 39 | + --accent-hover: #bae0ff; |
| 40 | + --red: #f87171; |
| 41 | + --red-light: #3b1010; |
| 42 | + --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.2), 0 2px 4px -2px rgb(0 0 0 / 0.15); |
| 43 | + --shadow-hover: 0 25px 50px -12px rgb(0 0 0 / 0.3); |
| 44 | + } |
32 | 45 | *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } |
33 | 46 | body { |
34 | 47 | font-family: 'DM Sans', sans-serif; |
|
303 | 316 | 50% { opacity: 0.4; } |
304 | 317 | } |
305 | 318 |
|
| 319 | + /* ── Dark mode overrides ── */ |
| 320 | + [data-theme="dark"] .login-header { |
| 321 | + background: linear-gradient(135deg, #152238 0%, #1c2f4a 50%, #213656 100%); |
| 322 | + border-bottom: 1px solid rgba(255,255,255,0.08); |
| 323 | + box-shadow: 0 4px 24px rgba(0,0,0,0.3); |
| 324 | + } |
| 325 | + [data-theme="dark"] .input-wrap input:focus { |
| 326 | + box-shadow: 0 0 0 3px rgba(147,197,253,0.15); |
| 327 | + } |
| 328 | + [data-theme="dark"] .btn-submit { color: #0f172a; } |
| 329 | + |
306 | 330 | @media (max-width: 600px) { |
307 | 331 | .login-header { padding: 36px 24px 32px; } |
| 332 | + .login-header::before, .login-header::after { display: none; } |
308 | 333 | .login-body { padding: 24px 20px; } |
309 | 334 | } |
| 335 | + @media (prefers-reduced-motion: reduce) { |
| 336 | + *, *::before, *::after { |
| 337 | + animation-duration: 0.01ms !important; |
| 338 | + transition-duration: 0.01ms !important; |
| 339 | + } |
| 340 | + } |
310 | 341 | </style> |
311 | 342 | </head> |
312 | 343 | <body> |
@@ -456,6 +487,42 @@ <h1>/*[|template_title|]*/0</h1> |
456 | 487 | }, 3000); |
457 | 488 | } |
458 | 489 | }); |
| 490 | + |
| 491 | + // ───────────────────────────────────────────── |
| 492 | + // DARK MODE (auto-detect) |
| 493 | + // ───────────────────────────────────────────── |
| 494 | + (function() { |
| 495 | + function applyTheme(dark) { |
| 496 | + var metaTheme = document.getElementById('meta-theme'); |
| 497 | + if (dark) { |
| 498 | + document.documentElement.setAttribute('data-theme', 'dark'); |
| 499 | + if (metaTheme) metaTheme.setAttribute('content', '#152238'); |
| 500 | + } else { |
| 501 | + document.documentElement.removeAttribute('data-theme'); |
| 502 | + if (metaTheme) metaTheme.setAttribute('content', '#0f172a'); |
| 503 | + } |
| 504 | + } |
| 505 | + function getAutoTheme() { |
| 506 | + var hour = new Date().getHours(); |
| 507 | + var prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches; |
| 508 | + return (hour >= 21 || hour < 7 || prefersDark) ? 'dark' : 'light'; |
| 509 | + } |
| 510 | + var saved = localStorage.getItem('theme'); |
| 511 | + var savedDate = localStorage.getItem('theme-date'); |
| 512 | + var today = new Date().toDateString(); |
| 513 | + if (saved && savedDate === today) { |
| 514 | + applyTheme(saved === 'dark'); |
| 515 | + } else { |
| 516 | + applyTheme(getAutoTheme() === 'dark'); |
| 517 | + } |
| 518 | + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function() { |
| 519 | + var s = localStorage.getItem('theme'); |
| 520 | + var sd = localStorage.getItem('theme-date'); |
| 521 | + if (!s || sd !== new Date().toDateString()) { |
| 522 | + applyTheme(getAutoTheme() === 'dark'); |
| 523 | + } |
| 524 | + }); |
| 525 | + })(); |
459 | 526 | </script> |
460 | 527 | </body> |
461 | 528 | </html> |
0 commit comments