/* ==========================================================================
   SMLK Gmail — lock-screen sign-in page (dark only)
   Loaded only for task=login from templates/includes/layout.html.
   ========================================================================== */

html.smlk-login {
  --l-bg: #07080b;
  --l-surface: #0e1016;
  --l-border: #232834;
  --l-border-hover: #353c4a;
  --l-divider: #141822;
  --l-text: #f2f4f8;
  --l-muted: #9aa1ad;
  --l-dim: #7d8492;
  --l-faint: #727987;      /* #5d6472 lightened: 3.4:1 -> 4.6:1 on #07080b */
  --l-accent: #3f6fe6;
  --l-accent-hover: #5580ef;
  --l-soft-bg: #16264a;
  --l-soft-border: #22386a;
  --l-soft-fg: #8fb0ff;
  --l-error: #f5a5a0;
  --l-error-border: #f07b75;
  --l-ui: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --l-display: "Space Grotesk", Inter, system-ui, sans-serif;

  color-scheme: dark;
  background: var(--l-bg) !important;
  height: auto;
  min-height: 100%;
}

html.smlk-login body {
  background: var(--l-bg) !important;
  color: var(--l-text);
  font-family: var(--l-ui);
  font-size: 14px;
  min-width: 0;
  height: auto;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}
html.smlk-login #layout {
  display: block !important;
  height: auto !important;
  min-height: 100vh;
  overflow: visible;
  background: transparent;
}

/* Elastic login leftovers */
html.smlk-login #logo,
html.smlk-login .smlk-brand,
html.smlk-login #login-footer > .support-link,
html.smlk-login #rcmloginsubmit,
html.smlk-login .layout-content-login-footer { display: none !important; }

.smlk-vh {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------ page */
.smlk-lock {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 40px 64px;
  background: var(--l-bg);
  overflow: hidden;
  isolation: isolate;
}

.smlk-rings { position: absolute; inset: 0; pointer-events: none; z-index: -1; }
.smlk-ring {
  position: absolute;
  top: 50%;
  border-radius: 50%;
  transform: translateY(-50%);
}
.smlk-ring-outer { width: 660px; height: 660px; right: -180px; border: 1px solid var(--l-divider); }
.smlk-ring-inner { width: 420px; height: 420px; right: -60px; border: 1px solid var(--l-soft-bg); }

/* ------------------------------------------------------------ header */
.smlk-lock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.smlk-lock-brand { display: inline-flex; align-items: center; gap: 12px; }
.smlk-lock-logo { display: block; width: 32px; height: 32px; flex: 0 0 auto; }
.smlk-lock-name { font-size: 16px; font-weight: 600; color: var(--l-text); letter-spacing: -.005em; }
.smlk-lock-host { font-size: 12px; color: var(--l-dim); }

/* ------------------------------------------------------------ main */
.smlk-lock-main {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 48px 96px;
  padding: 48px 0;
}

.smlk-clock { flex: 1 1 520px; min-width: 0; user-select: none; }
.smlk-clock-time {
  display: block;
  font-family: var(--l-display);
  font-weight: 300;
  font-size: 168px;
  line-height: .9;
  letter-spacing: -0.05em;
  color: var(--l-text);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
}
.smlk-clock-date {
  display: block;
  margin: 20px 0 0 6px;
  min-height: 1.35em;
  font-size: 22px;
  line-height: 1.35;
  color: var(--l-muted);
  font-family: var(--l-ui);
}
/* space is reserved; content appears once the browser clock has been read */
.smlk-lock:not(.smlk-clock-ready) .smlk-clock-time,
.smlk-lock:not(.smlk-clock-ready) .smlk-clock-date { visibility: hidden; }

/* ------------------------------------------------------------ sign-in */
.smlk-signin {
  flex: 0 1 400px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.smlk-signin-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--l-soft-bg);
  border: 1px solid var(--l-soft-border);
}
.smlk-signin-title {
  margin: 0;
  font-family: var(--l-display);
  font-weight: 500;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--l-text);
}
.smlk-signin-sub { margin: 0 0 12px; font-size: 14px; color: var(--l-muted); }

.smlk-signin-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
}

.smlk-signin-error {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--l-error);
  text-align: left;
  padding: 0 20px;
}
.smlk-signin-error:empty { display: none; }

/* pills */
.smlk-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 20px;
  border: 1px solid var(--l-border);
  border-radius: 28px;
  background: var(--l-surface);
  color: var(--l-dim);
  text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease;
  cursor: text;
}
.smlk-pill-pass { padding-right: 6px; }
.smlk-pill:hover { border-color: var(--l-border-hover); }
.smlk-pill:focus-within {
  border-color: var(--l-accent);
  box-shadow: 0 0 0 4px rgba(63, 111, 230, .2);
  color: var(--l-soft-fg);
}
.smlk-has-error .smlk-pill { border-color: var(--l-error-border); }
.smlk-has-error .smlk-pill:focus-within { box-shadow: 0 0 0 4px rgba(240, 123, 117, .18); }
.smlk-pill-icon { flex: 0 0 18px; width: 18px; height: 18px; color: inherit; }
.smlk-pill-slot { flex: 1 1 auto; min-width: 0; display: flex; }

html.smlk-login .smlk-pill input.smlk-pill-input,
html.smlk-login .smlk-pill input.smlk-pill-input:focus {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 54px;
  padding: 0;
  margin: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  color: var(--l-text) !important;
  font: 400 16px/1.2 var(--l-ui);
  -webkit-appearance: none;
  appearance: none;
}
html.smlk-login .smlk-pill input.smlk-pill-input::placeholder { color: var(--l-dim); opacity: 1; }
/* Chrome autofill: keep the dark pill */
html.smlk-login .smlk-pill input.smlk-pill-input:-webkit-autofill,
html.smlk-login .smlk-pill input.smlk-pill-input:-webkit-autofill:hover,
html.smlk-login .smlk-pill input.smlk-pill-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--l-text);
  -webkit-box-shadow: 0 0 0 40px var(--l-surface) inset;
  caret-color: var(--l-text);
  transition: background-color 9999s ease 0s;
}

/* submit button inside the password pill */
.smlk-go {
  position: relative;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: var(--l-accent);
  color: #fff;
  cursor: pointer;
  transition: background-color .15s ease;
}
.smlk-go:hover { background: var(--l-accent-hover); }
.smlk-go:focus-visible { outline: 2px solid var(--l-soft-fg); outline-offset: 2px; }
.smlk-go:disabled { cursor: progress; background: var(--l-accent); }
.smlk-go-arrow { display: block; }
.smlk-go-spin {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: smlk-login-spin .7s linear infinite;
}
.smlk-submitting .smlk-go-arrow { display: none; }
.smlk-submitting .smlk-go-spin { display: block; }
@keyframes smlk-login-spin { to { transform: rotate(360deg); } }

/* Roundcube's own form part: hidden fields + plugin rows (e.g. "remember me") */
.smlk-signin-native { width: 100%; }
.smlk-signin-native table,
.smlk-signin-native tbody { display: block; width: 100%; margin: 0; border: 0; }
.smlk-signin-native tr { display: flex !important; flex-wrap: wrap; align-items: center; margin: 0 !important; padding: 0 20px; }
.smlk-signin-native tr > td { display: block; padding: 0 !important; border: 0 !important; background: transparent !important; color: var(--l-muted); text-align: left; }
.smlk-signin-native tr > td.title { display: none; }
.smlk-signin-native tr > td.input { flex: 1 1 auto; }
.smlk-signin-native .input-group-prepend { display: none !important; }
.smlk-signin-native input[type="text"],
.smlk-signin-native input[type="password"],
.smlk-signin-native select {
  width: 100%;
  height: 48px;
  padding: 0 18px;
  border: 1px solid var(--l-border) !important;
  border-radius: 24px !important;
  background: var(--l-surface) !important;
  color: var(--l-text) !important;
  font: 400 15px var(--l-ui);
}
.smlk-signin-native tr + tr { margin-top: 10px !important; }
.smlk-signin-native .ifpl-hint { font-size: 12px; color: var(--l-dim); padding-top: 6px !important; }

/* persistent_login "remember me" switch */
.smlk-signin-native .smlk-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  color: var(--l-muted);
  font-size: 13px;
  cursor: pointer;
}
.smlk-signin-native .smlk-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.smlk-signin-native .smlk-switch-track {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 10px;
  background: var(--l-border);
  transition: background-color .15s ease;
  flex: 0 0 auto;
}
.smlk-signin-native .smlk-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--l-muted);
  transition: transform .15s ease, background-color .15s ease;
}
.smlk-signin-native .smlk-switch input:checked + .smlk-switch-track { background: var(--l-accent); }
.smlk-signin-native .smlk-switch input:checked + .smlk-switch-track .smlk-switch-knob { transform: translateX(14px); background: #fff; }
.smlk-signin-native .smlk-switch input:focus-visible + .smlk-switch-track { outline: 2px solid var(--l-soft-fg); outline-offset: 2px; }

.smlk-signin-hint { margin: 8px 0 0; font-size: 12px; color: var(--l-faint); }

/* ------------------------------------------------------------ footer */
.smlk-lock-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--l-divider);
  font-size: 12px;
  color: var(--l-dim);
}
.smlk-lock-footer-left,
.smlk-lock-footer-right { display: inline-flex; align-items: center; gap: 20px; min-height: 44px; }
.smlk-lock-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--l-dim) !important;
  text-decoration: none !important;
  transition: color .15s ease;
}
.smlk-lock-footer a:hover,
.smlk-lock-footer a:focus-visible { color: #e8eaf0 !important; }
.smlk-lock-footer a:focus-visible { outline: 2px solid var(--l-soft-fg); outline-offset: 2px; border-radius: 4px; }
html.smlk-login .pretty-select,
html.smlk-login .smlk-lock-footer .custom-select { background-color: transparent !important; }

/* notices that are not login errors keep the existing toast style */
html.smlk-login .noscriptwarning { position: fixed; bottom: 16px; left: 16px; right: 16px; color: var(--l-error); text-align: center; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 999px) {
  .smlk-lock-main { justify-content: center; flex-direction: column; flex-wrap: nowrap; gap: 40px; }
  .smlk-clock { flex: 0 0 auto; text-align: center; }
  .smlk-clock-time { font-size: 104px; }
  .smlk-clock-date { font-size: 18px; margin: 14px 0 0; }
  .smlk-signin { flex: 0 0 auto; width: 100%; max-width: 400px; }
  .smlk-ring-outer { width: 396px; height: 396px; right: -108px; }
  .smlk-ring-inner { width: 252px; height: 252px; right: -36px; }
}

@media (max-width: 599px) {
  .smlk-lock { padding: 24px; }
  .smlk-lock-host,
  .smlk-rings { display: none; }
  .smlk-lock-main { padding: 32px 0; gap: 32px; }
  .smlk-clock-time { font-size: 72px; }
  .smlk-clock-date { font-size: 16px; margin-top: 10px; }
  .smlk-signin { max-width: none; }
  .smlk-lock-footer { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  html.smlk-login *,
  html.smlk-login *::before,
  html.smlk-login *::after { transition: none !important; }
  .smlk-go-spin { animation-duration: 2.4s; }
}

/* persistent_login: no "Use with caution on public computers" hint */
html.smlk-login #ifpl-hint,
html.smlk-login .ifpl-hint { display: none !important; }

/* neutralise Elastic's own #login-form box (top:20vh, max-width:320px) */
html.smlk-login #login-form {
  position: static;
  top: auto;
  width: 100%;
  max-width: none;
  margin: 0;
}
html.smlk-login .smlk-go,
html.smlk-login .smlk-go:disabled { background: var(--l-accent) !important; color: #fff !important; opacity: 1 !important; box-shadow: none !important; }
html.smlk-login .smlk-go:hover:not(:disabled) { background: var(--l-accent-hover) !important; }
html.smlk-login .smlk-go::before { display: none !important; content: none !important; }

/* ---------------------------------------------------- language picker */
.smlk-lp { position: relative; display: inline-flex; }
.smlk-lp-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px 0 10px;
  margin-left: -10px;
  border: 1px solid transparent;
  border-radius: 22px;
  background: transparent;
  color: var(--l-dim);
  font: 500 12px/1 var(--l-ui);
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
.smlk-lp-trigger:hover,
.smlk-lp.is-open .smlk-lp-trigger { color: #e8eaf0; background: var(--l-surface); border-color: var(--l-border); }
.smlk-lp-trigger:focus-visible { outline: 2px solid var(--l-soft-fg); outline-offset: 2px; }
.smlk-lp-trigger svg:last-child { transition: transform .15s ease; }
.smlk-lp.is-open .smlk-lp-trigger svg:last-child { transform: rotate(180deg); }
.smlk-lp.is-loading .smlk-lp-trigger { opacity: .6; cursor: progress; }

.smlk-lp-panel {
  position: absolute;
  left: -10px;
  bottom: calc(100% + 10px);
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: 320px;
  max-height: min(440px, calc(100vh - 140px));
  padding: 10px;
  background: var(--l-surface);
  border: 1px solid var(--l-border);
  border-radius: 18px;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(0, 0, 0, .4);
  transform-origin: bottom left;
  animation: smlk-lp-in .14s ease-out;
}
.smlk-lp-panel[hidden] { display: none; }
@keyframes smlk-lp-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }

.smlk-lp-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  height: 44px;
  margin: 0 0 8px;
  padding: 0 14px;
  border: 1px solid var(--l-border);
  border-radius: 22px;
  background: var(--l-bg);
  color: var(--l-dim);
  cursor: text;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.smlk-lp-search:focus-within { border-color: var(--l-accent); box-shadow: 0 0 0 4px rgba(63, 111, 230, .2); color: var(--l-soft-fg); }
html.smlk-login .smlk-lp-search input,
html.smlk-login .smlk-lp-search input:focus {
  flex: 1 1 auto;
  min-width: 0;
  height: 42px;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  color: var(--l-text) !important;
  font: 400 14px var(--l-ui);
  -webkit-appearance: none;
  appearance: none;
}
html.smlk-login .smlk-lp-search input::placeholder { color: var(--l-dim); opacity: 1; }
html.smlk-login .smlk-lp-search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.smlk-lp-list {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0 2px 0 0;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.smlk-lp-list::-webkit-scrollbar { width: 12px; background: transparent !important; }
.smlk-lp-list::-webkit-scrollbar-track { background: transparent !important; margin: 4px 0; }
.smlk-lp-list::-webkit-scrollbar-thumb { background-color: #232833 !important; background-clip: padding-box; border: 3px solid transparent; border-radius: 12px; min-height: 40px; }
.smlk-lp-list:hover::-webkit-scrollbar-thumb { background-color: #2f3542 !important; }
.smlk-lp-list::-webkit-scrollbar-thumb:hover { background-color: #3d4453 !important; border-width: 2px; }
.smlk-lp-list::-webkit-scrollbar-thumb:active { background-color: #4b5f99 !important; border-width: 2px; }
.smlk-lp-list::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
@supports not selector(::-webkit-scrollbar) {
  .smlk-lp-list { scrollbar-width: thin; scrollbar-color: #2f3542 transparent; }
}
.smlk-lp-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 40px;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--l-text);
  font-size: 14px;
  line-height: 18px;
  cursor: pointer;
  text-align: left;
}
.smlk-lp-item[hidden] { display: none; }
.smlk-lp-native { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smlk-lp-en { flex: 1 1 auto; min-width: 0; color: var(--l-dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smlk-lp-check { flex: 0 0 16px; margin-left: auto; align-self: center; color: var(--l-soft-fg); visibility: hidden; display: inline-flex; }
.smlk-lp-item.is-active { background: var(--l-divider); }
.smlk-lp-item.is-current { background: var(--l-soft-bg); color: var(--l-soft-fg); }
.smlk-lp-item.is-current .smlk-lp-en { color: var(--l-soft-fg); opacity: .75; }
.smlk-lp-item.is-current .smlk-lp-check { visibility: visible; }
.smlk-lp-item.is-current.is-active { box-shadow: inset 0 0 0 1px var(--l-soft-border); }
.smlk-lp-sep { height: 1px; margin: 6px 8px; background: var(--l-divider); list-style: none; }
.smlk-lp-sep[hidden] { display: none; }
.smlk-lp-empty { margin: 0; padding: 20px 12px; color: var(--l-dim); font-size: 13px; text-align: center; }
.smlk-lp-empty[hidden] { display: none; }

/* phones: bottom sheet */
@media (max-width: 599px) {
  .smlk-lp { position: static; }
  .smlk-lp-panel {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: 70vh;
    border-radius: 20px;
    transform-origin: bottom center;
  }
  .smlk-lp.is-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 49;
    background: rgba(0, 0, 0, .55);
  }
  .smlk-lp-item { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .smlk-lp-panel { animation: none; }
}
html.smlk-login .smlk-lp-trigger { background: transparent !important; box-shadow: none !important; color: var(--l-dim) !important; }
html.smlk-login .smlk-lp-trigger:hover,
html.smlk-login .smlk-lp.is-open .smlk-lp-trigger { background: var(--l-surface) !important; border-color: var(--l-border) !important; color: #e8eaf0 !important; }
html.smlk-login .smlk-lp-trigger::before { display: none !important; content: none !important; }

/* Elastic's inherited scrollbar-color would disable the ::-webkit-scrollbar design in Chromium */
html.smlk-login { scrollbar-color: auto; scrollbar-width: auto; }
@supports not selector(::-webkit-scrollbar) {
  html.smlk-login { scrollbar-width: thin; scrollbar-color: #2f3542 transparent; }
}
