/* 20-auth-invite-and-loading.css
   Sign-in, invite and onboarding pages, and the shared loading component.
   Files in css/ load in filename order and the cascade depends on it: see docs/CSS.md. */

.onboarding-screen {
  position: fixed;
  inset: 0;
  z-index: 10000001;
  display: grid;
  place-items: start center;
  overflow-y: auto;
  padding: clamp(20px, 6vh, 54px) 18px;
  background: #111214;
  color: #f2f3f5;
}
.onboarding-screen.hidden,
.onboarding-step.hidden,
.onboarding-results.hidden,
.onboarding-error.hidden {
  display: none;
}
.onboarding-card {
  width: min(560px, 100%);
  padding: 26px;
  border: 1px solid #3f4147;
  border-radius: 18px;
  background: #1e1f22;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.45);
}
.onboarding-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  color: #949ba4;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.onboarding-progress b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #5865f2;
  color: #fff;
}
.onboarding-step h2 {
  margin: 0;
  font-size: clamp(25px, 6vw, 34px);
  letter-spacing: -0.035em;
}
.onboarding-step > p {
  margin: 8px 0 20px;
  color: #b5bac1;
  line-height: 1.45;
}
.onboarding-field {
  position: relative;
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: #dbdee1;
  font-size: 13px;
  font-weight: 800;
}
.onboarding-field input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid #3f4147;
  border-radius: 8px;
  background: #111214;
  color: #f2f3f5;
  font: inherit;
}
.onboarding-results {
  position: absolute;
  z-index: 3;
  top: 72px;
  left: 0;
  right: 0;
  overflow: hidden;
  border: 1px solid #464a54;
  border-radius: 9px;
  background: #232428;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
}
.onboarding-results button {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #36383e;
  background: transparent;
  color: #f2f3f5;
  cursor: pointer;
  padding: 11px 12px;
  text-align: left;
}
.onboarding-results button:last-child {
  border-bottom: 0;
}
.onboarding-results button:hover {
  background: #313338;
}
.onboarding-primary {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: #5865f2;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
}
.onboarding-primary:disabled {
  background: #404249;
  color: #949ba4;
  cursor: not-allowed;
}
.onboarding-options {
  display: grid;
  gap: 10px;
}
.onboarding-options button {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid #3f4147;
  border-radius: 10px;
  background: #2b2d31;
  color: #f2f3f5;
  cursor: pointer;
  padding: 14px;
  text-align: left;
}
.onboarding-options button.restricted {
  position: relative;
  overflow: hidden;
  border-color: #4b3a3e;
  cursor: not-allowed;
}
.onboarding-options button.restricted::before,
.shift-source-option.restricted::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background: rgba(25, 27, 31, 0.56);
}
.onboarding-options button.restricted::after,
.shift-source-option.restricted::after {
  content: "COMING SOON";
  position: absolute;
  z-index: 2;
  top: 13px;
  right: -34px;
  width: 132px;
  padding: 5px 0;
  transform: rotate(36deg);
  background: #d7193f;
  color: #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-align: center;
}
.shift-source-option.restricted {
  position: relative;
  overflow: hidden;
  cursor: not-allowed;
}
:root[data-theme="light"] .onboarding-options button.restricted::before,
:root[data-theme="light"] .shift-source-option.restricted::before {
  background: rgba(226, 229, 234, 0.68);
}
.shift-source-option.restricted input {
  pointer-events: none;
}
.onboarding-options button:hover {
  border-color: #5865f2;
  background: rgba(88, 101, 242, 0.15);
}
.onboarding-options strong {
  font-size: 15px;
}
.onboarding-options span {
  color: #b5bac1;
  font-size: 12px;
}
.onboarding-job-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 290px;
  overflow-y: auto;
  margin: 0 0 16px;
}
.onboarding-job-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #3f4147;
  border-radius: 8px;
  background: #2b2d31;
  padding: 9px;
  font-size: 12px;
  font-weight: 800;
}
.onboarding-job-list label:has(input:checked) {
  border-color: #5865f2;
  background: rgba(88, 101, 242, 0.18);
}
.onboarding-file {
  display: grid;
  place-items: center;
  min-height: 130px;
  margin-bottom: 14px;
  border: 1px dashed #65708a;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
}
.onboarding-file input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.onboarding-file span {
  color: #949ba4;
  font-size: 11px;
}
.onboarding-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 7px;
  background: rgba(229, 22, 54, 0.16);
  color: #ff9aaa;
  font-size: 13px;
  font-weight: 750;
}
:root[data-theme="light"] .onboarding-screen {
  background: #f3f5f8;
  color: #20242a;
}
:root[data-theme="light"] .onboarding-card {
  border-color: #d4d8df;
  background: #fff;
}
:root[data-theme="light"] .onboarding-field,
:root[data-theme="light"] .onboarding-step h2 {
  color: #20242a;
}
:root[data-theme="light"] .onboarding-field input,
:root[data-theme="light"] .onboarding-results {
  border-color: #ccd1d8;
  background: #f7f8fa;
  color: #20242a;
}
@media (max-width: 520px) {
  .onboarding-card {
    padding: 20px;
  }
  .onboarding-job-list {
    grid-template-columns: 1fr;
  }
}

body.auth-required > #weather-row,
body.auth-required > #app,
body.auth-required > #tools-home-btn,
body.auth-required > #roster-open-btn,
body.auth-required > #add-member-open-btn,
body.auth-required > #undo-action-btn,
body.auth-required > #debug-open-btn {
  display: none !important;
}

#auth-first-store.hidden,
#auth-first-store .auth-field.hidden,
.auth-field.hidden,
.auth-step-hidden,
.auth-error.hidden {
  display: none !important;
}

.auth-card {
  width: min(520px, 100%);
  max-height: none;
  margin-top: clamp(22px, 7vh, 56px);
  overflow: visible;
  padding: 28px;
  border: 1px solid #3f4147;
  border-radius: 18px;
  background: #1e1f22;
  color: var(--text);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.45);
}

.auth-brand {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-bottom: 26px;
  text-align: center;
}

.auth-logo-placeholder {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid #51545c;
  border-radius: 18px;
  background: linear-gradient(145deg, #343a58, #252732);
  color: #dce5ff;
  font-size: 30px;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

.auth-eyebrow {
  color: #9ec3ff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.6px;
}

.auth-brand h1 {
  margin: 0;
  font-size: clamp(30px, 7vw, 44px);
  line-height: 1;
}

.auth-brand p,
.auth-note,
.auth-source-card p,
.auth-source-options small {
  color: #b5bac1;
  line-height: 1.4;
}

.auth-brand p {
  margin: -2px 0 0;
  font-size: 14px;
}

.auth-provider-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(320px, 100%);
  margin: 0 auto 28px;
  padding: 4px;
  border: 1px solid #3f4147;
  border-radius: 12px;
  background: #111214;
  isolation: isolate;
}

.auth-provider-row::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 8px;
  background: #5865f2;
  box-shadow: 0 5px 14px rgba(88, 101, 242, 0.28);
  transform: translateX(0);
  transition: transform 180ms ease;
}

.auth-provider-row[data-mode="register"]::before {
  transform: translateX(100%);
}

.auth-provider-btn,
.auth-submit,
.auth-source-options button {
  border: 0;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 900;
  cursor: pointer;
}

.auth-provider-btn {
  min-height: 44px;
  position: relative;
  background: transparent;
  color: #b5bac1;
  transition: color 180ms ease;
}

.auth-provider-btn.secondary {
  background: transparent;
  color: #b5bac1;
}

.auth-provider-btn.active {
  color: #fff;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: #949ba4;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #3f4147;
}

.auth-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #dbdee1;
  font-size: 13px;
  font-weight: 800;
}

.auth-field input {
  height: 44px;
  padding: 0 12px;
  border: 1px solid #3f4147;
  border-radius: 8px;
  background: #111214;
  color: #f2f3f5;
  font-size: 15px;
}

.auth-source-card {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid #3f4147;
  border-radius: 12px;
  background: #232428;
}

.auth-source-card strong {
  display: block;
  margin-bottom: 4px;
  color: #f2f3f5;
}

.auth-source-options {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.auth-source-options button {
  display: grid;
  gap: 2px;
  padding: 12px;
  border: 1px solid #3f4147;
  background: #2b2d31;
  color: #f2f3f5;
  text-align: left;
}

.auth-source-options button.active {
  border-color: #5865f2;
  background: rgba(88, 101, 242, 0.18);
}

.auth-submit {
  width: 100%;
  min-height: 46px;
  background: #5865f2;
  color: #fff;
  font-size: 15px;
}

.auth-actions {
  display: flex;
  gap: 9px;
}
.auth-actions .auth-submit {
  flex: 1;
}

.auth-note {
  margin: 12px 0 0;
  font-size: 12px;
}

.auth-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 7px;
  background: rgba(229, 22, 54, 0.16);
  color: #ff9aaa;
  font-size: 13px;
  font-weight: 750;
}

/* Invite (join-as-manager) page polish */
.invite-card {
  position: relative;
  overflow: hidden;
}
.invite-card::before {
  content: "";
  position: absolute;
  top: -130px;
  left: 50%;
  width: 360px;
  height: 240px;
  background: radial-gradient(circle, rgba(88, 101, 242, 0.28), transparent 70%);
  transform: translateX(-50%);
  pointer-events: none;
}

.invite-store-banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  padding: 12px 14px;
  border: 1px solid rgba(88, 101, 242, 0.35);
  border-radius: 12px;
  background: rgba(88, 101, 242, 0.12);
  color: #cdd3ff;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease,
    color 0.16s ease;
}
.invite-store-banner-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(88, 101, 242, 0.22);
  color: #9ec3ff;
}
.invite-store-banner-icon svg {
  width: 17px;
  height: 17px;
}
.invite-store-banner.invite-store-banner-error {
  border-color: rgba(229, 22, 54, 0.4);
  background: rgba(229, 22, 54, 0.12);
  color: #ff9aaa;
}
.invite-store-banner.invite-store-banner-error .invite-store-banner-icon {
  background: rgba(229, 22, 54, 0.2);
  color: #ff9aaa;
}

.auth-field input {
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease;
}
.auth-field input:focus {
  outline: none;
  border-color: #5865f2;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.22);
}
.auth-field input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-field-input-wrap {
  position: relative;
}
.auth-field-input-wrap input {
  width: 100%;
  padding-right: 44px;
  box-sizing: border-box;
}
.auth-field-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #8b90a0;
  cursor: pointer;
  transition:
    color 0.16s ease,
    background-color 0.16s ease;
}
.auth-field-toggle:hover {
  color: #dbdee1;
  background: rgba(255, 255, 255, 0.06);
}
.auth-field-toggle svg {
  width: 19px;
  height: 19px;
}

.auth-field-msg {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 700;
  color: #8b90a0;
  transition: color 0.16s ease;
}
.auth-field-msg.is-error {
  color: #ff9aaa;
}
.auth-field-msg.is-ok {
  color: #63c99e;
}

.auth-submit {
  transition:
    transform 0.12s ease,
    box-shadow 0.16s ease,
    opacity 0.16s ease;
  box-shadow: 0 10px 26px rgba(88, 101, 242, 0.32);
}
.auth-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.auth-submit:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(88, 101, 242, 0.4);
}
.auth-submit:not(:disabled):active {
  transform: translateY(0);
}

.invite-privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #8b90a0;
}
.invite-privacy-note svg {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: #6b7280;
}

:root[data-theme="light"] .invite-store-banner {
  border-color: rgba(88, 101, 242, 0.28);
  background: rgba(88, 101, 242, 0.08);
  color: #3d47a8;
}
:root[data-theme="light"] .invite-store-banner-icon {
  background: rgba(88, 101, 242, 0.16);
  color: #4653c9;
}
:root[data-theme="light"] .invite-store-banner.invite-store-banner-error {
  border-color: rgba(229, 22, 54, 0.3);
  background: rgba(229, 22, 54, 0.08);
  color: #b6293f;
}
:root[data-theme="light"] .invite-store-banner.invite-store-banner-error .invite-store-banner-icon {
  background: rgba(229, 22, 54, 0.14);
  color: #b6293f;
}
:root[data-theme="light"] .auth-field-toggle {
  color: #7a8088;
}
:root[data-theme="light"] .auth-field-toggle:hover {
  color: #20242a;
  background: rgba(0, 0, 0, 0.05);
}
:root[data-theme="light"] .auth-field-msg {
  color: #7a8088;
}
:root[data-theme="light"] .auth-field-msg.is-error {
  color: #c23a4e;
}
:root[data-theme="light"] .auth-field-msg.is-ok {
  color: #1f8f63;
}
:root[data-theme="light"] .invite-privacy-note {
  color: #7a8088;
}
:root[data-theme="light"] .invite-privacy-note svg {
  color: #9aa0a8;
}

:root[data-theme="light"] .auth-screen {
  background: radial-gradient(circle at top, rgba(88, 101, 242, 0.14), transparent 40%), #f2f3f5;
}

:root[data-theme="light"] .auth-logo-placeholder {
  border-color: #d5d9e0;
  background: linear-gradient(145deg, #f6f7ff, #e1e5f3);
  color: #394261;
  box-shadow: 0 12px 30px rgba(25, 42, 61, 0.12);
}

:root[data-theme="light"] .auth-card {
  border-color: #d9dde3;
  background: #fff;
  box-shadow: 0 22px 65px rgba(25, 42, 61, 0.18);
}

:root[data-theme="light"] .auth-brand p,
:root[data-theme="light"] .auth-note,
:root[data-theme="light"] .auth-source-card p,
:root[data-theme="light"] .auth-source-options small {
  color: #5f6670;
}

:root[data-theme="light"] .auth-field,
:root[data-theme="light"] .auth-source-card strong,
:root[data-theme="light"] .auth-source-options button {
  color: #20242a;
}

:root[data-theme="light"] .auth-field input,
:root[data-theme="light"] .auth-source-card,
:root[data-theme="light"] .auth-source-options button {
  border-color: #d9dde3;
  background: #f2f3f5;
}

:root[data-theme="light"] .auth-field input {
  color: #20242a;
}

:root[data-theme="light"] .auth-provider-btn.secondary {
  background: transparent;
  color: #5f6670;
}

:root[data-theme="light"] .auth-provider-row {
  border-color: #d9dde3;
  background: #eef0f3;
}

:root[data-theme="light"] .auth-provider-btn {
  color: #5f6670;
}

:root[data-theme="light"] .auth-provider-btn.active {
  color: #fff;
}

:root[data-theme="light"] .auth-source-options button.active {
  border-color: #5865f2;
  background: #e8ebff;
}

@media (max-width: 520px) {
  .auth-screen {
    padding: 12px;
  }

  .auth-card {
    padding: 20px;
    margin-top: 10px;
    max-height: calc(100vh - 20px);
  }

  .auth-provider-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* Standardized loading component: spinner + cycling CFA phrase (js/loading.js). Used for the full-screen boot splash and every hub's inline loading state. */
.cfa-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 55vh;
  padding: 40px 20px;
  text-align: center;
}

.cfa-loading-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid color-mix(in srgb, var(--text) 15%, transparent);
  border-top-color: #5865f2;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.cfa-loading-phrase {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  opacity: 0.85;
}

:root[data-theme="light"] #loading-screen {
  background: var(--bg);
}

:root[data-theme="light"] .cfa-loading-spinner {
  border-color: rgba(32, 36, 42, 0.13);
  border-top-color: #5865f2;
}

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