/* HIE Dashboard — Login & shared auth pages (requires theme.css) */
:root {
  --navy-950: #041a10;
  --navy-900: #0a2418;
  --navy-800: #0f3322;
  --white: #ffffff;
  --slate-50: #f8faf9;
  --slate-100: #f1f5f3;
  --slate-200: #e2ebe6;
  --slate-400: #94a89e;
  --slate-500: #647a6e;
  --slate-700: #334d40;
  --slate-900: #0f1f17;
  --error-bg: #fef2f2;
  --error-text: #b91c1c;
  --error-border: #fecaca;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-panel: 0 25px 50px -12px rgba(4, 26, 16, 0.35);
  --shadow-btn: 0 4px 14px rgba(26, 127, 75, 0.12);
}

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

body {
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--slate-900);
}

h1, h2, h3, button, a {
  font-family: var(--font);
}

/* Login split layout */
.login-page {
  min-height: 100vh;
  background: var(--slate-50);
}

.login-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 48px 56px;
  background: var(--navy-900);
  color: var(--white);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, var(--primary-glow) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 90% 10%, rgba(46, 157, 92, 0.2) 0%, transparent 50%),
    linear-gradient(160deg, var(--navy-950) 0%, var(--navy-800) 45%, var(--navy-900) 100%);
}

.hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, black 0%, transparent 85%);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 480px;
  animation: fadeUp 0.7s ease-out;
}

.hero-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--primary-muted);
  border: 1px solid rgba(46, 157, 92, 0.4);
  color: var(--primary-light);
  margin-bottom: 28px;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.hero-logo img {
  width: 52px;
  height: 52px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 8px 20px var(--primary-glow));
}

.hero-brand h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--white) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-tagline {
  font-size: 1.05rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 300;
  margin-bottom: 36px;
}

.hero-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.stat {
  flex: 1;
  min-width: 100px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}

.stat-value {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary-light);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
}

.hero-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero-features li {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.88);
}

.feature-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(26, 127, 75, 0.2);
  font-size: 1.1rem;
}

.panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background: var(--slate-50);
}

.panel-inner {
  width: 100%;
  max-width: 400px;
  animation: fadeUp 0.7s ease-out 0.1s both;
}

.panel-header {
  margin-bottom: 32px;
}

.panel-eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.panel-header h2 {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.panel-desc {
  font-size: 0.95rem;
  color: var(--slate-500);
  line-height: 1.6;
}

.alert {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.alert.error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}

.alert.hidden { display: none; }

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  padding: 16px 24px;
  border-radius: 14px;
  background: var(--white);
  border: 1.5px solid var(--slate-200);
  color: var(--slate-700);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.btn-google:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(26, 127, 75, 0.2);
  border-color: var(--primary-light);
}

.btn-google:active {
  transform: translateY(0);
}

.btn-google.disabled,
.btn-thaid.disabled {
  opacity: 0.55;
  pointer-events: none;
  transform: none;
}

.login-provider-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.login-provider-stack .divider {
  margin: 20px 0;
}

.btn-thaid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 14px 28px;
  border-radius: 999px;
  background: linear-gradient(90deg, #0a2744 0%, #164a73 52%, #1e5f94 100%);
  border: none;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  box-shadow:
    0 4px 14px rgba(10, 39, 68, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-thaid:hover {
  transform: translateY(-2px);
  background: linear-gradient(90deg, #0d3156 0%, #1a5585 52%, #2269a8 100%);
  box-shadow:
    0 10px 24px rgba(10, 39, 68, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-thaid:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(10, 39, 68, 0.28);
}

.btn-thaid-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
}

.btn-thaid-icon img {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.btn-thaid-text {
  line-height: 1.25;
  white-space: nowrap;
}

.btn-thaid-brand {
  font-weight: 700;
}

.btn-google-icon {
  display: flex;
  align-items: center;
}

.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 28px 0;
  color: var(--slate-400);
  font-size: 0.8rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--slate-200);
}

.panel-note {
  font-size: 0.8rem;
  color: var(--slate-400);
  line-height: 1.6;
  text-align: center;
}

.panel-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--slate-200);
  font-size: 0.8rem;
  color: var(--slate-400);
}

.footer-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
  flex: 1;
  max-width: 220px;
}

.footer-status-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
}

.footer-status-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Uptime bar — footer compact */
.uptime-bar {
  display: flex;
  align-items: stretch;
  gap: 4px;
  width: 100%;
}

.uptime-bar--footer {
  padding: 10px 12px;
  border-radius: 10px;
  background: #e8f5ee;
  min-height: 36px;
}

.uptime-bar-segment {
  flex: 1;
  min-width: 5px;
  max-width: 14px;
  height: 22px;
  border-radius: 999px;
  background: var(--slate-200);
  transition: background 0.25s ease;
}

.uptime-bar--footer .uptime-bar-segment {
  height: 20px;
}

.uptime-bar-segment.ok {
  background: linear-gradient(180deg, #3cb371 0%, #1a7f4b 100%);
  box-shadow: 0 1px 2px rgba(26, 127, 75, 0.25);
}

.uptime-bar-segment.warn {
  background: linear-gradient(180deg, #e3b341 0%, #bf8700 100%);
}

.uptime-bar-segment.err {
  background: linear-gradient(180deg, #f47067 0%, #cf222e 100%);
}

.uptime-bar-segment.loading {
  background: var(--slate-200);
  animation: uptimePulse 1.2s ease-in-out infinite;
}

.uptime-bar-segment.loading:nth-child(odd) {
  animation-delay: 0.15s;
}

@keyframes uptimePulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Home page */
body.home-page {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-800) 50%, var(--primary) 100%);
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-panel);
  padding: 40px;
  width: 100%;
  max-width: 440px;
}

.card-home { max-width: 520px; }

.brand-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--slate-200);
}

.brand-mini span {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary-dark);
}

.user-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--slate-900);
}

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

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-muted);
}

.muted { color: var(--slate-500); font-size: 0.9rem; }

.lead {
  color: var(--slate-500);
  line-height: 1.6;
  margin-bottom: 8px;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.btn-secondary,
.btn-logout {
  display: block;
  text-align: center;
  padding: 13px 16px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s, background 0.15s;
}

.btn-secondary {
  background: var(--primary-muted);
  color: var(--primary-dark);
  border: 1px solid rgba(26, 127, 75, 0.25);
}

.btn-secondary:hover {
  background: rgba(26, 127, 75, 0.2);
}

.btn-logout {
  background: var(--white);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}

@media (max-width: 960px) {
  .login-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 40px 32px 32px;
    min-height: auto;
  }

  .hero-stats {
    margin-bottom: 28px;
  }

  .hero-features {
    display: none;
  }

  .panel {
    padding: 32px 24px 48px;
  }
}

@media (max-width: 480px) {
  .hero-brand h1 { font-size: 1.75rem; }
  .stat { min-width: calc(50% - 6px); }
  .panel-header h2 { font-size: 1.5rem; }
}
