/* ==========================================================================
   LiveCall - shared styles for the authentication pages
   Served from /auth/auth.css. No external resources, no frameworks.
   ========================================================================== */

:root {
  /* CaratIQ-derived brand tokens — same values as /app/app.css. --primary is the dark text
     used for headings/labels, --accent the brand blue. Success states are blue, never green. */
  --primary: #1f2933;
  --accent: #0146c6;
  --accent-hover: #0139a3;
  --text: #1f2933;
  --muted: #626670;
  --line: #e7e7e7;
  --radius: 12px;
  --radius-sm: 8px;

  --danger: #c62421;
  --success: #0146c6;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --placeholder: #9e9ea8;
  --ring: rgba(1, 70, 198, 0.14);
  --ring-danger: rgba(198, 36, 33, 0.16);
  --shadow: 0 0 16px rgba(49, 62, 88, 0.03), 0 24px 48px -24px rgba(31, 41, 51, 0.18);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: Lexend, Inter, ui-sans-serif, system-ui, sans-serif;
}

/* Base ------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background-color: #f7f8fa;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Header ----------------------------------------------------------------- */

.site-header {
  display: flex;
  justify-content: center;
  padding: 28px 16px 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  color: var(--primary);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: block;
  flex: none;
  width: 30px;
  height: 30px;
}

.brand-mark .mark-bg {
  fill: var(--accent);
}

.brand-mark .mark-fg {
  fill: #ffffff;
}

/* Layout ----------------------------------------------------------------- */

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 16px 48px;
}

.card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-head {
  margin: 0 0 24px;
}

.card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--primary);
  overflow-wrap: anywhere;
}

.card-lead {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.card-lead strong {
  color: var(--text);
  font-weight: 600;
}

/* Banner ----------------------------------------------------------------- */

.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 20px;
  padding: 12px 10px 12px 14px;
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.banner-error {
  color: #a51d1b;
  background: #fdeceb;
  border-color: #f1c2c1;
}

/* Success and info share the brand blue (no green anywhere). */
.banner-success,
.banner-info {
  color: var(--accent-hover);
  background: #eff6ff;
  border-color: #bfdbfe;
}

.banner-message {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.banner-message a {
  color: inherit;
  font-weight: 600;
}

.banner-dismiss {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -10px -8px -10px 0;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.7;
}

.banner-dismiss:hover {
  opacity: 1;
  background: rgba(31, 41, 51, 0.06);
}

.banner-dismiss svg {
  width: 14px;
  height: 14px;
}

/* Forms ------------------------------------------------------------------ */

.auth-form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > label,
.label-row > label {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--primary);
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.label-hint {
  font-weight: 400;
  color: var(--muted);
}

.input {
  display: block;
  width: 100%;
  min-height: 46px;
  margin: 0;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.04);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

.input:hover {
  border-color: #d5d5d9;
}

.input:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.input[readonly] {
  color: var(--muted);
  background: var(--surface-muted);
}

.input[readonly]:focus {
  border-color: var(--line);
  box-shadow: none;
}

.field.has-error .input {
  border-color: var(--danger);
}

.field.has-error .input:focus {
  box-shadow: 0 0 0 3px var(--ring-danger);
}

.input-wrap {
  position: relative;
}

.input-wrap .input {
  padding-right: 72px;
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  margin: 0;
  min-height: 40px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.toggle-password:hover {
  color: var(--primary);
  background: var(--surface-muted);
}

.hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.hint.is-ok {
  color: var(--success);
}

.field-error {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--danger);
}

.field-error:empty {
  display: none;
}

/* Buttons ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  margin: 0;
  padding: 10px 16px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  color: var(--primary);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  background: var(--surface-muted);
  border-color: #d5d5d9;
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 1px 2px rgba(1, 70, 198, 0.25);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

/* Text ------------------------------------------------------------------- */

.muted-text {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.note {
  margin: -6px 0 0;
  font-size: 13px;
  text-align: center;
  color: var(--muted);
}

.fine-print {
  margin: 14px 0 0;
  font-size: 12px;
  text-align: center;
  color: var(--muted);
}

.form-footer {
  margin: 22px 0 0;
  font-size: 14px;
  text-align: center;
  color: var(--muted);
}

.form-footer a,
.small-link,
.text-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.form-footer a:hover,
.small-link:hover,
.text-link:hover {
  text-decoration: underline;
}

.small-link {
  font-size: 13px;
  white-space: nowrap;
}

.callout {
  margin: 0;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}

/* Panels (success / invalid states) -------------------------------------- */

.stack {
  display: grid;
  gap: 16px;
}

/* Success / info panels are centered and brand blue (never green). */
.panel {
  display: grid;
  gap: 12px;
  text-align: center;
}

.panel:focus {
  outline: none;
}

.panel-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 auto 4px;
  color: var(--accent);
  background: #eff6ff;
  border-radius: 50%;
}

.panel-icon svg {
  width: 22px;
  height: 22px;
}

.panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
}

.panel p {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.panel .btn {
  margin: 4px auto 0;
}

/* Responsive ------------------------------------------------------------- */

@media (max-width: 480px) {
  .site-header {
    padding: 20px 16px 4px;
  }

  .auth-main {
    align-items: flex-start;
    padding: 12px 16px 32px;
  }

  .card {
    padding: 24px 20px;
    border-radius: 12px;
  }

  .card-title {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

/* Brand typography: Lexend for titles, Inter for everything else (loaded by each page). */
h1,
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

button,
input,
select,
textarea {
  font-family: inherit;
}
