@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --font-base: "Inter", sans-serif;
  --font-title: "Inter", sans-serif;
  --deep-0: #031320;
  --deep-1: #051a2a;
  --deep-2: #0a2235;
  --aqua-0: #0ea5e9;
  --aqua-1: #0b93c4;
  --line-soft: rgba(14,165,233,0.18);
  --line-strong: rgba(14,165,233,0.3);
  --text-main: #eaf4ff;
  --text-soft: #9db5c9;
  --text-dim: #6f8ca2;
  --input-bg: rgba(24, 43, 60, 0.72);

  /* Light mode tokens (default) */
  --auth-panel-bg: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  --auth-card-bg: #ffffff;
  --auth-card-border: #e2e8f0;
  --auth-card-shadow: 0 16px 36px rgba(2, 8, 23, 0.08);
  --auth-title-color: #0f172a;
  --auth-subtitle-color: #64748b;
  --auth-label-color: #334155;
  --auth-input-bg: #ffffff;
  --auth-input-border: #cbd5e1;
  --auth-input-text: #0f172a;
  --auth-input-placeholder: #94a3b8;
  --auth-focus-ring: rgba(14,165,233,0.18);
  --auth-password-btn-bg: rgba(204, 216, 228, 0.95);
  --auth-password-btn-color: #4d687f;
  --auth-password-btn-hover-bg: rgba(192, 207, 223, 0.96);
  --auth-note-color: #7e93a7;
  --auth-link-color: #0ea5e9;
  --auth-link-hover: #0b93c4;
  --auth-control-bg: rgba(224, 234, 244, 0.76);
  --auth-control-border: rgba(136, 158, 182, 0.54);
  --auth-control-color: #4f6c83;
  --auth-control-hover-border: #0ea5e9;
  --auth-control-hover-color: #0b93c4;
}

.theme-dark {
  /* Dark mode tokens */
  --auth-panel-bg: linear-gradient(180deg, #181818 0%, #1e1e1e 100%);
  --auth-card-bg: #171717;
  --auth-card-border: #2a2a2a;
  --auth-card-shadow: 0 22px 38px rgba(0, 0, 0, 0.5);
  --auth-title-color: #f4f4f5;
  --auth-subtitle-color: #9a9a9a;
  --auth-label-color: #d4d4d4;
  --auth-input-bg: #202020;
  --auth-input-border: #333333;
  --auth-input-text: #e2e8f0;
  --auth-input-placeholder: #94a3b8;
  --auth-focus-ring: rgba(39, 184, 225, 0.16);
  --auth-password-btn-bg: rgba(17, 30, 44, 0.75);
  --auth-password-btn-color: #89a9c0;
  --auth-password-btn-hover-bg: rgba(26, 44, 61, 0.9);
  --auth-note-color: #637f95;
  --auth-link-color: #6c9fbf;
  --auth-link-hover: #b5d8ec;
  --auth-control-bg: rgba(20, 36, 52, 0.7);
  --auth-control-border: rgba(126, 165, 196, 0.26);
  --auth-control-color: #8eb0c8;
  --auth-control-hover-border: #35bce5;
  --auth-control-hover-color: #b9dcf3;
}

* {
  box-sizing: border-box;
}

html,
body {
  font-family: "Inter", sans-serif;
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-base);
  color: var(--auth-title-color);
  background: var(--auth-panel-bg);
}

.theme-dark body {
  color: var(--auth-title-color);
  background: var(--auth-panel-bg);
}

button,
input {
  font: inherit;
}

.login-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(24rem, 1.15fr) minmax(22rem, 1fr);
}

.login-brand-panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #0f172a 0%, #111827 56%, #1e293b 100%);
}

.login-brand-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 255, 255, 0.12) 0, rgba(255, 255, 255, 0.12) 140px, transparent 140px),
    radial-gradient(circle at 62% 72%, rgba(255, 255, 255, 0.08) 0, rgba(255, 255, 255, 0.08) 102px, transparent 102px),
    radial-gradient(circle at 18% 84%, rgba(255, 255, 255, 0.1) 0, rgba(255, 255, 255, 0.1) 120px, transparent 120px);
  opacity: 0.9;
}

.login-brand-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.06) 0,
    rgba(255, 255, 255, 0.06) 1px,
    transparent 1px,
    transparent 18px
  );
  opacity: 0.5;
}

.brand-panel-inner {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 5%;
  display: flex;
  flex-direction: column;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.94);
  padding: 0.22rem;
  object-fit: contain;
}

.brand-header h1 {
  margin: 0;
  font-family: var(--font-title);
  font-size: 1.45rem;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: 0.1px;
}

.brand-header p {
  margin: 0.25rem 0 0;
  color: rgba(234, 244, 255, 0.8);
  font-size: 0.82rem;
}

.brand-copy {
  margin-top: auto;
  max-width: 35rem;
  margin-bottom: 1.85rem;
}

.brand-copy h2 {
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(1.95rem, 1.78rem + 0.82vw, 2.65rem);
  line-height: 1.14;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-copy > p {
  margin: 1.28rem 0 1.3rem;
  font-size: 0.94rem;
  line-height: 1.6;
  color: rgba(234, 244, 255, 0.82);
  max-width: 29rem;
}

.brand-feature-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.68rem;
}

.brand-feature-list li {
  display: flex;
  align-items: center;
  gap: 0.78rem;
}

.feature-chip {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.45rem;
  display: grid;
  place-items: center;
  color: #d9f2ff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.feature-chip .feature-icon {
  width: 1.02rem;
  height: 1.02rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-feature-list strong {
  display: block;
  font-family: var(--font-title);
  font-size: 0.92rem;
  line-height: 1.2;
}

.brand-feature-list li > div > span {
  display: block;
  font-size: 0.8rem;
  color: rgba(234, 244, 255, 0.78);
  margin-top: 0.15rem;
}

.brand-footer {
  margin-top: auto;
  margin-bottom: 0;
  color: rgba(234, 244, 255, 0.62);
  font-size: 0.74rem;
}

.login-auth-panel {
  position: relative;
  min-height: 100vh;
  padding: 5%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 1rem;
  background: var(--auth-panel-bg);
  transition: background 0.24s ease;
}

.panel-controls {
  position: absolute;
  right: 1.8rem;
  top: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.58rem;
}

.theme-toggle {
  width: 2rem;
  height: 2rem;
  border-radius: 0.4rem;
  border: 1px solid var(--auth-control-border);
  background: var(--auth-control-bg);
  color: var(--auth-control-color);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  transition: border-color 0.24s ease, color 0.24s ease, background-color 0.24s ease;
}

.theme-toggle .theme-icon {
  display: none;
}

.theme-toggle .theme-icon-sun {
  display: block;
}

.theme-toggle[data-mode="dark"] .theme-icon-sun {
  display: none;
}

.theme-toggle[data-mode="dark"] .theme-icon-moon {
  display: block;
}

.theme-toggle:hover {
  border-color: var(--auth-control-hover-border);
  color: var(--auth-control-hover-color);
}

.theme-toggle:focus-visible {
  outline: 2px solid rgba(53, 188, 229, 0.38);
  outline-offset: 1px;
}

.locale-switch {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem;
  border-radius: 0.4rem;
  border: 1px solid var(--auth-control-border);
  background: var(--auth-control-bg);
}

.locale-btn {
  border: 0;
  background: transparent;
  color: var(--auth-control-color);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  border-radius: 0.25rem;
  padding: 0.24rem 0.58rem;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.locale-btn.is-active {
  color: #e8f6ff;
  background: linear-gradient(135deg, #0ea8d5, #1096c5);
}

.mobile-brand {
  display: none;
}

.login-card {
  width: min(25.6rem, 100%);
  border-radius: 0.7rem;
  border: 1px solid var(--auth-card-border);
  background: var(--auth-card-bg);
  box-shadow: var(--auth-card-shadow);
  backdrop-filter: blur(8px);
  padding: 5%;
  min-height: 25.2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: background 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
}

.login-card h2 {
  margin: 0;
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--auth-title-color);
  line-height: 1.1;
  transition: color 0.24s ease;
}

.login-subtitle {
  margin: 0.35rem 0 1.08rem;
  color: var(--auth-subtitle-color);
  font-size: 0.9rem;
  transition: color 0.24s ease;
}

.login-form {
  margin: 0;
  width: 100%;
}

.login-form label {
  display: block;
  text-align: left;
  font-size: 0.8rem;
  color: var(--auth-label-color);
  font-weight: 500;
  margin: 0 0 0.38rem;
  transition: color 0.24s ease;
}

.input-wrap {
  position: relative;
  margin-bottom: 0.78rem;
}

.input-wrap input {
  width: 100%;
  height: 2.62rem;
  border-radius: 0.56rem;
  border: 1px solid var(--auth-input-border);
  background: var(--auth-input-bg);
  color: var(--auth-input-text);
  padding: 0 0.74rem;
  font-size: 0.88rem;
  transition: border-color 0.24s ease, box-shadow 0.24s ease, background-color 0.24s ease;
}

.input-wrap input::placeholder {
  color: var(--auth-input-placeholder);
}

.input-wrap input:focus {
  outline: none;
  border-color: #27b8e1;
  box-shadow: 0 0 0 3px var(--auth-focus-ring);
}

.input-wrap.has-password-toggle input {
  padding-right: 2.5rem;
}

.password-toggle {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.7rem;
  height: 1.7rem;
  border: 0;
  border-radius: 0.44rem;
  background: var(--auth-password-btn-bg);
  color: var(--auth-password-btn-color);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--auth-control-hover-color);
  background: var(--auth-password-btn-hover-bg);
}

.password-toggle:focus-visible {
  outline: 2px solid rgba(39, 184, 225, 0.34);
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle.is-visible .icon-eye {
  display: none;
}

.password-toggle.is-visible .icon-eye-off {
  display: inline;
}

.submit-btn {
  width: 100%;
  border: 0;
  border-radius: 0.56rem;
  height: 2.75rem;
  margin-top: 0.3rem;
  background: linear-gradient(90deg, #159dc8, #1ca9d4);
  color: #f4fbff;
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.2s ease;
}

.submit-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.07);
}

.submit-btn:active {
  transform: translateY(0);
}

.form-message {
  min-height: 1.25rem;
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  color: #f2a5b6;
}

.form-message.ok {
  color: #8ce2bd;
}

.auth-note {
  margin: 0.22rem 0 0;
  color: var(--auth-note-color);
  font-size: 0.78rem;
  text-align: center;
  transition: color 0.24s ease;
}

.back-link {
  color: var(--auth-link-color);
  text-decoration: none;
  font-size: 0.8rem;
  margin-top: 0.2rem;
  transition: color 0.24s ease;
}

.back-link:hover {
  color: var(--auth-link-hover);
}

@media (max-width: 1240px) {
  .brand-copy h2 {
    font-size: clamp(1.7rem, 1.46rem + 0.9vw, 2.35rem);
  }
}

@media (max-width: 980px) {
  .login-layout {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    display: none;
  }

  .login-auth-panel {
    min-height: 100svh;
    padding: 5%;
    align-content: center;
    gap: 0.75rem;
    padding-top: max(4rem, 8vh);
    padding-bottom: max(2rem, 5vh);
  }

  .panel-controls {
    right: 0.95rem;
    top: 0.9rem;
  }

  .mobile-brand {
    margin-top: 0;
    display: grid;
    justify-items: center;
    gap: 0.22rem;
  }

  .mobile-brand-logo {
    width: 3rem;
    height: 3rem;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.96);
    padding: 0.26rem;
    object-fit: contain;
  }

  .mobile-brand h1 {
    margin: 0.18rem 0 0;
    font-family: var(--font-title);
    color: #1fd1f5;
    font-size: clamp(1.5rem, 5.4vw, 2rem);
    font-weight: 700;
  }

  .mobile-brand p {
    margin: 0;
    color: #6f92ab;
    font-size: 0.8rem;
  }

  .login-card {
    width: min(22.5rem, 100%);
    margin-top: 0.45rem;
    min-height: auto;
  }

  .login-card h2 {
    font-size: 1.5rem;
  }

  .auth-note {
    margin-top: 0.42rem;
  }
}

@media (max-width: 420px) {
  .login-auth-panel {
    padding: 5%;
  }

  .login-card {
    width: 100%;
    padding: 5%;
  }

  .login-card h2 {
    font-size: 1.72rem;
  }

  .panel-controls {
    right: 0.78rem;
    top: 0.8rem;
  }

  .locale-btn {
    padding: 0.22rem 0.5rem;
  }
}
