/* Shared auth styles for neptilo and downstream mirrors. */
:root {
  --auth-accent: #4caf50;
  --auth-accent-hover: #45a049;
  --auth-danger: #f44336;
  --auth-danger-hover: #da190b;
  --auth-surface: #ffffff;
  --auth-surface-muted: #f0f0f0;
  --auth-text: #333333;
  --auth-border: #cfcfcf;
  --auth-overlay: rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root {
    --auth-accent: #6ba31f;
    --auth-accent-hover: #7ab52a;
    --auth-danger: #ff5252;
    --auth-danger-hover: #e53935;
    --auth-surface: #2d2a32;
    --auth-surface-muted: #4a4750;
    --auth-text: #e8e6f0;
    --auth-border: #5a5760;
    --auth-overlay: rgba(0, 0, 0, 0.7);
  }
}

#login-corner {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1000;
}

.login-corner-btn {
  padding: 8px 16px;
  background-color: var(--auth-accent);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.login-corner-btn:hover {
  background-color: var(--auth-accent-hover);
}

.login-corner-greeting {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--auth-surface-muted);
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid var(--auth-border);
}

.login-username {
  font-size: 14px;
  color: var(--auth-text);
}

.login-logout-btn {
  padding: 4px 12px;
  background-color: var(--auth-danger);
  color: #ffffff;
  border: none;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
}

.login-logout-btn:hover {
  background-color: var(--auth-danger-hover);
}

.login-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 24px;
  box-sizing: border-box;
  background-color: var(--auth-overlay);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.login-modal-content {
  background-color: var(--auth-surface);
  color: var(--auth-text);
  font-size: 0.8em;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 520px;
  max-height: min(88vh, 760px);
  overflow-y: auto;
  animation: authSlideIn 0.3s ease;
}

@keyframes authSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-modal-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

.login-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #777777;
}

.login-modal-close:hover {
  color: var(--auth-text);
}

.auth-form-section-title {
  font-weight: bold;
  color: var(--auth-text);
  margin: 0 0 8px 0;
  font-size: 14px;
}

.auth-register-note {
  margin: 0 0 12px 0;
  color: var(--auth-text);
  font-size: 14px;
}

.auth-table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
  margin-bottom: 4px;
}

.auth-table td {
  padding: 6px 8px 6px 0;
  vertical-align: middle;
}

.auth-table td:first-child {
  width: 42%;
}

.auth-table td:last-child {
  width: 58%;
}

.auth-table label {
  color: var(--auth-text);
  font-size: 14px;
}

.auth-table input {
  padding: 6px 8px;
  background-color: var(--auth-surface);
  color: var(--auth-text);
  border: 1px solid var(--auth-border);
  border-radius: 4px;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
}

.auth-table input:focus {
  outline: none;
  border-color: var(--auth-accent);
  box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

.auth-register-link {
  margin: 12px 0 0 0;
  font-size: 13px;
  color: var(--auth-text);
}

.auth-switch-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-weight: bold;
  color: #A74343;
  font-size: 13px;
}

.auth-captcha-note {
  margin: 10px 0 6px 0;
  font-size: 13px;
  color: var(--auth-text);
}

.auth-captcha {
  min-height: 78px;
}

.login-form-actions {
  margin-top: 14px;
}

.login-submit-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  background-color: var(--auth-accent);
  color: #ffffff;
}

.login-submit-btn:hover {
  background-color: var(--auth-accent-hover);
}

.login-error {
  color: var(--auth-danger);
  font-size: 14px;
  margin-bottom: 10px;
  text-align: center;
  min-height: 1.2em;
}

@media (max-width: 780px), (max-height: 620px) {
  .login-modal {
    padding: 0;
    align-items: stretch;
  }

  .login-modal-content {
    max-width: none;
    max-height: none;
    width: 100%;
    height: 100%;
    border-radius: 0;
    padding: 24px;
    font-size: 1em;
    animation: none;
  }

  .auth-table td {
    padding-right: 6px;
  }
}
