/* Страница входа зоотехника — тёмная тема по референсу, светлая — отдельная палитра */

:root {
  --z-login-bg: var(--bg-page, #f5f7fa);
  --z-login-surface: var(--surface, #ffffff);
  --z-login-input-bg: #e8edf2;
  --z-login-text: var(--text, #1e293b);
  --z-login-muted: var(--muted, #64748b);
  --z-login-icon: #4b5563;
  --z-login-btn: var(--primary-color, #2196f3);
  --z-login-btn-hover: var(--primary-dark, #1976d2);
  --z-login-shadow: 0 16px 48px rgba(17, 24, 39, 0.1),
    0 0 0 1px rgba(17, 24, 39, 0.06);
  --z-login-switch-track: #cbd5e1;
  --z-login-switch-thumb: #ffffff;
}

html[data-theme="dark"] {
  --z-login-bg: var(--bg-page, #12181b);
  --z-login-surface: var(--surface, #2c3338);
  --z-login-input-bg: var(--field, #3e444a);
  --z-login-text: var(--text, #f5f5f5);
  --z-login-muted: var(--muted, #a8b0b8);
  --z-login-icon: #ffffff;
  --z-login-btn: var(--primary-color, #2196f3);
  --z-login-btn-hover: var(--primary-light, #42a5f5);
  --z-login-shadow: 0 20px 56px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  --z-login-switch-track: #252b30;
  --z-login-switch-thumb: #ffffff;
}

html[data-theme="organic"] {
  --z-login-bg: var(--bg-page, #f6f6f4);
  --z-login-surface: var(--surface, #ffffff);
  --z-login-input-bg: #eff4f2;
  --z-login-text: var(--text, #1a1e1c);
  --z-login-muted: var(--muted, #4a5a52);
  --z-login-icon: #4a5a52;
  --z-login-btn: var(--primary-color, #48816d);
  --z-login-btn-hover: var(--primary-dark, #3a6b58);
  --z-login-shadow: 0 16px 48px rgba(26, 30, 28, 0.08),
    0 0 0 1px rgba(26, 30, 28, 0.04);
  --z-login-switch-track: #e8e8e2;
  --z-login-switch-thumb: #ffffff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.zootech-login-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--zootech-font, "Inter", system-ui, sans-serif);
  background: var(--z-login-bg);
  color: var(--z-login-text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.z-login-page {
  width: 100%;
  max-width: 420px;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.z-login-page--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.z-login-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--z-login-bg);
}

.z-login-loader {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10001;
  width: min(520px, calc(100vw - 32px));
  height: min(240px, 36vh);
  border-radius: 16px;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
}

.z-login-loader .wesp-logo-loader,
.z-login-loader .wesp-logo-loader--embedded,
.z-login-loader .wesp-logo-loader--plain {
  background: transparent !important;
}

.z-login-loader .wesp-logo-loader__label,
.z-login-loader .wesp-logo-loader__percent {
  color: var(--z-login-muted);
}

.z-login-loader .wesp-logo-loader__bar {
  background: rgba(26, 30, 28, 0.1);
}

html[data-theme="dark"] .z-login-loader .wesp-logo-loader__bar {
  background: rgba(255, 255, 255, 0.12);
}

.z-login-card {
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--z-login-shadow);
  background: var(--z-login-surface);
}

.z-login-form-panel {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.z-login-title {
  font-family: inherit;
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  color: var(--z-login-text);
  margin: 0 0 28px;
  letter-spacing: 0.02em;
}

.z-login-field {
  margin-bottom: 16px;
}

.z-login-field--with-icon {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--z-login-input-bg);
  border-radius: 8px;
  overflow: hidden;
  border: none;
}

.z-login-field-icon {
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--z-login-icon);
}

.z-login-field-icon svg {
  display: block;
}

.z-login-input {
  flex: 1;
  min-width: 0;
  padding: 14px 14px 14px 0;
  font-size: 1rem;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--z-login-text);
  outline: none;
}

.z-login-input::placeholder {
  color: var(--z-login-muted);
  opacity: 1;
}

.z-login-input:focus {
  outline: none;
}

.z-login-input:-webkit-autofill,
.z-login-input:-webkit-autofill:hover,
.z-login-input:-webkit-autofill:focus,
.z-login-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--z-login-input-bg) inset !important;
  box-shadow: 0 0 0 1000px var(--z-login-input-bg) inset !important;
  -webkit-text-fill-color: var(--z-login-text) !important;
  caret-color: var(--z-login-text);
  transition: background-color 600000s ease-in-out 0s;
}

.z-login-input:autofill {
  box-shadow: 0 0 0 1000px var(--z-login-input-bg) inset !important;
  -webkit-text-fill-color: var(--z-login-text) !important;
  caret-color: var(--z-login-text);
}

.z-login-field--with-icon:focus-within {
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 33, 150, 243), 0.45);
}

html[data-theme="dark"] .z-login-field--with-icon:focus-within {
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 33, 150, 243), 0.5);
}

.z-login-submit {
  width: 100%;
  margin-top: 8px;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: var(--gradient-blue, var(--z-login-btn));
  box-shadow: 0 4px 14px rgba(var(--primary-rgb, 33, 150, 243), 0.35);
  transition: background 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.z-login-submit:hover:not(:disabled) {
  background: var(--z-login-btn-hover);
  transform: translateY(-1px);
}

.z-login-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.z-login-remember {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  cursor: pointer;
  user-select: none;
}

.z-login-switch-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.z-login-switch-ui {
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: var(--z-login-switch-track);
  position: relative;
  transition: background 0.2s ease;
}

.z-login-switch-ui::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--z-login-switch-thumb);
  top: 2px;
  left: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.z-login-switch-input:checked + .z-login-switch-ui::after {
  transform: translateX(18px);
}

.z-login-switch-input:focus-visible + .z-login-switch-ui {
  outline: 2px solid var(--z-login-btn);
  outline-offset: 2px;
}

.z-login-switch-input:disabled + .z-login-switch-ui {
  opacity: 0.5;
}

.z-login-remember-text {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--z-login-text);
}

.z-login-msg {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  display: none;
}

.z-login-msg--error {
  background: #dc3545;
  color: #fff;
}

.z-login-spinner {
  display: none;
  width: 22px;
  height: 22px;
  margin: 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: z-login-spin 0.85s linear infinite;
}

@keyframes z-login-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 520px) {
  .z-login-loader {
    height: min(200px, 32vh);
  }
}

@media (max-width: 400px) {
  .z-login-form-panel {
    padding: 28px 22px 32px;
  }

  .z-login-title {
    font-size: 1.5rem;
  }
}
