/* ═══════════════════════════════════════════════════════════
   AUTH STYLES
   — Non-intrusive login pill
   — Full-screen login modal
   — Voter button in topbar
   — Vote button shake animation
═══════════════════════════════════════════════════════════ */

/* ─── VOTER BUTTON (topbar) ─────────────────────────────── */
.voter-btn {
  cursor: pointer;
  transition: border-color .18s, transform .18s;
  overflow: hidden;
}

.voter-btn--active {
  border-color: var(--gold-glow) !important;
  padding: 2px;
}

.voter-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  /* Google profile images need no-referrer to load cross-origin */
}

.voter-initials {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}

/* ─── NON-INTRUSIVE LOGIN PILL ───────────────────────────── */
#auth-pill {
  position: fixed;
  bottom: calc(var(--bottom-h) + 12px);   /* above mobile nav */
  right: 16px;
  z-index: 200;

  display: flex;
  align-items: center;
  gap: 10px;

  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: 50px;
  padding: 9px 14px 9px 12px;
  box-shadow: 0 4px 20px var(--shadow);

  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-2);

  /* Hidden by default — slides up when .auth-pill--visible is added */
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
}

#auth-pill.auth-pill--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.auth-pill-icon {
  color: var(--muted);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.auth-pill-text {
  white-space: nowrap;
}

.auth-pill-btn {
  padding: 5px 14px;
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: 50px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s;
  -webkit-tap-highlight-color: transparent;
}

.auth-pill-btn:hover { opacity: .85; }

.auth-pill-dismiss {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.auth-pill-dismiss:hover { color: var(--text); }

/* Desktop: bottom-right corner, not above bottom nav */
@media (min-width: 769px) {
  #auth-pill {
    bottom: 20px;
    right: 24px;
  }
}

/* ─── LOGIN MODAL ────────────────────────────────────────── */
#auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .26s ease;
}

.auth-modal-box {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--r);
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .6);

  transform: translateY(20px) scale(.97);
  opacity: 0;
  transition: transform .26s cubic-bezier(.4, 0, .2, 1),
              opacity   .26s ease;
}

/* Animate in */
#auth-modal.auth-modal--open .auth-modal-backdrop { opacity: 1; }
#auth-modal.auth-modal--open .auth-modal-box {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Emphasis state — gold top border when triggered by vote attempt */
.auth-modal-box--emphasis {
  border-top: 3px solid var(--gold);
}

.auth-modal-close {
  position: absolute;
  top: 12px; right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--r-xs);
  transition: color .15s, background .15s;
  line-height: 1;
}

.auth-modal-close:hover {
  color: var(--text);
  background: var(--panel);
}

.auth-modal-logo {
  margin-bottom: 16px;
}

.auth-modal-logo img {
  filter: drop-shadow(0 4px 12px rgba(224, 48, 48, .4));
}

.auth-modal-title {
  font-family: var(--font-display);
  font-size: clamp(20px, 3vw, 24px);
  font-weight: 800;
  font-style: italic;
  margin-bottom: 10px;
  color: var(--text);
}

.auth-modal-sub {
  font-size: clamp(13px, 1vw, 14px);
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.auth-modal-sub strong {
  color: var(--text);
  font-weight: 600;
}

.auth-modal-google-btn {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  min-height: 44px;
}

.auth-modal-error {
  font-size: 12px;
  color: #ef4444;
  min-height: 18px;
  margin-bottom: 8px;
}

.auth-modal-note {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

/* Google button loading state */
.auth-google-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  padding: 10px 0;
}

.auth-google-spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border-md);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Dev setup notice when Client ID is not configured */
.auth-setup-notice {
  padding: 14px 16px;
  background: var(--red-dim);
  border: 1px solid rgba(224, 48, 48, .25);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.6;
  text-align: center;
}

.auth-setup-notice code {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  background: var(--panel);
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
  color: var(--gold);
}

/* Fallback Google button (when renderButton fails) */
.auth-google-fallback-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 24px;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 50px;
  font-family: 'Google Sans', var(--font-ui), sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: box-shadow .15s, background .15s;
  width: 280px;
  justify-content: center;
}

.auth-google-fallback-btn:hover {
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  background: #f8f9fa;
}

/* ─── VOTE BUTTON SHAKE ──────────────────────────────────── */
@keyframes btn-shake {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-6px); }
  30%  { transform: translateX(6px); }
  45%  { transform: translateX(-4px); }
  60%  { transform: translateX(4px); }
  75%  { transform: translateX(-2px); }
  90%  { transform: translateX(2px); }
  100% { transform: translateX(0); }
}

.btn-shake {
  animation: btn-shake .45s cubic-bezier(.36, .07, .19, .97) both;
}

/* ─── LIGHT THEME ────────────────────────────────────────── */
[data-theme="light"] #auth-pill {
  background: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .12);
}

[data-theme="light"] .auth-modal-box {
  box-shadow: 0 16px 48px rgba(0, 0, 0, .15);
}

[data-theme="light"] .auth-modal-backdrop {
  background: rgba(0, 0, 0, .4);
}

/* ─── MOBILE ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .auth-modal-box {
    padding: 28px 20px 22px;
  }

  #auth-pill {
    right: 12px;
    font-size: 12px;
    padding: 8px 12px 8px 10px;
  }
}
