/* Auth bar + auth pages (login, register, history, admin) */

.auth-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  padding: var(--s-2) var(--s-3);
  margin: 0 0 var(--s-3) auto;
  width: fit-content;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-xs);
  font-size: var(--text-sm);
}

.auth-bar a,
.auth-bar .auth-bar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-strong);
  text-decoration: none;
  font-weight: 500;
  background: none;
  border: 0;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-sm);
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}

.auth-bar a:hover,
.auth-bar .auth-bar-link:hover {
  background: var(--accent-weak);
  color: var(--accent-hover);
  text-decoration: none;
}

.auth-bar-user {
  font-weight: 600;
  color: var(--text-strong);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0 var(--s-2);
  border-right: 1px solid var(--border-soft);
  margin-right: var(--s-1);
  font-size: var(--text-sm);
}

.auth-bar-pill {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-hover);
  padding: 2px var(--s-2);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-bar-pill-pending {
  background: var(--warning-soft);
  color: #92400e;
}

.auth-bar-pill-active {
  background: var(--success-soft);
  color: #166534;
}

.auth-bar-pill-disabled {
  background: var(--danger-soft);
  color: var(--danger);
}

.auth-bar-pill-muted {
  background: var(--surface-subtle);
  color: var(--muted-strong);
}

.auth-bar-logout {
  display: inline;
  margin: 0;
}

/* Override the global form grid for auth/admin forms */
form.auth-form,
form.admin-actions {
  display: flex;
  grid-template-columns: none;
  align-items: stretch;
}

form.auth-form {
  flex-direction: column;
  gap: var(--s-4);
  max-width: 440px;
  margin: var(--s-5) 0 0;
}

.auth-form label {
  display: flex !important;
  flex-direction: column;
  gap: var(--s-2);
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--text-strong);
  text-align: left;
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
  width: 100%;
  height: var(--control-h);
  padding: 0 var(--s-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--surface);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-ring);
}

.auth-submit {
  align-self: flex-start;
  height: var(--control-h-lg);
  padding: 0 var(--s-6);
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-base) var(--ease-out);
}

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

.auth-alert {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius-sm);
  border: 1px solid;
  margin: var(--s-4) 0;
  font-size: var(--text-md);
}

.auth-alert-error {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}

.auth-alert-success {
  background: var(--success-soft);
  border-color: var(--success-border);
  color: #166534;
}

.auth-intro {
  color: var(--muted-strong);
  margin-top: var(--s-2);
  margin-bottom: var(--s-4);
}

.auth-alt {
  margin-top: var(--s-5);
  color: var(--muted);
  font-size: var(--text-md);
}

.auth-alt a {
  color: var(--accent);
  font-weight: 500;
}

/* History page */

.history-filter {
  display: flex;
  gap: var(--s-2);
  margin: var(--s-4) 0;
  flex-wrap: wrap;
}

.history-filter-btn {
  padding: var(--s-2) var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted-strong);
  font-size: var(--text-md);
  font-weight: 500;
  text-decoration: none;
  transition: all var(--dur-base) var(--ease-out);
}

.history-filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.history-filter-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.history-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  margin-top: var(--s-4);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-md);
}

.history-table thead th {
  background: var(--surface-subtle);
  text-align: left;
  font-weight: 600;
  color: var(--muted-strong);
  padding: var(--s-3) var(--s-4);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.history-table tbody td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  color: var(--text);
}

.history-table tbody tr:last-child td {
  border-bottom: 0;
}

.history-table tbody tr:hover {
  background: var(--surface-muted);
}

.history-target {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--muted-strong);
}

.history-type {
  display: inline-block;
  padding: 2px var(--s-2);
  border-radius: var(--radius-xs);
  background: var(--surface-subtle);
  color: var(--text-strong);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.history-type-sitemap_audit { background: #ccfbf1; color: #115e59; }
.history-type-mesh_audit { background: #ddd6fe; color: #5b21b6; }
.history-type-tech_audit { background: #fef3c7; color: #92400e; }
.history-type-security_audit { background: #fee2e2; color: #991b1b; }
.history-type-accessibility_audit { background: #dbeafe; color: #1e40af; }
.history-type-images_audit { background: #fce7f3; color: #9d174d; }
.history-type-geo_audit { background: #d1fae5; color: #065f46; }

.history-empty {
  text-align: center;
  color: var(--muted);
  padding: var(--s-7) !important;
}

.history-count {
  margin-top: var(--s-3);
  text-align: right;
  font-size: var(--text-sm);
}

/* Admin actions */

form.admin-actions {
  display: flex;
  flex-direction: row;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin: 0;
  align-items: center;
  grid-template-columns: none;
}

.admin-actions button {
  padding: var(--s-2) var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  color: var(--text-strong);
  transition: all var(--dur-base) var(--ease-out);
}

.admin-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.admin-actions button.danger {
  border-color: var(--danger-border);
  color: var(--danger);
}

.admin-actions button.danger:hover {
  background: var(--danger);
  color: white;
}

/* User recent scans (per-category history block in index.html) */

.user-recent-scans {
  margin-top: var(--s-5);
  padding: var(--s-4);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.user-recent-scans-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}

.user-recent-scans-title {
  font-weight: 600;
  color: var(--text-strong);
  font-size: var(--text-md);
}

.user-recent-scans-type {
  display: inline-block;
  padding: 2px var(--s-2);
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-recent-scans-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}

.user-recent-scans-item {
  margin: 0;
}

.user-recent-scans-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-2) var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-md);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}

.user-recent-scans-link:hover {
  border-color: var(--accent);
  background: var(--accent-weak);
}

.user-recent-scans-target {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-strong);
}

.user-recent-scans-meta {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  flex-shrink: 0;
}

.user-recent-scans-date {
  color: var(--muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.user-recent-scans-cta {
  color: var(--accent);
  font-weight: 600;
  font-size: var(--text-sm);
}

.user-recent-scans-empty {
  padding: var(--s-3);
  color: var(--muted);
  font-size: var(--text-md);
  text-align: center;
  list-style: none;
}

.user-recent-scans-score {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--surface-muted);
  color: var(--text-strong);
}

.user-recent-scans-score--good {
  background: #d1f4e0;
  color: #0f5132;
}

.user-recent-scans-score--warn {
  background: #fff3cd;
  color: #6b5500;
}

.user-recent-scans-score--bad {
  background: #f8d7da;
  color: #842029;
}

.user-recent-scans-more {
  margin: 0;
  list-style: none;
  text-align: center;
}

.user-recent-scans-toggle {
  background: transparent;
  border: 0;
  padding: var(--s-2) var(--s-3);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.user-recent-scans-toggle:hover {
  background: var(--accent-weak);
}
