/*
 * Chemact login
 * Bridges the platform UI (clean navy sidebar + white workspace) with the
 * chemactnetwork.com website (ocean-blue hero + Raleway brand identity).
 * Brand panel LEFT (ocean gradient, like the platform sidebar / website hero),
 * clean white form panel RIGHT (like the platform workspace).
 * Tokens mirror chemact-landing/src/styles/global.css.
 */
:root {
  --color-navy: #0F2A4F;
  --color-navy-dark: #0A1F3D;
  --color-navy-light: #1B3D6E;

  --color-brand: #5A8FCC;
  --color-brand-light: #7BA9D9;
  --color-brand-pale: #D4E0F0;
  --color-brand-paler: #E2EDF5;

  --color-ink: #1A1A1A;
  --color-ink-soft: #4A4A4A;
  --color-line: #E5E7EB;

  --color-danger: #c0392b;
  --color-danger-bg: #fdecea;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: 'Raleway', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  color: var(--color-ink);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Shell ---------- */

.login-shell {
  display: grid;
  grid-template-columns: 48% 52%;
  min-height: 100vh;
}

/* ---------- Brand panel (LEFT) ---------- */

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 2.75rem 3.5rem 2.75rem;
  color: #fff;
  overflow: hidden;
  background-color: var(--color-navy-dark);
  background-image:
    linear-gradient(180deg,
      rgba(15, 42, 79, 0.10) 0%,
      rgba(15, 42, 79, 0.45) 50%,
      rgba(10, 31, 61, 0.86) 100%),
    url('/assets/images/ocean-bg.jpg');
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

/* Soft "water surface" sheen near the top, echoing the website hero */
.brand-water {
  position: absolute;
  inset: 0 0 auto 0;
  height: 42%;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 20% 0%, rgba(255, 255, 255, 0.22), transparent 55%),
    radial-gradient(90% 60% at 80% 10%, rgba(255, 255, 255, 0.12), transparent 60%);
  mix-blend-mode: screen;
  opacity: 0.9;
}

.brand-top {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  display: inline-flex;
  width: 88px;
  height: 88px;
  padding: 12px;
  border-radius: 2px;
  background: #fff;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-content {
  position: relative;
  margin-top: auto;
  max-width: 30rem;
}

.brand-headline {
  margin: 0 0 1.1rem;
  font-size: clamp(2rem, 3.4vw, 3rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: #fff;
  text-wrap: balance;
}

.brand-headline .accent { color: var(--color-brand-light); }

.brand-sub {
  margin: 0;
  max-width: 30rem;
  font-size: 1rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.85);
  text-wrap: pretty;
}

.brand-points {
  position: relative;
  list-style: none;
  margin: 2.25rem 0 0;
  padding: 1.75rem 0 0;
  display: grid;
  gap: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.brand-points li {
  position: relative;
  padding-left: 1.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

.brand-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-brand-light);
  box-shadow: 0 0 0 4px rgba(123, 169, 217, 0.25);
}

.brand-back {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  align-self: flex-start;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color 150ms ease;
}

.brand-back:hover { color: #fff; }

.brand-back svg { width: 14px; height: 14px; }

/* ---------- Form panel (RIGHT) ---------- */

.form-panel {
  display: flex;
  flex-direction: column;
  background: #fff;
  padding: 1.5rem 2.5rem 2rem;
}

.form-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 0;
}

.form-inner {
  width: 100%;
  max-width: 23rem;
  margin: 0 auto;
}

.form-title {
  margin: 0 0 0.4rem;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--color-navy);
  letter-spacing: -0.02em;
}

.form-subtitle {
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
  color: var(--color-ink-soft);
}

/* ---------- Alerts ---------- */

.alert {
  display: none;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.8rem 0.95rem;
  margin-bottom: 1.1rem;
  font-size: 0.85rem;
  line-height: 1.45;
  border-radius: 4px;
}

.alert.show {
  display: flex;
  animation: alert-in 220ms ease;
}

@keyframes alert-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 0.05rem;
}

.alert-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.alert-title {
  font-weight: 700;
  font-size: 0.86rem;
}

.alert-detail {
  font-size: 0.82rem;
  color: #6b2e26;
}

.alert-danger {
  color: #8c2a1f;
  background: var(--color-danger-bg);
  border: 1px solid rgba(192, 57, 43, 0.22);
  border-left: 3px solid var(--color-danger);
}

.alert-danger .alert-icon { color: var(--color-danger); }

/* ---------- Form ---------- */

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field { display: flex; flex-direction: column; }

.field label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-ink);
}

.field input {
  width: 100%;
  padding: 0.78rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--color-ink);
  background: #fff;
  border: 1px solid var(--color-line);
  border-radius: 3px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input::placeholder { color: #9aa3af; }

.field input:hover { border-color: #c8ced8; }

.field input:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(90, 143, 204, 0.18);
}

/* ---------- Submit ---------- */

.submit-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.5rem;
  padding: 0.9rem 1.5rem;
  width: 100%;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #fff;
  background: var(--color-navy);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 200ms ease, box-shadow 200ms ease, opacity 150ms ease, transform 80ms ease;
}

.submit-btn:hover:not(:disabled) {
  background: var(--color-brand);
  box-shadow: 0 4px 14px rgba(90, 143, 204, 0.3);
}

.submit-btn:active:not(:disabled) { transform: translateY(1px); }

.submit-btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.submit-btn:disabled {
  cursor: progress;
  opacity: 0.75;
}

.submit-btn .spinner {
  display: none;
  position: absolute;
  left: 1.1rem;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.submit-btn.loading .spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Form aside / footnote ---------- */

.form-aside {
  margin: 1.5rem 0 0;
  font-size: 0.85rem;
  color: var(--color-ink-soft);
}

.form-aside a {
  color: var(--color-brand);
  font-weight: 600;
  text-decoration: none;
  margin-left: 0.25rem;
}

.form-aside a:hover {
  color: var(--color-navy);
  text-decoration: underline;
}

.form-footnote {
  padding-top: 1.5rem;
  font-size: 0.78rem;
  color: var(--color-ink-soft);
  text-align: right;
}

.form-footnote a { color: var(--color-ink-soft); text-decoration: none; }

.form-footnote a:hover { color: var(--color-navy); text-decoration: underline; }

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .login-shell { grid-template-columns: 46% 54%; }
  .brand-panel { padding: 2.25rem 2.5rem; }
  .form-panel  { padding: 1.5rem 2rem 2rem; }
}

@media (max-width: 768px) {
  .login-shell { grid-template-columns: 1fr; }
  .brand-panel { display: none; }
  .form-panel {
    min-height: 100vh;
    padding: 1.5rem 1.5rem 2rem;
  }
}
