/*
 * SmartInventory web — custom auth (login + register) stylesheet.
 *
 * Source: docs/reference/new-design/login/design_handoff_smart_inventory_login/
 *         web-app-login.html (May 2026 handoff). The bundle's :root token block
 *         is intentionally NOT duplicated here; design-tokens.css is the single
 *         source of truth (imported below, mirrors the subpage-shared.css
 *         pattern).
 *
 * Namespace: every top-level component class has been prefixed with `.login-*`
 * to avoid silent cascade collisions with the short selectors landing.css
 * declares in the global namespace (`.section`, `.eyebrow`, etc.). See
 * web/CLAUDE.md § "Landing-specific assets" for the warning.
 *
 * The body-class toggle `body.mode-login` / `body.mode-register` stays
 * un-prefixed — it is a state class, not a component, and is referenced from
 * web/public/web/js/index.js.
 *
 * Tracking: GitHub issue #842 (under umbrella #838).
 */

@import url('design-tokens.css');

/* ── SKIP-TO-CONTENT LINK (WCAG 2.4.1 Level A) ──────────
   Hidden off-screen by default; appears at the top-left of the viewport on
   keyboard focus so a Tab user can jump past the left-pane marketing copy
   straight to the form. Mirrors the rule in subpage-shared.css; the login
   page does not load that stylesheet. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--ink, #0A1628);
  color: #fff;
  padding: 10px 18px;
  font-family: var(--font-sans, 'DM Sans', sans-serif);
  font-size: 14px;
  font-weight: 600;
  border-radius: 0 0 8px 0;
  text-decoration: none;
}
.skip-link:focus,
.skip-link:focus-visible {
  left: 0;
  outline: 2px solid var(--blue, #1E5FE6);
  outline-offset: 2px;
}

/*
 * Page-only token. design-tokens.css owns the cross-page brand palette; this
 * is the slightly denser input border the login form needs. Scoped to :root
 * so the standard cascade rules apply.
 */
:root {
    --border-input: rgba(15, 30, 80, 0.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: var(--font-sans, 'DM Sans', sans-serif);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    background: #fff;
}
body a { color: var(--blue); text-decoration: none; }
body a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1.05fr;
}

/* --- LEFT: marketing pane ----------------------------------------------- */
.login-left {
    background: linear-gradient(155deg, var(--blueDark) 0%, var(--blueDeep) 45%, #2a0d4a 100%);
    color: #fff;
    padding: 48px 56px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
}
.login-left::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask-image: radial-gradient(ellipse at 30% 50%, black 30%, transparent 80%);
    mask-image: radial-gradient(ellipse at 30% 50%, black 30%, transparent 80%);
    pointer-events: none;
}
.login-glow-1 {
    position: absolute;
    top: -15%;
    left: -10%;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(30, 95, 230, 0.35) 0%, transparent 60%);
    pointer-events: none;
}
.login-glow-2 {
    position: absolute;
    bottom: -20%;
    right: -10%;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(229, 57, 53, 0.25) 0%, transparent 60%);
    pointer-events: none;
}

.login-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.login-brand,
.login-brand:hover,
.login-brand:focus-visible,
.login-brand * {
    text-decoration: none !important;
}
.login-brand img {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.login-brand > span:not(.login-left-eyebrow) {
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.02em;
}

.login-left-content {
    position: relative;
    z-index: 1;
    max-width: 480px;
}
.login-left-eyebrow {
    /* Lives inside .login-left-content, above the title. Block-level with
       bottom margin so it stacks neatly. */
    display: block;
    font-family: var(--font-mono, 'DM Mono', monospace);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    white-space: nowrap;
    margin-bottom: 20px;
}
.login-left-title {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin-bottom: 20px;
    text-wrap: balance;
}
.login-left-title .login-accent {
    background: linear-gradient(110deg, #93c5fd 20%, #fca5a5 80%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.login-left-lead {
    font-size: 17px;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.65;
    margin-bottom: 32px;
}

.login-features-mini {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.login-feat-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    color: rgba(255, 255, 255, 0.85);
}
.login-feat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.login-feat-body { padding-top: 2px; }
.login-feat-title {
    font-size: 14.5px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 3px;
}
.login-feat-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.5;
}

.login-left-footer {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.45);
    font-family: var(--font-mono, 'DM Mono', monospace);
}
.login-left-footer a { color: rgba(255, 255, 255, 0.65); }
.login-left-footer a:hover { color: #fff; text-decoration: none; }

/* --- RIGHT: form pane --------------------------------------------------- */
.login-right {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    background: #fff;
    position: relative;
}
.login-form-card {
    width: 100%;
    max-width: 420px;
}
.login-form-eyebrow {
    font-family: var(--font-mono, 'DM Mono', monospace);
    font-size: 11px;
    color: var(--blue);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 12px;
}
.login-form-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.025em;
    line-height: 1.1;
    margin-bottom: 8px;
}
.login-form-sub {
    font-size: 15px;
    color: var(--ink2);
    margin-bottom: 32px;
    line-height: 1.55;
}
.login-form-sub a { font-weight: 600; }

/* Tabs --- */
.login-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 28px;
}
.login-tab {
    flex: 1;
    appearance: none;
    border: none;
    background: transparent;
    color: var(--ink2);
    font-size: 13.5px;
    font-weight: 600;
    padding: 10px 12px;
    border-radius: 9px;
    transition: all 0.15s;
}
.login-tab.active {
    background: #fff;
    color: var(--ink);
    box-shadow: 0 1px 3px rgba(11, 30, 90, 0.08);
}

/*
 * Social buttons. Only Google remains after issue #1842 removed Facebook and
 * X/Twitter sign-in, so the grid is a single full-width column at every
 * breakpoint (see web/public/web/js/index.js).
 */
.login-social-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 22px;
}
.login-social-btn {
    appearance: none;
    width: 100%;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--border-input);
    border-radius: 11px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.login-social-btn:hover {
    border-color: rgba(15, 30, 80, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(11, 30, 90, 0.06);
}
.login-social-btn svg { flex-shrink: 0; }

/* Divider --- */
.login-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
    color: var(--ink3);
    font-size: 12px;
    font-family: var(--font-mono, 'DM Mono', monospace);
    letter-spacing: 0.08em;
}
.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Form fields --- */
.login-field { margin-bottom: 16px; }
.login-field-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 7px;
}
.login-field-label a {
    font-size: 12.5px;
    font-weight: 500;
}
.login-input-wrap { position: relative; }
.login-input-wrap input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-input);
    border-radius: 11px;
    background: #fff;
    font-family: inherit;
    font-size: 14.5px;
    color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.login-input-wrap input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(30, 95, 230, 0.12);
}
.login-input-wrap input::placeholder { color: var(--ink3); }
.login-password-wrap input { padding-right: 44px; }
.login-eye-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--ink3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-eye-toggle:hover {
    background: var(--surface);
    color: var(--ink);
}

.login-remember-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}
.login-remember-row input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-input);
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}
.login-remember-row input[type="checkbox"]:checked {
    background: var(--blue);
    border-color: var(--blue);
}
.login-remember-row input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.login-remember-row label {
    font-size: 13.5px;
    color: var(--ink2);
    cursor: pointer;
}

.login-submit-btn {
    appearance: none;
    width: 100%;
    background: linear-gradient(135deg, var(--blue), var(--blueDeep));
    color: #fff;
    border: none;
    border-radius: 11px;
    padding: 14px 0;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.005em;
    box-shadow: 0 8px 24px rgba(30, 95, 230, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.login-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 32px rgba(30, 95, 230, 0.45);
}
.login-submit-btn:disabled,
.login-social-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 12px rgba(30, 95, 230, 0.15);
}
.login-submit-btn .login-spinner,
.login-social-btn .login-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: login-spin 0.7s linear infinite;
    display: none;
}
.login-submit-btn.loading .login-spinner,
.login-social-btn.loading .login-spinner { display: inline-block; }
.login-submit-btn.loading > svg { display: none; }
@keyframes login-spin { to { transform: rotate(360deg); } }

/* Auth status messages --- */
.login-auth-message {
    display: none;
    margin-bottom: 16px;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
    border: 1px solid transparent;
}
.login-auth-message.show { display: block; }
.login-auth-message.error {
    background: #FEF2F2;
    border-color: rgba(229, 57, 53, 0.25);
    color: var(--redDeep);
}
.login-auth-message.success {
    background: #ECFDF5;
    border-color: rgba(16, 185, 129, 0.25);
    color: #047857;
}
.login-auth-message.info {
    background: #EFF6FF;
    border-color: rgba(30, 95, 230, 0.2);
    color: var(--blueDeep);
}

.login-premium-note {
    margin-top: 24px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(30, 95, 230, 0.06), rgba(229, 57, 53, 0.06));
    border: 1px solid rgba(30, 95, 230, 0.18);
    border-radius: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.login-premium-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--blue), var(--red));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
}
.login-premium-text {
    font-size: 13px;
    color: var(--ink2);
    line-height: 1.55;
}
.login-premium-text strong {
    color: var(--ink);
    font-weight: 600;
}

.login-back-link {
    position: absolute;
    top: 28px;
    right: 32px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    color: var(--ink3);
    font-weight: 500;
    text-decoration: none;
}
.login-back-link:hover {
    color: var(--ink);
    text-decoration: none;
}

/*
 * Body-class toggle drives the login/register field visibility. The classes
 * `.login-only` and `.register-only` are intentionally short so the markup
 * stays readable; collisions with shared sheets are guarded by their being
 * pure state classes that only act inside `body.mode-*`.
 */
.register-only { display: none; }
body.mode-register .register-only { display: block; }
body.mode-register .login-only { display: none; }
body.mode-register .login-form-title-login { display: none; }
body.mode-login .login-form-title-register { display: none; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 1000px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-left {
        padding: 32px 28px 40px;
        min-height: auto;
    }
    .login-left-content { max-width: 100%; }
    .login-left-title { font-size: 32px; }
    .login-features-mini { display: none; }
    .login-left-footer { display: none; }
    .login-back-link {
        top: 16px;
        right: 20px;
    }
}
@media (max-width: 480px) {
    .login-right { padding: 32px 22px; }
    .login-form-title { font-size: 26px; }
    .login-left-eyebrow { display: none; }
}


/* ── DARK MODE ─────────────────────────────────────────
   Auto-applies on the web-app login page when the user's OS prefers dark.
   The LEFT marketing pane is already dark in light mode — no overrides
   needed. We only flip the RIGHT form pane (white bg + ink text) plus all
   on-light controls (tabs, social buttons, inputs, premium notice, auth
   messages). */
@media (prefers-color-scheme: dark) {
  body { background: #070a14; color: rgba(255, 255, 255, 0.85); }

  /* Form pane */
  .login-right { background: #070a14; }
  .login-back-link { color: rgba(255, 255, 255, 0.55); }
  .login-back-link:hover { color: #ffffff; }

  /* Form heading */
  .login-form-title { color: #ffffff; }
  .login-form-sub { color: rgba(255, 255, 255, 0.65); }

  /* Tabs */
  .login-tabs {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
  }
  .login-tab { color: rgba(255, 255, 255, 0.6); }
  .login-tab.active {
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }

  /* Social buttons */
  .login-social-btn {
    background: rgba(255, 255, 255, 0.04);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.12);
  }
  .login-social-btn:hover {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  }

  /* Divider */
  .login-divider { color: rgba(255, 255, 255, 0.4); }
  .login-divider::before,
  .login-divider::after { background: rgba(255, 255, 255, 0.08); }

  /* Form fields */
  .login-field-label { color: #ffffff; }
  .login-input-wrap input {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
  }
  .login-input-wrap input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(30, 95, 230, 0.25);
  }
  .login-input-wrap input::placeholder { color: rgba(255, 255, 255, 0.4); }
  .login-eye-toggle { color: rgba(255, 255, 255, 0.5); }
  .login-eye-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
  }

  /* Remember-me row */
  .login-remember-row label { color: rgba(255, 255, 255, 0.75); }
  .login-remember-row input[type="checkbox"] {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.25);
  }
  .login-remember-row input[type="checkbox"]:checked {
    background: var(--blue);
    border-color: var(--blue);
  }

  /* Auth status messages */
  .login-auth-message.error {
    background: rgba(229, 57, 53, 0.15);
    border-color: rgba(229, 57, 53, 0.4);
    color: #fca5a5;
  }
  .login-auth-message.success {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
  }
  .login-auth-message.info {
    background: rgba(30, 95, 230, 0.15);
    border-color: rgba(30, 95, 230, 0.4);
    color: #93c5fd;
  }

  /* Premium note */
  .login-premium-note {
    background: linear-gradient(135deg, rgba(30, 95, 230, 0.12), rgba(229, 57, 53, 0.12));
    border-color: rgba(30, 95, 230, 0.35);
  }
  .login-premium-text { color: rgba(255, 255, 255, 0.78); }
  .login-premium-text strong { color: #ffffff; }
}
