/**
 * Phase 6 UI styles — auth modal + project switcher + version history.
 * Mirrors the toolbar/add-template-modal aesthetic.
 */

/* ── Auth modal ──────────────────────────────────────────── */

.pb-auth-modal {
  max-width: 440px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: var(--pb-toolbar-bg);
  color: var(--pb-text);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
  -webkit-backdrop-filter: blur(var(--pb-toolbar-blur));
  backdrop-filter: blur(var(--pb-toolbar-blur));
}

.pb-auth-header {
  min-height: var(--pb-toolbar-height);
  padding: var(--pb-space-4) var(--pb-space-5);
  background: color-mix(in srgb, var(--pb-chip-bg) 70%, transparent);
}

.pb-auth-title-wrap {
  display: flex;
  align-items: center;
  gap: var(--pb-space-3);
}

.pb-auth-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pb-accent) 12%, transparent);
  color: var(--pb-accent);
}

.pb-auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--pb-space-4);
  padding: var(--pb-space-5);
}

.pb-auth-toolbar {
  display: inline-flex;
  align-self: flex-start;
  gap: 0;
  padding: 2px;
  background: color-mix(in srgb, var(--pb-chip-bg) 50%, transparent);
  border: 1px solid var(--pb-border);
  border-radius: 999px;
}

.pb-auth-tab {
  background: transparent;
  border: 0;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--pb-text-muted);
  cursor: pointer;
}

.pb-auth-tab-active {
  background: var(--pb-toolbar-bg);
  color: var(--pb-text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.pb-auth-field {
  display: flex;
  flex-direction: column;
  gap: var(--pb-space-2);
  font-size: 13px;
  color: var(--pb-text-muted);
}

.pb-auth-field input {
  width: 100%;
}

.pb-auth-message {
  font-size: 13px;
  min-height: 18px;
  color: var(--pb-text-muted);
}

.pb-auth-message-error { color: var(--pb-color-danger, #b91c1c); }
.pb-auth-message-success { color: var(--pb-color-success, #047857); }

.pb-auth-actions {
  display: flex;
  gap: var(--pb-space-2);
  justify-content: flex-end;
}

.pb-auth-divider {
  display: flex;
  align-items: center;
  gap: var(--pb-space-3);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pb-text-muted);
}

.pb-auth-divider::before,
.pb-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--pb-border);
}

.pb-auth-admin {
  align-self: stretch;
  font-size: 12px;
}

/* ── Project switcher / Version history modal ──────────── */

.pb-history-modal {
  max-width: 560px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: var(--pb-toolbar-bg);
  color: var(--pb-text);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
  -webkit-backdrop-filter: blur(var(--pb-toolbar-blur));
  backdrop-filter: blur(var(--pb-toolbar-blur));
}

.pb-history-header {
  min-height: var(--pb-toolbar-height);
  padding: var(--pb-space-4) var(--pb-space-5);
  background: color-mix(in srgb, var(--pb-chip-bg) 70%, transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pb-history-body {
  padding: var(--pb-space-3) var(--pb-space-5) var(--pb-space-5);
  max-height: min(70vh, 560px);
  overflow-y: auto;
}

.pb-history-loading,
.pb-history-empty,
.pb-history-error {
  padding: var(--pb-space-5);
  font-size: 13px;
  color: var(--pb-text-muted);
  text-align: center;
}

.pb-history-error { color: var(--pb-color-danger, #b91c1c); }

.pb-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--pb-space-2);
}

.pb-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pb-space-3);
  padding: var(--pb-space-3) var(--pb-space-4);
  border: 1px solid var(--pb-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--pb-chip-bg) 40%, transparent);
}

.pb-history-item-current {
  border-color: var(--pb-accent);
  background: color-mix(in srgb, var(--pb-accent) 8%, var(--pb-toolbar-bg));
}

.pb-history-item-main {
  flex: 1 1 auto;
  min-width: 0;
}

.pb-history-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--pb-text);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.pb-history-item-meta {
  font-size: 12px;
  color: var(--pb-text-muted);
  margin-top: 2px;
}

.pb-history-item-actions {
  display: flex;
  gap: var(--pb-space-2);
}
