/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Dark (default) */
  --bg:            #07131f;
  --bg2:           #0c1e2e;
  --surface:       rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.08);
  --border:        rgba(255,255,255,0.10);
  --border-hover:  rgba(255,255,255,0.22);
  --text:          #e8edf2;
  --text-muted:    rgba(232,237,242,0.50);
  --accent:        #3b82f6;
  --accent-glow:   rgba(59,130,246,0.30);
  --accent2:       #06b6d4;
  --card-bg:       rgba(12,30,46,0.85);
  --card-border:   rgba(59,130,246,0.18);
  --input-bg:      rgba(255,255,255,0.05);
  --input-focus:   rgba(59,130,246,0.20);
  --shadow:        0 32px 80px rgba(0,0,0,0.50);
  --radius:        16px;
  --font-display:  'Syne', sans-serif;
  --font-body:     'DM Sans', sans-serif;
}

[data-theme="light"] {
  --bg:            #f0f4f8;
  --bg2:           #e2eaf2;
  --surface:       rgba(0,0,0,0.04);
  --surface-hover: rgba(0,0,0,0.07);
  --border:        rgba(0,0,0,0.10);
  --border-hover:  rgba(0,0,0,0.22);
  --text:          #0f1f30;
  --text-muted:    rgba(15,31,48,0.50);
  --accent:        #1d5fcc;
  --accent-glow:   rgba(29,95,204,0.20);
  --accent2:       #0891b2;
  --card-bg:       rgba(255,255,255,0.90);
  --card-border:   rgba(29,95,204,0.18);
  --input-bg:      rgba(0,0,0,0.04);
  --input-focus:   rgba(29,95,204,0.12);
  --shadow:        0 32px 80px rgba(15,31,48,0.14);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.4s, color 0.4s;
}

/* ─── Background photo ─────────────────────────────────────── */
.bg-photo {
  position: fixed; inset: 0; z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* default: night until JS sets it */
  background-image: url('/static/img/tmu-night.png');
  transition: opacity 0.8s ease;
}

/* JS sets data-bg="day" or data-bg="night" on <html> */
[data-bg="day"]   .bg-photo { background-image: url('/static/img/tmu-day.png'); }
[data-bg="night"] .bg-photo { background-image: url('/static/img/tmu-night.png'); }

/* Dark overlay — heavier at night for readability */
.bg-overlay {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: rgba(5, 14, 24, 0.55);
  transition: background 0.8s ease;
}

[data-bg="day"]   .bg-overlay { background: rgba(10, 20, 40, 0.38); }
[data-bg="night"] .bg-overlay { background: rgba(4,  10, 22, 0.62); }

/* Light theme: softer overlay */
[data-theme="light"][data-bg="day"]   .bg-overlay { background: rgba(255,255,255,0.28); }
[data-theme="light"][data-bg="night"] .bg-overlay { background: rgba(10, 20, 40, 0.45); }

#particleCanvas {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  opacity: 0.5;
}

/* ─── Page shell ───────────────────────────────────────────── */
.page-shell {
  position: relative; z-index: 3;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ─── Header ───────────────────────────────────────────────── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 40px;
  backdrop-filter: blur(12px);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  transition: background 0.3s, border-color 0.3s;
}

.brand {
  display: flex; align-items: center; gap: 12px;
}

.brand-logo {
  height: 46px; width: auto;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.40));
}

.controls {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}

/* Language */
.language-box {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.language-box:hover { border-color: var(--border-hover); background: var(--surface-hover); }

.lang-icon { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

.language-select {
  background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font-body);
  font-size: 13px; cursor: pointer;
  -webkit-appearance: none;
}

/* Weather */
.weather-card {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  transition: border-color 0.2s;
  min-width: 90px;
}
.weather-icon { font-size: 18px; line-height: 1; }
.weather-city { font-size: 10px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.weather-temp { font-family: var(--font-display); font-weight: 600; font-size: 14px; margin-top: 1px; }

/* Theme button */
.theme-button {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text); font-family: var(--font-body);
  font-size: 13px; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.theme-button:hover { border-color: var(--border-hover); background: var(--surface-hover); }
.theme-icon { font-size: 15px; }

/* ─── Main ─────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 0;
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 40px 60px;
  width: 100%;
  align-items: center;
}

/* ─── Hero ─────────────────────────────────────────────────── */
.hero {
  padding-right: 60px;
}

.hero-eyebrow {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 24px;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.eyebrow-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(64px, 8vw, 108px);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.03em;
  margin-bottom: 28px;
}

.hero-tmu {
  display: block;
  background: linear-gradient(120deg, var(--text) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.hero-mail {
  display: block;
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent2) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 28px var(--accent-glow));
}

.hero-tagline {
  font-size: 14px; letter-spacing: 0.10em;
  color: var(--text-muted);
  font-weight: 300;
}

/* ─── Login Card ───────────────────────────────────────────── */
.login-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 36px 32px 28px;
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,0.03) inset;
  animation: card-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: background 0.4s, border-color 0.3s;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 20px;
}

.card-logo {
  height: 44px; width: auto;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,0.30));
}

.card-header h2 {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  line-height: 1.2; margin-bottom: 2px;
}
.card-header h3 {
  font-size: 12px; font-weight: 400;
  color: var(--text-muted);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 22px;
}

/* ─── Form ─────────────────────────────────────────────────── */
.login-form label {
  display: block;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input-row {
  display: flex; align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--input-focus);
}

.input-icon {
  width: 44px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}
.input-icon svg { width: 16px; height: 16px; }

.input-row input {
  flex: 1; border: none; outline: none;
  background: transparent;
  color: var(--text); font-family: var(--font-body);
  font-size: 14px; padding: 13px 0;
}
.input-row input::placeholder { color: var(--text-muted); }

.domain {
  padding: 0 14px;
  font-size: 12px; color: var(--text-muted);
  font-weight: 500; letter-spacing: 0.02em;
  white-space: nowrap;
  border-left: 1px solid var(--border);
}

.login-button {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border: none; border-radius: 12px;
  color: #fff; font-family: var(--font-display);
  font-size: 15px; font-weight: 700;
  cursor: pointer; letter-spacing: 0.02em;
  transition: transform 0.18s, box-shadow 0.18s, opacity 0.18s;
  box-shadow: 0 6px 24px var(--accent-glow);
  position: relative; overflow: hidden;
}
.login-button::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 100%);
  pointer-events: none;
}
.login-button:hover  { transform: translateY(-2px); box-shadow: 0 10px 32px var(--accent-glow); }
.login-button:active { transform: translateY(0); opacity: 0.9; }

.btn-arrow { width: 16px; height: 16px; transition: transform 0.2s; }
.login-button:hover .btn-arrow { transform: translateX(3px); }

/* ─── Divider ──────────────────────────────────────────────── */
.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0;
}
.divider-line {
  flex: 1; height: 1px;
  background: var(--border);
}
.divider-text {
  font-size: 11px; color: var(--text-muted);
  font-weight: 500; letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ─── Direct Button ────────────────────────────────────────── */
.direct-button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text); text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: border-color 0.2s, background 0.2s, transform 0.18s;
  margin-bottom: 22px;
}
.direct-button:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.gmail-icon { width: 20px; height: 20px; flex-shrink: 0; }
.direct-button span { flex: 1; }
.ext-icon {
  width: 13px; height: 13px;
  color: var(--text-muted); flex-shrink: 0;
}

/* ─── Copyright ────────────────────────────────────────────── */
.copyright {
  font-size: 11px; color: var(--text-muted);
  text-align: center; line-height: 1.6;
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 860px) {
  .main {
    grid-template-columns: 1fr;
    padding: 36px 24px 48px;
    gap: 32px;
  }
  .hero { padding-right: 0; text-align: center; }
  .hero-eyebrow { justify-content: center; }
  .login-card { max-width: 440px; margin: 0 auto; width: 100%; }
}

@media (max-width: 640px) {
  .header { padding: 12px 16px; gap: 8px; }
  .brand-logo { height: 40px; }
  .controls { gap: 8px; }
  .language-box { padding: 6px 10px; }
  .language-select { font-size: 12px; }
  .weather-card { display: none; }
  .theme-button { padding: 6px 10px; font-size: 12px; }
  .main { padding: 24px 16px 36px; gap: 24px; }
  .hero-title { font-size: clamp(52px, 15vw, 88px); }
  .hero-eyebrow { font-size: 10px; margin-bottom: 16px; }
  .hero-tagline { font-size: 12px; }
  .login-card { padding: 28px 20px 22px; border-radius: 20px; }
  .card-header { gap: 10px; margin-bottom: 16px; }
  .card-header h2 { font-size: 13px; }
  .input-row input { font-size: 16px; } /* prevent iOS zoom */
  .login-button { padding: 13px 20px; font-size: 14px; }
}

@media (max-width: 400px) {
  .main { padding: 20px 12px 28px; }
  .hero { display: none; }
  .login-card { max-width: 100%; }
}
