/* Auth page — unified with global.css + index.css
   Goals:
   - No “extra” page-wide glass layer on mobile
   - Form card perfectly centered like other pages (no “crooked” offsets)
   - Styles strictly scoped to the auth page to avoid side effects
*/

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header + footer remain from shared styles */
.container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Layout wrapper */
.container > main {
  flex: 1;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 12px 28px;
  margin: 0; /* override any page-wide main margins */
  background: transparent; /* never a page-wide glass layer */
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* The actual “card” */
#authForms {
  width: 100%;
  max-width: 460px;
  padding: 18px 18px 16px;

  background: var(--glass-bg, rgba(255, 255, 255, 0.9));
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.98));
  border-radius: var(--radius-lg, 20px);
  box-shadow: var(--shadow-glass, 0 8px 24px rgba(31, 38, 135, 0.15));

  backdrop-filter: blur(var(--blur, 22px)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--blur, 22px)) saturate(150%);

  box-sizing: border-box;
}

/* Optional subtle lift only on hover devices */
@media (hover: hover) {
  #authForms:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glass-strong, 0 8px 24px rgba(31, 38, 135, 0.25));
  }
}
#authForms:active {
  transform: scale(0.99);
}

/* Headings */
h2 {
  margin: 0 0 14px;
  text-align: center;
  color: #111827;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}

/* Forms stack */
#authForms form {
  margin: 0;
}

#authForms .form-field {
  position: relative;
  margin-bottom: 12px;
}

/* Inputs */
#authForms .form-field input {
  width: 100%;
  min-height: 44px;

  padding: 10px 46px 10px 46px;
  font-size: var(--fs-body-sm, 14px);
  line-height: 1.2;
  color: var(--text-main, #0f172a);

  border: 1px solid rgba(209, 213, 219, 1);
  border-radius: 14px;

  background: rgba(248, 250, 252, 0.9);
  box-sizing: border-box;

  transition: border-color var(--transition-fast, 0.16s ease-out),
    box-shadow var(--transition-fast, 0.16s ease-out),
    background var(--transition-fast, 0.16s ease-out);
}

#authForms .form-field input::placeholder {
  color: rgba(156, 163, 175, 0.95);
}

#authForms .form-field input:focus {
  outline: none;
  border-color: rgba(76, 111, 255, 0.75);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft, rgba(76, 111, 255, 0.12));
}

/* Left icon */
#authForms .form-field > i {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  color: var(--text-muted, #9ca3af);
  font-size: 16px;
  z-index: 2;
  pointer-events: none;
}

/* Eye button — always compact, never full-width */
#authForms .form-field .toggle-password {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);

  background: transparent;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;

  width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  border-radius: 12px;

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 2;
  cursor: pointer;
  box-shadow: none !important;

  transition: transform var(--transition-fast, 0.16s ease-out),
    background var(--transition-fast, 0.16s ease-out);
}

#authForms .form-field .toggle-password i {
  position: static;
  font-size: 16px;
  pointer-events: none;
  color: rgba(75, 85, 99, 0.9);
}

@media (hover: hover) {
  #authForms .form-field .toggle-password:hover {
    background: rgba(15, 23, 42, 0.04);
  }
}
#authForms .form-field .toggle-password:active {
  transform: translateY(-50%) scale(0.96);
}

/* Submit buttons only */
#authForms button[type="submit"],
.modal-content button {
  width: 100%;
  min-height: 44px;

  border-radius: var(--radius-btn, 999px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  background: linear-gradient(
    130deg,
    var(--accent, #4c6fff),
    var(--accent-alt, #2bc5d9)
  );

  color: #fff;
  padding: 10px 12px;

  font-size: var(--fs-ui, 14px);
  font-weight: 700;

  cursor: pointer;
  box-shadow: var(--shadow-glass-strong, 0 8px 24px rgba(31, 38, 135, 0.25));

  transition: transform var(--transition-fast, 0.16s ease-out),
    box-shadow var(--transition-fast, 0.16s ease-out),
    opacity var(--transition-fast, 0.16s ease-out);
}

#authForms button[type="submit"]:active,
.modal-content button:active {
  transform: scale(0.96);
  box-shadow: var(--shadow-glass, 0 8px 24px rgba(31, 38, 135, 0.15));
}

#authForms button[type="submit"]:disabled,
.modal-content button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Text + links */
#authForms p {
  font-size: var(--fs-caption, 13px);
  color: var(--text-soft, #4b5563);
  text-align: center;
  margin: 10px 0 0;
  line-height: 1.5;
}

#authForms a {
  color: var(--accent, #4c6fff);
  text-decoration: none;
  font-weight: 700;
}
@media (hover: hover) {
  #authForms a:hover {
    text-decoration: underline;
  }
}

/* Checkbox row */
#authForms .checkbox-wrapper {
  font-size: var(--fs-caption, 13px);
  color: var(--text-soft, #4b5563);
  margin: 6px 0 12px;
}

/* Use grid to keep checkbox fixed and text naturally wrapping */
#authForms .checkbox-wrapper .checkbox {
  display: grid;
  grid-template-columns: 18px 1fr;
  column-gap: 10px;
  align-items: start;
  line-height: 1.45;
}

#authForms .checkbox-wrapper .checkbox-text {
  display: block;
  overflow-wrap: anywhere;
  hyphens: auto;
}

#authForms .checkbox-wrapper input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--accent, #4c6fff);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5000;
  padding: 14px;
}

.modal-content {
  width: 100%;
  max-width: 420px;

  background: var(--glass-bg, rgba(255, 255, 255, 0.9));
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.98));
  border-radius: var(--radius-lg, 20px);
  box-shadow: var(--shadow-ink-sm, 0 6px 18px rgba(0, 0, 0, 0.08));

  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);

  padding: 18px 18px;
  text-align: center;
}

.hidden {
  display: none !important;
}

/* Мобильная версия */
@media (max-width: 768px) {
  .container > main {
    padding: 12px 12px 18px;
    align-items: center; /* Центрируем форму по вертикали */
    justify-content: center; /* Центрируем форму по горизонтали */
  }
  #authForms {
    padding: 16px 14px 14px;
  }
}

/* Mobile: remove the big “card” underlay (keep only fields) */
@media (max-width: 520px) {
  #authForms {
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
  }
  /* Avoid “scale” tap feedback for a container without a card */
  #authForms:active {
    transform: none;
  }
}

@media (max-width: 420px) {
  .container > main {
    padding: 10px 10px 16px;
  }
  #authForms {
    border-radius: 18px;
  }
  h2 {
    font-size: 16px;
    margin-bottom: 12px;
  }
  #authForms .form-field input {
    padding: 10px 44px 10px 44px;
  }
}

/* Ensure focus visibility (scoped) */
#authForms button[type="submit"]:focus-visible,
#authForms a:focus-visible,
#authForms input:focus-visible,
.modal-content button:focus-visible {
  outline: 2px solid rgba(76, 111, 255, 0.35);
  outline-offset: 2px;
}

/* Tabbar: keep correct highlight on auth, avoid legacy forced highlight of /services */
.mobile-tabbar .tab-link[href="/services"][aria-current="page"],
.mobile-tabbar .tab-link[href="/services"].active {
  color: inherit !important;
}

.mobile-tabbar .tab-link[href^="/auth"],
.mobile-tabbar .tab-link[href="/auth/profile"] {
  color: var(--accent, #4c6fff) !important;
}
