/* ── Social Login Buttons ── */

.social-login-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm, 8px);
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border-color, #ddd);
  border-radius: var(--radius-md, 6px);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s;
}

.btn-social:hover {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* ── Last-used provider memory nudge ────────────────────────────
   Marks the OAuth provider the visitor used last time so they
   don't second-guess which one they had before. Badge floats at
   the top-right edge of the button row; the button itself picks
   up a subtle primary-tinted ring so the eye lands there first. */
.btn-social {
  position: relative;
}
.btn-social--last-used {
  box-shadow: 0 0 0 1px var(--color-primary, #2563eb);
}
.btn-social__last-used {
  position: absolute;
  top: -8px;
  right: 10px;
  background: var(--color-primary, #2563eb);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  pointer-events: none;
  line-height: 1;
  height: 16px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

/* While the OAuth full-page navigation is in flight, dim the button +
   show a spinner. The label is also swapped to "Connecting…" by JS. */
.btn-social.is-loading {
  opacity: 0.75;
  pointer-events: none;
  cursor: wait;
}

.btn-social.is-loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  margin-left: auto;
  animation: kpdd-auth-spin 0.8s linear infinite;
}

@keyframes kpdd-auth-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .btn-social.is-loading::after {
    animation: none;
    opacity: 0.6;
  }
}

.btn-google {
  background: #fff;
  color: #333;
  border-color: #dadce0;
}
.btn-google:hover {
  background: #f8f9fa;
}

.btn-facebook {
  background: #1877F2;
  color: #fff;
  border-color: #1877F2;
}
.btn-facebook:hover {
  background: #166fe5;
}

.btn-apple {
  background: #000;
  color: #fff;
  border-color: #000;
}
.btn-apple:hover {
  background: #1a1a1a;
}

/* ── Auth Divider ── */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: var(--space-lg, 24px) 0;
  color: var(--text-muted, #888);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color, #ddd);
}

/* ── Forgot Password Link ── */

.forgot-link {
  color: var(--text-muted, #888);
  font-size: 14px;
}
.forgot-link:hover {
  color: var(--color-primary, #012169);
}

/* ── Connected Accounts (Account Settings) ── */

.connected-accounts {
  margin-top: var(--space-xl, 32px);
}

.connected-accounts h2 {
  font-size: var(--font-size-xl, 20px);
  margin-bottom: var(--space-md, 16px);
}

.provider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color, #eee);
}

.provider-row:last-child {
  border-bottom: none;
}

.provider-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.provider-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.provider-icon.google { background: #f1f3f4; }
.provider-icon.facebook { background: #e7f0fd; }
.provider-icon.apple { background: #f0f0f0; }

.provider-name {
  font-weight: 500;
}

.provider-email {
  font-size: 13px;
  color: var(--text-muted, #888);
}

/* ── Alert Success ── */

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  padding: var(--space-sm, 8px) var(--space-md, 16px);
  border-radius: var(--radius-md, 6px);
  margin-bottom: var(--space-md, 16px);
}

/* ── Auth Modal ──
   Sizing / scroll-lock / safe-area / esc-to-close / backdrop click
   are owned by <kpdd-overlay-host class="auth-modal-overlay">. This
   file just dresses the host (translucent backdrop, higher z-index)
   and styles the dialog card that sits inside as a slotted child. */

kpdd-overlay-host.auth-modal-overlay {
  /* Translucent backdrop instead of the host's default solid white —
   * `--kpdd-overlay-bg` is read by the host's shadow `:host` rule. */
  --kpdd-overlay-bg: rgba(0, 0, 0, 0.5);
  --kpdd-overlay-z: 9999;
}

.auth-modal {
  position: relative;
  background: var(--color-bg, #fff);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 420px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: var(--space-xl, 32px);
  /* Center within the host's flex column. `margin: auto` plus the
     host's `flex-direction: column` puts the card in the middle of
     the open viewport — no separate justify-content needed. */
  margin: auto;
  animation: auth-slide-up 0.2s ease;
}

@keyframes auth-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-modal-close {
  position: absolute;
  top: var(--space-sm, 8px);
  right: var(--space-sm, 8px);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  font-size: 1.5rem;
  color: var(--color-muted, #888);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s;
}

.auth-modal-close:hover {
  background: var(--color-bg-alt, #f5f5f5);
  color: var(--color-body, #333);
}

.auth-modal-body h2 {
  font-size: var(--font-size-xl, 20px);
  color: var(--color-heading, #1a1a2e);
}

/* Body-content classes — previously emitted as inline styles inside
   _renderLogin / _renderRegister. Class-based so style-recalc on
   the modal body affects all instances in a single pass rather than
   N inline writes. */
.auth-modal-heading { margin-bottom: var(--space-md, 16px); }
.auth-modal-subhead { margin-bottom: var(--space-lg, 24px); }
.auth-modal-submit { width: 100%; }
.auth-modal-switch-row { margin-top: var(--space-md, 16px); }
.auth-social-icon { flex-shrink: 0; }

.auth-modal-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: var(--space-xs, 4px) var(--space-sm, 8px);
  border-radius: var(--radius-sm, 4px);
  font-size: var(--font-size-sm, 14px);
  margin-bottom: var(--space-sm, 8px);
}

.auth-modal-switch {
  color: var(--color-primary, #012169);
  font-weight: 500;
  text-decoration: none;
}

.auth-modal-switch:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .auth-modal {
    padding: var(--space-lg, 24px) var(--space-md, 16px);
    max-width: 100%;
    border-radius: var(--radius-lg, 12px) var(--radius-lg, 12px) 0 0;
    max-height: 95dvh;
    /* Bottom-sheet treatment on phones — push the card to the
       bottom edge by replacing the centering auto-margins. */
    margin: auto 0 0;
  }
}

/* ── My Agent panel (Account Settings) ──
   Sits next to .connected-accounts on /account. Current selection
   renders as a single row with photo + name + office + Remove button;
   search input below picks a different agent and auto-saves on
   selection. */
.my-agent-panel { margin-top: var(--space-xl, 32px); }
.my-agent-current {
  display: flex;
  align-items: center;
  gap: var(--space-md, 16px);
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color, #eee);
}
.my-agent-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-bg-alt, #f3f4f6);
  flex-shrink: 0;
}
.my-agent-photo--placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted, #9ca3af);
  font-size: 22px;
}
.my-agent-current__body { flex: 1; min-width: 0; }
.my-agent-current__name { font-weight: var(--font-weight-semibold, 600); }
.my-agent-empty { padding: 8px 0 16px; }
.my-agent-search { padding-top: var(--space-md, 16px); }
