/* ============================================================
   MailMx — Login (IBM Carbon-inspired)
   Rewritten 2026-07-04. Previous version backed up at
   /home/mailmx/backups/login-20260704/index.css
   Login-only stylesheet (consumed solely by index.php).
   ============================================================ */

:root {
  --blue-60: #0f62fe;
  --blue-70: #0353e9;
  --blue-80: #0043ce;
  --red-60:  #da1e28;
  --green-50:#24a148;

  --bg:        #ffffff;
  --layer-01:  #f4f4f4;
  --field:     #f4f4f4;
  --border-subtle: #e0e0e0;
  --border-strong: #8d8d8d;
  --text-primary:   #161616;
  --text-secondary: #525252;
  --text-placeholder:#a8a8a8;
  --text-on-color:  #ffffff;
  --form-bg: linear-gradient(180deg, #ffffff 0%, #f6f7f9 100%);

  --brand-bg:    #1a1f2f;
  --brand-line:  rgba(255,255,255,0.08);
  --brand-text:  #f4f4f4;
  --brand-muted: #8d8d8d;
}
html[data-theme="dark"] {
  --bg:        #161616;
  --layer-01:  #262626;
  --field:     #393939;
  --border-subtle: #393939;
  --border-strong: #6f6f6f;
  --text-primary:   #f4f4f4;
  --text-secondary: #c6c6c6;
  --text-placeholder:#6f6f6f;
  --form-bg: linear-gradient(180deg, #1c2030 0%, #161616 62%);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Elements dropped from the redesign ── */
.brand-scenery,
.brand-description,
.feature-grid,
.brand-footer,
.mobile-decor-grid { display: none !important; }

/* ── Brand panel (left) ── */
.brand-panel {
  position: relative;
  background: var(--brand-bg);
  color: var(--brand-text);
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}
/* Carbon 2× grid motif (reuses the existing .grid-overlay element) */
.grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--brand-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--brand-line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(circle at 30% 40%, #000 0%, transparent 75%);
  mask-image: radial-gradient(circle at 30% 40%, #000 0%, transparent 75%);
  pointer-events: none;
}

.brand-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-bars {
  display: grid;
  grid-template-rows: repeat(4, 3px);
  gap: 3px;
  width: 34px;
  flex-shrink: 0;
}
.brand-bars span { display: block; height: 3px; background: var(--blue-60); }
.brand-bars span:nth-child(1) { width: 100%; }
.brand-bars span:nth-child(2) { width: 72%; }
.brand-bars span:nth-child(3) { width: 100%; }
.brand-bars span:nth-child(4) { width: 48%; }
.logo-text { font-size: 20px; font-weight: 600; letter-spacing: .01em; color: var(--brand-text); }
.logo-text span { color: var(--brand-muted); font-weight: 400; }

.brand-content {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 480px;
}
.brand-tagline {
  font-size: 44px;
  line-height: 1.12;
  font-weight: 300;
  letter-spacing: -0.02em;
  margin: 0;
}
.brand-tagline strong { font-weight: 600; }

/* ── Form panel (right) ── */
.login-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px clamp(28px, 7vw, 96px);
  background: var(--form-bg);
}
/* Mobile-only brand line at the top of the form (brand panel hidden < 860) */
.mobile-login-logo { display: none; font-size: 18px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.mobile-login-logo span { color: var(--text-secondary); font-weight: 400; }
.mobile-tagline { display: none; }

.login-header { max-width: 400px; margin: 0 auto 32px; width: 100%; }
.login-header h1 { font-size: 32px; font-weight: 400; letter-spacing: -0.01em; margin: 0 0 8px; }
.login-header p { font-size: 14px; color: var(--text-secondary); margin: 0; }

#loginForm, .account-picker { max-width: 400px; margin: 0 auto; width: 100%; }

/* ── Fields ── */
.form-group { margin-bottom: 24px; }
.form-label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.form-input-wrapper { position: relative; }
.form-input {
  width: 100%;
  height: 48px;
  background: var(--field);
  border: none;
  border-bottom: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  padding: 0 16px;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color .1s, background .1s;
}
.form-input::placeholder { color: var(--text-placeholder); }
.form-input:focus { outline-color: var(--blue-60); border-bottom-color: transparent; }
.form-input.error { outline-color: var(--red-60); border-bottom-color: transparent; }

.toggle-password {
  position: absolute; right: 4px; top: 0;
  height: 48px; width: 44px;
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary);
  display: grid; place-items: center;
}
.toggle-password:hover { color: var(--text-primary); }
.toggle-password svg { width: 17px; height: 17px; }

.form-error {
  display: none;
  align-items: center; gap: 6px;
  color: var(--red-60); font-size: 12px; margin-top: 6px;
}
.form-error.visible { display: flex; }
.form-error svg { width: 14px; height: 14px; flex-shrink: 0; }

.caps-hint {
  display: none;
  align-items: center; gap: 6px;
  color: #b28600; font-size: 12px; margin-top: 6px;
}
.caps-hint.visible { display: flex; }
.caps-hint svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ── Options / checkbox ── */
.form-options { margin-bottom: 28px; }
.checkbox-wrapper { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.checkbox-wrapper input { width: 18px; height: 18px; accent-color: var(--blue-60); }
.checkbox-label { font-size: 14px; color: var(--text-secondary); }

/* ── Primary button (Carbon) ── */
.btn-primary {
  position: relative;
  width: 100%;
  height: 48px;
  background: var(--blue-60);
  color: var(--text-on-color);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  transition: background .1s;
}
.btn-primary:hover { background: var(--blue-70); }
.btn-primary:active { background: var(--blue-80); }
.btn-primary:disabled { cursor: default; opacity: .92; }
.btn-primary .btn-icon { width: 18px; height: 18px; flex-shrink: 0; }
.btn-primary .spinner, .btn-primary .btn-check, .btn-primary .btn-x { display: none; width: 18px; height: 18px; flex-shrink: 0; }
.btn-primary.loading .btn-icon { display: none; }
.btn-primary.loading .spinner {
  display: inline-block;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnspin .6s linear infinite;
}
.btn-primary.success { background: var(--green-50); }
.btn-primary.success .btn-icon, .btn-primary.success .spinner { display: none; }
.btn-primary.success .btn-check { display: inline-block; }
.btn-primary.error { background: var(--red-60); }
.btn-primary.error .btn-icon, .btn-primary.error .spinner { display: none; }
.btn-primary.error .btn-x { display: inline-block; }
@keyframes btnspin { to { transform: rotate(360deg); } }

/* ── Notifications / banners ── */
.error-banner {
  display: none;
  align-items: flex-start; gap: 10px;
  border-left: 3px solid var(--red-60);
  background: var(--layer-01);
  padding: 12px 14px; font-size: 13px; line-height: 1.4;
  margin: 0 auto 24px; max-width: 400px; width: 100%;
  color: var(--text-primary);
}
.error-banner.visible { display: flex; }
.error-banner svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; stroke: var(--red-60); fill: none; }

.logout-banner, .session-banner {
  display: flex; align-items: flex-start; gap: 10px;
  border-left: 3px solid var(--blue-60);
  background: var(--layer-01);
  padding: 12px 14px; font-size: 13px; line-height: 1.4;
  margin: 0 auto 24px; max-width: 400px; width: 100%;
  color: var(--text-primary);
}
.logout-banner { border-left-color: var(--green-50); }
.logout-banner svg, .session-banner svg {
  width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px;
  stroke: currentColor; fill: none; stroke-width: 2;
}
.logout-banner svg { stroke: var(--green-50); }
.session-banner svg { stroke: var(--blue-60); }

/* ── Security note ── */
.security-note {
  display: flex; align-items: flex-start; gap: 8px;
  max-width: 400px; margin: 36px auto 0; width: 100%;
  padding-top: 20px; border-top: 1px solid var(--border-subtle);
  font-size: 12px; color: var(--text-secondary); line-height: 1.5;
}
.security-note svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; stroke: var(--text-secondary); fill: none; stroke-width: 2; }

.back-to-picker { max-width: 400px; margin: 20px auto 0; width: 100%; }
.back-to-picker a { color: var(--blue-60); text-decoration: none; font-size: 14px; }
.back-to-picker a:hover { text-decoration: underline; }

/* ── Account picker ── */
.account-picker-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--layer-01);
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  text-decoration: none;
  color: var(--text-primary);
  transition: background .1s;
}
.account-picker-item:last-of-type { border-bottom: 1px solid var(--border-subtle); }
.account-picker-item:hover { background: color-mix(in srgb, var(--blue-60) 8%, var(--layer-01)); }
.account-picker-avatar {
  width: 40px; height: 40px; flex-shrink: 0;
  background: var(--blue-60); color: #fff;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 600;
}
.account-picker-info { flex: 1; min-width: 0; }
.account-picker-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-picker-email { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-picker-item svg { width: 16px; height: 16px; flex-shrink: 0; stroke: var(--text-secondary); fill: none; }
.account-picker-add {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px; padding: 12px 16px;
  color: var(--blue-60); text-decoration: none; font-size: 14px;
  border: 1px solid transparent;
}
.account-picker-add:hover { background: var(--layer-01); }
.account-picker-add svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }

/* ── Theme toggle ── */
.theme-btn {
  position: absolute; top: 24px; right: 24px;
  width: 40px; height: 40px;
  border: 1px solid var(--border-subtle); background: none;
  color: var(--text-secondary); cursor: pointer;
  display: grid; place-items: center;
  z-index: 5;
}
.theme-btn:hover { background: var(--layer-01); }
.theme-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="light"] .icon-moon { display: none; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text-primary); color: var(--bg);
  padding: 12px 18px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-left: 3px solid var(--red-60); }

/* ── Responsive ── */
@media (max-width: 860px) {
  body { grid-template-columns: 1fr; }
  .brand-panel { display: none; }
  .login-panel { padding: 40px 24px 40px; justify-content: flex-start; padding-top: 64px; }
  .mobile-login-logo { display: block; max-width: 400px; margin-left: auto; margin-right: auto; width: 100%; }
}
