/*
 * Login — CC Template (Tier=Template)
 * Affino Control Centre login screen. Composes Input (username + password),
 * Checkbox (remember me) and Button (primary, full-width) on a centred card.
 *
 * Figma: Affino CC Hybrid DS — "Control Screen", node 4254:11692
 *   Desktop 4254:11691 · Mobile 4254:11690
 * Renders under [data-brand="cc"]; every paint value resolves to a CC token.
 * Shell paint values (page bg, column/head/card gap, padding, radius) are
 * Figma-bound — see Login.figma-notes.md in the design repo, section Shell.
 *
 * Lives in css/pages/ with the rest of this page (view, controller, js) rather than in the
 * transitional css/cc2/ island, which holds vendored design-system components only and is
 * folded into the MVC structure by Part 2 Phase 3.
 *
 * Rebuilt for TASK-403384. This file adds no paint value the design specifies
 * differently. Where the design is silent (error case, password toggle) it
 * composes existing design-system components rather than inventing styling.
 *
 * Scoped override: the two Input fields and the Checkbox box use
 * --ao-surface-input (a softer input surface) in place of their default
 * --ao-surface-primary. Scoped to .cc-login only — base components unchanged.
 */

/* ── Shell: full-viewport, vertically centred ─────────── */
.cc-login {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--ao-spacing-8);                  /* 40 — Desktop */
  background-color: var(--cc-ui-primary-bg);
}

/* ── Centred content column ───────────────────────────── */
.cc-login__column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--ao-spacing-7);                       /* 32 — Desktop */
  width: 100%;
  max-width: var(--ao-size-9);                    /* 512 */
}

/* ── Logo + title group ───────────────────────────────── */
.cc-login__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--ao-spacing-4);                       /* 12 — Desktop */
}

/* Affino wordmark.
 * Same visual result as the design, reached through Affino's own asset
 * pipeline rather than the design's technique: the design paints a CSS mask of
 * affinoLogo.svg because figmaTest is a static prototype with no icon system.
 * Affino instead
 * renders the mark as inline SVG through the CC icon library (AffinoLogoBig,
 * 168x38, fill="currentColor"), which is the same approach already used for the
 * ControlScreen icon navigation, where the same mapping was agreed. Painting
 * via `color` keeps it theme aware and avoids a second copy of the asset.
 * Intrinsic width is 168 against the design's 167; the SVG is the real asset. */
.cc-login__brand {
  flex-shrink: 0;
  color: var(--ao-surface-brand);
}

.cc-login__title {
  margin: 0;
  font-family: var(--ao-font-title);
  font-weight: var(--ao-font-bold);
  font-size: var(--ao-font-fixed-xl);             /* 22 — Desktop */
  line-height: var(--ao-leading-md);              /* 24 */
  color: var(--ao-text-primary);
  text-align: center;
}

/* ── Card ─────────────────────────────────────────────── */
.cc-login__card {
  display: flex;
  flex-direction: column;
  gap: var(--ao-spacing-6);                       /* 24 */
  width: 100%;
  max-width: var(--ao-size-10);                   /* 640 */
  padding: var(--ao-spacing-8);                   /* 40 — Desktop */
  background-color: var(--cc-ui-secondary-bg);
  border-radius: var(--ao-radius-lg);             /* 16 */
  box-shadow: var(--ao-shadow-sm);                /* Figma shadow-1 ~ shadow-sm */
}

/* ── Scoped surface-input override ────────────────────── */
.cc-login .input__wrap {
  background-color: var(--ao-surface-input);
}
.cc-login .checkbox__input:not(:checked) + .checkbox__indicator {
  background: var(--ao-surface-input);
}

/* ── Remember-me / forgot-password row ────────────────── */
.cc-login__options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ao-spacing-3);                       /* 8 */
  width: 100%;
}

/* Remember Me only renders over HTTPS, so the row can legitimately hold the
 * forgot-password link alone. Keep it right aligned rather than padding the
 * markup with an empty spacer element. */
.cc-login__options > :only-child {
  margin-left: auto;
}

/* ── Login button — full width ────────────────────────── */
.cc-login__submit {
  width: 100%;
}

/* ── Footer ("Not a member? Register now") ────────────── */
.cc-login__footer {
  margin: 0;
  font-family: var(--ao-font-body);
  font-weight: var(--ao-font-regular);
  font-size: var(--ao-font-fixed-xs);             /* 14 */
  line-height: var(--ao-leading-md);
  color: var(--ao-text-primary);
  text-align: center;
}

/* ── Links (Forgot password / Register now) ───────────── */
.cc-login__link {
  font-family: var(--ao-font-title);
  font-weight: var(--ao-font-semibold);
  font-size: var(--ao-font-fixed-xs);             /* 14 */
  color: var(--ao-text-brand);
  text-decoration: none;
}
.cc-login__link:hover {
  text-decoration: underline;
}

/* ── Password visibility toggle ───────────────────────── */
/* GENERAL RULE (Luismi, 2026-08-27): a visibility toggle is standard on Control
 * Centre password fields and stands even where a design is silent on it. The
 * design shows a leading icon only, so this is an addition rather than an
 * override of anything the design specifies.
 * Styled as a trailing affordance inside the input wrap, after .input__control,
 * with eye / eye-off swapped by input type exactly as the legacy page did. */
.cc-login .cc-login__pw-toggle {
  flex-shrink: 0;
  width: var(--ao-icon-size-sm);
  height: var(--ao-icon-size-sm);
  padding: 0;
  border: 0;
  background: none;
  color: var(--ao-icon-contrast);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cc-login .cc-login__pw-toggle:hover {
  color: var(--ao-text-primary);
}
.cc-login .cc-login__pw-toggle:focus-visible {
  outline: 2px solid var(--ao-surface-brand);
  outline-offset: 2px;
  border-radius: var(--ao-radius-sm);
}
.cc-login .cc-login__pw-toggle > svg {
  width: 100%;
  height: 100%;
}

/* Icon swap driven by the input's own type attribute, the same mechanism the
 * legacy page used. login.js only flips the attribute; CSS decides the glyph.
 * Masked field shows `eye` (click to reveal), revealed field shows `eye-off`. */
.cc-login .cc-login__pw-icon--hide {
  display: none;
}
.cc-login .input__control[type="text"] ~ .cc-login__pw-toggle .cc-login__pw-icon--show {
  display: none;
}
.cc-login .input__control[type="text"] ~ .cc-login__pw-toggle .cc-login__pw-icon--hide {
  display: block;
}

/* ── Page level notices ───────────────────────────────── */
/* Stacked above the card, full column width. The Alert component supplies the
 * paint; this only handles placement. */
.cc-login__notices {
  display: flex;
  flex-direction: column;
  gap: var(--ao-spacing-3);                       /* 8 */
  width: 100%;
}

/* ── Mobile (Figma Device=Mobile, 390 wide) ───────────── */
@media (max-width: 767px) {
  .cc-login {
    padding: var(--ao-spacing-6);                 /* 24 */
  }
  .cc-login__column {
    gap: var(--ao-spacing-6);                     /* 24 */
  }
  .cc-login__head {
    gap: var(--ao-spacing-3);                     /* 8 */
  }
  .cc-login__title {
    font-size: var(--ao-font-fixed-md);           /* 18 */
    line-height: var(--ao-leading-sm);            /* 20 */
  }
  .cc-login__card {
    padding: var(--ao-spacing-6);                 /* 24 */
  }
}
