:root {
  --bg: #0f172a;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-border: rgba(255, 255, 255, 0.35);
  --text: #0f172a;
  --muted: #475569;
  --primary: #183b72;
  --primary-hover: #122e5c;
  --error-bg: #fee2e2;
  --error-text: #b91c1c;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b1220;
  color: var(--text);
}

body {
  min-height: 100vh;
}

.language-switcher {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  display: inline-flex;
  padding: 3px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
}

.language-option {
  min-width: 34px;
  padding: 6px 8px;
  border-radius: 6px;
  color: #64748b;
  text-align: center;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 800;
}

.language-option.active {
  background: #24446f;
  color: white;
}

.login-page {
  min-height: 100vh;
  background-color: #0b1220;
  background-image:
    radial-gradient(circle at 18% 20%, rgba(45, 91, 155, 0.28), transparent 38%),
    linear-gradient(135deg, #08111f 0%, #18223a 52%, #0b1220 100%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-shell {
  width: 100%;
  max-width: 1120px;
  min-height: 680px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px);
}

.login-hero {
  position: relative;
  min-height: 680px;
  display: flex;
  align-items: flex-end;
  padding: 42px;
  background:
    linear-gradient(135deg, rgba(18, 28, 53, 0.38), rgba(15, 23, 42, 0.74)),
    url("/static/images/login-rx-background.jpg") center/cover no-repeat;
}

.login-hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.08) 0%, rgba(15, 23, 42, 0.68) 100%);
}

.login-hero-content {
  position: relative;
  z-index: 1;
  color: white;
  max-width: 440px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
}

.login-hero-content h1 {
  margin: 0 0 12px;
  font-size: 52px;
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.hero-text {
  margin: 0;
  font-size: 18px;
  line-height: 1.6;
  opacity: 0.95;
}

.login-panel {
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 32px;
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
}

.login-header h2 {
  margin: 0 0 8px;
  font-size: 34px;
  line-height: 1.1;
}

.login-header p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.required-hint {
  margin: -16px 0 20px !important;
  color: var(--muted);
  font-size: 13px;
}

.required-marker {
  color: #dc2626;
}

.login-error {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--error-bg);
  color: var(--error-text);
  font-size: 14px;
}

.login-form {
  display: grid;
  gap: 12px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.login-form label {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.login-form input {
  width: 100%;
  height: 52px;
  border: 1px solid #dbe2ea;
  border-radius: 14px;
  padding: 0 14px;
  font-size: 16px;
  background: white;
  color: #0f172a;
  outline: none;
}

.login-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(24, 59, 114, 0.14);
}

.login-form input.has-error {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.field-error {
  margin: 0;
  color: #b91c1c;
  font-size: 12px;
  line-height: 1.35;
}

.password-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.password-wrap input {
  min-width: 0;
}

.toggle-password {
  width: 82px;
  height: 52px;
  padding: 0;
  border: 2px solid #b8c5d6;
  border-radius: 14px;
  background: #f8fbff;
  color: #183b72;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.toggle-password svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: #183b72;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toggle-password:hover {
  border-color: #183b72;
  background: #eaf2ff;
}

.toggle-password:focus-visible {
  outline: none;
  border-color: #183b72;
  box-shadow: 0 0 0 4px rgba(24, 59, 114, 0.18);
}

.password-strength {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 20px;
  padding: 8px 10px;
  border: 1px solid #d5dfec;
  border-radius: 10px;
  background: #f8fbff;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

.strength-bars {
  display: flex;
  gap: 4px;
}

.strength-bars span {
  width: 34px;
  height: 6px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 160ms ease;
}

.password-strength[data-level="1"] .strength-bars span.active { background: #ef4444; }
.password-strength[data-level="2"] .strength-bars span.active { background: #f59e0b; }
.password-strength[data-level="3"] .strength-bars span.active,
.password-strength[data-level="4"] .strength-bars span.active { background: #16a34a; }

.login-button {
  margin-top: 8px;
  height: 54px;
  border: none;
  border-radius: 14px;
  background: var(--primary);
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.login-button:hover {
  background: var(--primary-hover);
}

.agenda-button {
  height: 52px;
  border: 2px solid var(--primary);
  border-radius: 14px;
  background: #f8fbff;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.agenda-button:hover {
  transform: translateY(-1px);
  background: var(--primary);
  color: white;
}

.agenda-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(24, 59, 114, 0.18);
}

/* Tablet */
@media (max-width: 980px) {
  .login-page {
    padding: 16px;
  }

  .login-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .login-hero {
    min-height: 280px;
    padding: 28px;
  }

  .login-hero-content h1 {
    font-size: 38px;
  }

  .hero-text {
    font-size: 16px;
  }

  .login-panel {
    padding: 20px;
  }

  .login-card {
    max-width: 100%;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .login-page {
    padding: 0;
    background-image:
      linear-gradient(rgba(11, 18, 32, 0.5), rgba(11, 18, 32, 0.5)),
      url("/static/images/login-rx-background.jpg");
    background-size: cover, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    background-attachment: scroll, scroll;
  }

  .login-shell {
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .login-hero {
    min-height: 180px;
    padding: 24px 20px 18px;
    align-items: flex-end;
  }

  .login-hero-content {
    max-width: none;
  }

  .login-hero-content h1 {
    font-size: 30px;
  }

  .hero-text {
    font-size: 15px;
    line-height: 1.5;
  }

  .login-panel {
    padding: 0 16px 20px;
    align-items: flex-start;
  }

  .login-card {
    border-radius: 22px;
    padding: 22px 18px;
    max-width: 100%;
  }

  .login-header h2 {
    font-size: 28px;
  }

  .login-header p {
    font-size: 14px;
    margin-bottom: 18px;
  }

  .login-form {
    gap: 10px;
  }

  .login-form label {
    font-size: 13px;
  }

  .login-form input,
  .toggle-password,
  .login-button,
  .agenda-button {
    height: 50px;
    font-size: 16px;
  }

  .password-wrap {
    grid-template-columns: 1fr 82px;
    gap: 8px;
  }
}

.login-card {
  animation: login-card-enter 420ms ease both;
}

.login-button,
.toggle-password {
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.login-button:hover { transform: translateY(-1px); }

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-weight: 600;
}

.field-error::before {
  content: "!";
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  margin-top: 1px;
  border-radius: 50%;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 900;
}

@keyframes login-card-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
