/* ==========================================================================
   Microsoft 365 Redirect — Fluent / Office-inspired UI
   Matches Microsoft sign-in & subscription activation patterns
   ========================================================================== */

:root {
  /* Fluent neutral palette */
  --neutral-bg-page: #f2f2f2;
  --neutral-bg-card: #ffffff;
  --neutral-bg-subtle: #faf9f8;
  --neutral-stroke: #edebe9;
  --neutral-stroke-strong: #d2d0ce;
  --neutral-fg-1: #242424;
  --neutral-fg-2: #424242;
  --neutral-fg-3: #616161;
  --neutral-fg-4: #707070;
  --neutral-fg-disabled: #a19f9d;

  /* Brand */
  --brand-primary: #0078d4;
  --brand-primary-hover: #106ebe;
  --brand-primary-pressed: #005a9e;
  --brand-primary-tint: #deecf9;

  /* Status */
  --success-fg: #107c10;
  --success-bg: #dff6dd;
  --error-fg: #a4262c;

  /* Elevation — Microsoft standard shadow */
  --shadow-card:
    0 1.6px 3.6px rgba(0, 0, 0, 0.13),
    0 0.3px 0.9px rgba(0, 0, 0, 0.11);
  --shadow-card-hover:
    0 3.2px 7.2px rgba(0, 0, 0, 0.13),
    0 0.6px 1.8px rgba(0, 0, 0, 0.11);

  --font-family:
    "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", sans-serif;
  --font-size-base: 15px;
  --panel-width: 440px;
}

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

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

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--neutral-fg-1);
  background: var(--neutral-bg-page);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* --- Page shell (Microsoft gray canvas) --- */
.ms-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.ms-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(0, 120, 212, 0.04), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(0, 120, 212, 0.03), transparent 35%),
    var(--neutral-bg-page);
}

.ms-bg-grid {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, black 20%, transparent 80%);
}

/* --- Top bar --- */
.ms-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  min-height: 48px;
}

.ms-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: inherit;
}

.ms-wordmark-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.ms-wordmark-ms {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--neutral-fg-2);
  letter-spacing: -0.01em;
}

.ms-wordmark-product {
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--neutral-fg-4);
}

.ms-topbar-meta {
  font-size: 0.75rem;
  color: var(--neutral-fg-4);
}

/* --- Main content --- */
.ms-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.25rem 2rem;
}

/* --- Panel (Microsoft sign-in card) --- */
.ms-panel {
  width: 100%;
  max-width: var(--panel-width);
  background: var(--neutral-bg-card);
  box-shadow: var(--shadow-card);
  padding: 2.75rem 2.75rem 2rem;
  text-align: left;
}

.ms-panel-compact {
  padding: 2.25rem 2.75rem 2rem;
}

.fade-in {
  animation: msFadeIn 0.45s cubic-bezier(0.1, 0.9, 0.2, 1) both;
}

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

/* --- Setup progress (Office activation style) --- */
.ms-progress {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 1.75rem;
}

.ms-progress-step {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex: 1;
  min-width: 0;
}

.ms-progress-dot {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.6875rem;
  font-weight: 600;
  border: 1.5px solid var(--neutral-stroke-strong);
  color: var(--neutral-fg-disabled);
  background: var(--neutral-bg-card);
}

.ms-progress-step.is-done .ms-progress-dot {
  background: var(--success-fg);
  border-color: var(--success-fg);
  color: #fff;
}

.ms-progress-step.is-active .ms-progress-dot {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
  box-shadow: 0 0 0 3px var(--brand-primary-tint);
}

.ms-progress-label {
  font-size: 0.6875rem;
  color: var(--neutral-fg-disabled);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ms-progress-step.is-active .ms-progress-label,
.ms-progress-step.is-done .ms-progress-label {
  color: var(--neutral-fg-2);
  font-weight: 600;
}

.ms-progress-line {
  flex: 0 0 1.5rem;
  height: 1.5px;
  background: var(--neutral-stroke-strong);
  margin: 0 0.25rem;
}

.ms-progress-line.is-done {
  background: var(--success-fg);
}

/* --- Typography --- */
.ms-eyebrow {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--brand-primary);
  margin-bottom: 0.5rem;
}

.ms-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--neutral-fg-1);
  margin-bottom: 0.625rem;
}

.ms-lead {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--neutral-fg-3);
  margin-bottom: 1.75rem;
}

/* --- Info callout (Microsoft message bar style) --- */
.ms-callout {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  padding: 0.75rem 0.875rem;
  background: var(--brand-primary-tint);
  border-left: 3px solid var(--brand-primary);
  margin-bottom: 1.5rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--neutral-fg-2);
}

.ms-callout-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--brand-primary);
}

/* --- Action area --- */
.ms-action {
  margin-bottom: 1.25rem;
}

.ms-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 32px;
  padding: 0.5rem 1.25rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.25;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  transition:
    background 0.1s ease,
    border-color 0.1s ease,
    color 0.1s ease;
}

.ms-btn-primary {
  color: #ffffff;
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

.ms-btn-primary:hover:not(:disabled) {
  background: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
}

.ms-btn-primary:active:not(:disabled) {
  background: var(--brand-primary-pressed);
  border-color: var(--brand-primary-pressed);
}

.ms-btn-primary:focus-visible {
  outline: 2px solid var(--neutral-fg-1);
  outline-offset: 2px;
}

.ms-btn-primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.ms-btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: msSpin 0.75s linear infinite;
}

.ms-btn-primary.is-loading .ms-btn-spinner {
  display: block;
}

.ms-btn-primary.is-loading .ms-btn-label {
  display: none;
}

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

.ms-hint {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--neutral-fg-4);
  line-height: 1.45;
}

.ms-error {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--error-fg);
}

.hidden {
  display: none !important;
}

/* --- Trust badge --- */
.ms-trust {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success-fg);
  background: var(--success-bg);
  border-radius: 2px;
}

.ms-trust svg {
  flex-shrink: 0;
}

/* --- App strip (Office product colors) --- */
.ms-apps {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--neutral-stroke);
}

.ms-app-icon {
  width: 28px;
  height: 28px;
  border-radius: 2px;
  display: grid;
  place-items: center;
  font-size: 0.5625rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  opacity: 0.92;
}

.ms-app-word { background: #185abd; }
.ms-app-excel { background: #107c41; }
.ms-app-ppt { background: #c43e1c; }
.ms-app-outlook { background: #0078d4; }
.ms-app-teams { background: #464eb8; }
.ms-app-onenote { background: #7719aa; }

/* --- Page footer --- */
.ms-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 1.25rem 1.5rem;
  font-size: 0.75rem;
  color: var(--neutral-fg-4);
  line-height: 1.7;
}

.ms-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1rem;
  margin-bottom: 0.375rem;
}

.ms-footer-links a {
  color: var(--neutral-fg-4);
  text-decoration: none;
}

.ms-footer-links a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}

.ms-footer-brand {
  color: var(--neutral-fg-3);
}

/* --- Responsive --- */
@media (max-width: 520px) {
  .ms-panel {
    padding: 2rem 1.5rem 1.75rem;
  }

  .ms-title {
    font-size: 1.3125rem;
  }

  .ms-progress-label {
    display: none;
  }

  .ms-topbar {
    padding: 0.875rem 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in,
  .ms-btn-spinner {
    animation: none;
  }

  .ms-btn {
    transition: none;
  }
}
