/* Talr login — Catalis design system (matches talr.no + the desktop app).
   Reskin only: every class/markup hook from main.ts is preserved; this file just
   restyles them. Brand blue #0054f9, dark #1d1d1d CTA, neutral greys, white card,
   Libre Caslon Condensed headline + Roboto body — the same look as the website. */

@font-face {
  font-family: 'Roboto';
  src: url('/fonts/Roboto-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  src: url('/fonts/Roboto-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  src: url('/fonts/Roboto-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Libre Caslon Condensed';
  src: url('/fonts/LibreCaslonCondensed-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Libre Caslon Condensed';
  src: url('/fonts/LibreCaslonCondensed-Italic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --ink: #131313;
  --ink-strong: #0a0a0a;
  --muted: #4c4c4c;
  --faint: #737373;
  --hairline: rgba(0, 0, 0, 0.1);
  --hairline-strong: rgba(0, 0, 0, 0.16);
  --grey: #e5e5e5;
  --grey-hover: #d8d8d8;
  --dark: #1d1d1d;
  --dark-hover: #2b2b2b;
  --blue: #0054f9;
  --blue-hover: #0049d6;
  --blue-tint: #eaf0ff;
  --error: #ea384c;
  --error-tint: #fdecee;
  --success: #2f7649;
  --success-tint: #ecf6ef;
  --warning: #b07a18;
  --warning-tint: #fbf3df;
  --radius-pill: 2rem;
  --radius-card: 24px;
  --radius-field: 10px;
  --font-serif: 'Libre Caslon Condensed', 'Iowan Old Style', 'Times New Roman', serif;
  --font-ui:
    'Roboto', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  display: block;
  min-height: 100%;
}

/* ---- Page shell: centered card on a clean neutral field ------------------ */
.login-page,
.status-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  padding: 40px 16px;
  gap: 18px;
  text-align: center;
}

/* ---- Brand: the Talr ring mark (replaces the old bar-mark via CSS) -------- */
.brand-top,
.status-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.mark {
  display: block;
  width: 56px;
  height: 56px;
  background: url('/talr-icon-black@512.png') center / contain no-repeat;
}

.mark span {
  display: none;
}

.brand-name {
  display: none;
}

/* ---- The card ------------------------------------------------------------ */
.login-shell,
.status-card {
  width: 100%;
  max-width: 27rem;
  padding: 32px 30px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: 0 30px 80px -42px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.login-shell h1,
.status-card h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.login-subtitle,
.status-card p {
  margin: 10px auto 0;
  max-width: 22rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---- Provider buttons (Google / Apple / Microsoft / SSO) ----------------- */
.methods {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.provider-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.provider-button:hover {
  background: #fafafa;
  border-color: rgba(0, 0, 0, 0.28);
}

.provider-button.is-selected {
  border-color: var(--blue);
  background: var(--blue-tint);
}

.provider-icon {
  width: 18px;
  height: 18px;
  flex: none;
}

.apple-icon,
.microsoft-icon {
  width: 17px;
  height: 17px;
}

.last-used {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--blue);
}

/* "Continue as existing session" lives in its own .methods block too */
.switch-account-button {
  margin-top: 2px;
}

/* ---- Divider ------------------------------------------------------------- */
.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 4px;
  font-size: 0.8rem;
  color: var(--faint);
}

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

/* ---- Email / SSO / code forms ------------------------------------------- */
.email-form,
.sso-form,
.code-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
  text-align: left;
}

.line-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.line-field > span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
}

.line-field > span small {
  font-weight: 400;
  color: var(--faint);
}

.line-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-field);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.line-field input::placeholder {
  color: var(--faint);
}

.line-field input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 84, 249, 0.16);
}

/* Collapsible name + password panels */
.email-profile,
.password-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.email-profile.is-open,
.password-panel.is-open {
  display: flex;
}

.email-options {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 2px;
}

/* ---- Primary CTA --------------------------------------------------------- */
.continue-button {
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 0 18px;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 500;
  color: #ffffff;
  background: var(--dark);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.continue-button:hover {
  opacity: 0.9;
}

.continue-button:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ---- Text buttons (forgot password, use code, switch account, etc.) ------ */
.text-button {
  padding: 0;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--blue);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.text-button:hover {
  color: var(--blue-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- Secondary action buttons (resend / try another email / back) -------- */
.resend-button,
.back-button,
.return-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 8px;
  padding: 0 18px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  background: var(--grey);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.resend-button:hover,
.back-button:hover,
.return-link:hover {
  background: var(--grey-hover);
}

.resend-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.try-email-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 6px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.try-email-button:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- Check-email / reset-sent panels ------------------------------------ */
.check-email-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 18px;
  text-align: center;
}

.check-email-panel > p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink);
}

.check-email-help {
  font-size: 0.82rem !important;
  color: var(--faint) !important;
  line-height: 1.5;
}

.check-email-notice {
  font-size: 0.85rem !important;
  color: var(--warning) !important;
}

.code-form {
  margin-top: 12px;
  text-align: left;
}

.email-checkmark {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  vertical-align: middle;
}

/* ---- SSO helpers --------------------------------------------------------- */
.sso-help {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.sso-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---- Captcha host -------------------------------------------------------- */
.captcha-host:empty {
  display: none;
}

.captcha-host {
  display: flex;
  justify-content: center;
}

/* ---- Notices + errors ---------------------------------------------------- */
.login-error {
  margin: 14px auto 0;
  max-width: 22rem;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--error);
  background: var(--error-tint);
  border-radius: var(--radius-field);
}

.login-notice {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding: 14px 16px;
  text-align: left;
  background: var(--warning-tint);
  border-radius: var(--radius-field);
}

.login-notice strong {
  font-size: 0.95rem;
  color: var(--ink);
}

.login-notice span {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---- Footer -------------------------------------------------------------- */
.login-footer {
  max-width: 27rem;
}

.login-footer p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--faint);
}

.login-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-footer a:hover {
  color: var(--ink);
}

/* ---- Status / download / install pages (shared shell) -------------------- */
.status-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.status-check {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
}

.install-steps-card {
  margin-top: 18px;
  padding: 16px;
  text-align: left;
  background: var(--bg);
  border-radius: var(--radius-field);
}

.install-steps {
  margin: 0;
  padding-left: 18px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
}

.install-retry {
  margin-top: 10px;
}

/* ---- Spinner ------------------------------------------------------------- */
.spinner {
  width: 22px;
  height: 22px;
  margin: 8px auto;
  border: 2px solid var(--hairline);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: talr-spin 0.7s linear infinite;
}

@keyframes talr-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Language switch ----------------------------------------------------- */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--faint);
}

.lang-switch a,
.lang-switch button {
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}

.lang-switch a:hover,
.lang-switch button:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lang-sep {
  color: var(--hairline-strong);
}

@media (max-width: 480px) {
  .login-shell,
  .status-card {
    padding: 26px 20px;
  }
  .login-shell h1,
  .status-card h1 {
    font-size: 1.75rem;
  }
}
