/* wallet.css — Wallet connection UI styles
   Uses the same CSS variables as the main site. */

/* --- Connect button (nav) --- */
.wallet-connect-btn {
  display: flex; align-items: center; gap: 0.4rem;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-dim); padding: 0.35rem 0.75rem;
  border-radius: 6px; cursor: pointer; font-size: 0.85rem;
  font-family: var(--font-body); transition: all 0.2s;
  white-space: nowrap;
}
.wallet-connect-btn:hover {
  border-color: var(--text); color: var(--text);
}
.wallet-connect-btn:disabled {
  opacity: 0.5; cursor: wait;
}
.wallet-connect-btn svg { flex-shrink: 0; }

/* --- Profile widget (nav) --- */
.wallet-profile { position: relative; }

.wallet-profile-btn {
  display: flex; align-items: center; gap: 0.4rem;
  background: transparent; border: 1px solid var(--border);
  color: var(--text); padding: 0.35rem 0.75rem;
  border-radius: 6px; cursor: pointer; font-size: 0.85rem;
  font-family: var(--font-mono); transition: all 0.2s;
  white-space: nowrap;
}
.wallet-profile-btn:hover {
  background: var(--surface);
}

.wallet-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text); display: inline-block; flex-shrink: 0;
}

.wallet-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

.wallet-verified { color: var(--text); font-size: 0.75rem; margin-left: 0.15rem; }
.wallet-unverified { color: var(--text-dim); font-size: 0.75rem; margin-left: 0.15rem; }

/* --- Dropdown --- */
.wallet-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  width: 200px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 0; z-index: 1000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.wallet-dropdown.open { display: block; }

.wallet-dropdown-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
}
.wallet-dropdown-addr {
  font-family: var(--font-mono); font-size: 0.85rem; color: var(--text);
}
.wallet-dropdown-wallet {
  font-size: 0.75rem; color: var(--text-dim);
}

.wallet-dropdown-section {
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
}
.wallet-dropdown-label {
  display: block; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 0.4rem;
}

/* Name input */
.wallet-name-row { display: flex; gap: 0.5rem; }
.wallet-name-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 0.35rem 0.5rem;
  font-size: 0.85rem; font-family: var(--font-body);
}
.wallet-name-input:focus { border-color: var(--text-faint); outline: none; }
.wallet-name-save {
  background: var(--text); color: var(--bg); border: none;
  padding: 0.35rem 0.65rem; cursor: pointer;
  font-size: 0.8rem; font-weight: 600;
}
.wallet-name-save:hover { background: var(--text-dim); }

/* Visibility toggle */
.wallet-toggle-row {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.85rem; color: var(--text-dim); cursor: pointer;
}
.wallet-toggle-row input[type="checkbox"] {
  accent-color: var(--text); width: 16px; height: 16px; cursor: pointer;
}

/* Contributions list */
.wallet-contributions { max-height: 180px; overflow-y: auto; }
.wallet-no-contribs {
  color: var(--text-dim); font-size: 0.85rem; text-align: center;
  padding: 0.5rem 0;
}
.wallet-contrib-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.3rem 0; font-size: 0.8rem;
}
.wallet-contrib-name {
  flex: 1; color: var(--text); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.wallet-contrib-score {
  font-family: var(--font-mono); color: var(--text); font-weight: 600;
}
.wallet-contrib-date { color: var(--text-dim); font-size: 0.75rem; white-space: nowrap; }

/* Disconnect */
.wallet-disconnect-btn {
  display: block; width: 100%; padding: 0.65rem 1rem;
  background: transparent; border: none; border-top: 1px solid var(--border);
  color: var(--kill); font-size: 0.85rem; cursor: pointer;
  text-align: center;
}
.wallet-disconnect-btn:hover { background: rgba(204,0,0,0.08); }

/* --- Wallet picker (multi-wallet) --- */
.wallet-picker { position: relative; }
.wallet-picker-menu {
  display: none; position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--surface-2); border: 1px solid var(--border);
  min-width: 140px; z-index: 1000; box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  overflow: hidden;
}
.wallet-picker-menu.open { display: block; }
.wallet-picker-option {
  display: block; width: 100%; padding: 0.5rem 0.75rem;
  background: transparent; border: none; color: var(--text);
  font-size: 0.85rem; cursor: pointer; text-align: left;
  font-family: var(--font-body);
}
.wallet-picker-option:hover { background: var(--surface); color: var(--text); }
.wallet-picker-option + .wallet-picker-option { border-top: 1px solid var(--border); }

/* --- Mobile --- */
@media (max-width: 768px) {
  .wallet-dropdown { right: -1rem; width: 200px; }
  .wallet-auth-panel { right: -1rem; width: 220px; }
  .wallet-name { max-width: 80px; }
  /* Larger touch targets for connect/profile buttons */
  .wallet-connect-btn,
  .wallet-profile-btn {
    padding: 0.55rem 0.9rem;
    min-height: 40px;
  }
  /* Larger checkbox tap area */
  .wallet-toggle-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }
}

/* Old auth panel removed — nav now opens the full modal */

/* ── Credit badge ────────────────────────────────────────────────────── */
.credit-badge {
  display: inline-block; font-family: var(--font-mono); font-size: 0.72rem;
  font-weight: 700; padding: 0.2rem 0.6rem; border: 1px solid var(--border);
  text-decoration: none; color: var(--text-dim); transition: color 0.12s, border-color 0.12s;
  letter-spacing: 0.04em;
}
.credit-badge:hover { color: var(--text); border-color: var(--text); }
.credit-badge-ok { color: var(--text); border-color: var(--text); }
.credit-badge-zero { color: #ff8833; border-color: rgba(255,136,51,0.4); }
.credit-badge-empty { color: var(--text-faint); border-color: var(--border); cursor: default; }
.credit-badge-loading { color: var(--text-faint); border-color: var(--border); cursor: wait; }

/* ── Credits modal ───────────────────────────────────────────────────── */
.credits-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 9000;
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.credits-modal-box {
  background: var(--bg); border: 2px solid var(--border);
  width: 100%; max-width: 460px; font-family: var(--font-body);
}
.cm-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem; border-bottom: 2px solid var(--border);
  font-family: var(--font-display); font-weight: 900; font-size: 1rem;
}
.cm-close {
  background: none; border: none; color: var(--text-faint); font-size: 1rem;
  cursor: pointer; padding: 0; line-height: 1;
}
.cm-close:hover { color: var(--text); }
.cm-body { padding: 1.25rem; }

.cm-rate-row {
  display: flex; align-items: center; gap: 0.75rem; justify-content: center;
  margin-bottom: 1.25rem; padding: 1rem; border: 2px solid var(--border);
}
.cm-rate-num {
  font-family: var(--font-display); font-weight: 900; font-size: 2rem;
  letter-spacing: -0.04em;
}
.cm-rate-label { font-size: 0.72rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.1em; }
.cm-rate-sep { font-size: 1.2rem; color: var(--text-faint); }

.cm-costs {
  margin-bottom: 1.25rem; border: 1px solid var(--border);
}
.cm-cost-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.4rem 0.75rem; font-family: var(--font-mono); font-size: 0.78rem;
  border-bottom: 1px solid var(--border);
}
.cm-cost-row:last-child { border-bottom: none; }
.cm-cost-row span:last-child { color: var(--text-faint); }

.cm-step {
  display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.25rem;
}
.cm-step-num {
  width: 1.6rem; height: 1.6rem; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
  flex-shrink: 0; color: var(--text-faint);
}
.cm-step-body { flex: 1; }
.cm-step-title { font-weight: 700; font-size: 0.85rem; margin-bottom: 0.5rem; }
.cm-step-sub { font-size: 0.75rem; color: var(--text-faint); margin-top: 0.4rem; line-height: 1.5; }

.cm-pay-btn { width: 100%; justify-content: center; }
.cm-input-row { display: flex; gap: 0.5rem; }
.cm-input {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); padding: 0.4rem 0.6rem; font-family: var(--font-mono);
  font-size: 0.78rem; outline: none;
}
.cm-input:focus { border-color: var(--text); }
.cm-verify-btn { white-space: nowrap; }

.cm-status {
  margin-top: 0.5rem; font-family: var(--font-mono); font-size: 0.75rem;
  min-height: 1.1em;
}
.cm-status-loading { color: var(--text-faint); }
.cm-status-ok { color: #3ddc84; }
.cm-status-error { color: #ff4444; }

.cm-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 0.75rem; border-top: 1px solid var(--border);
  font-size: 0.72rem; color: var(--text-faint);
}
.cm-footer-link { color: var(--text-faint); text-decoration: none; }
.cm-footer-link:hover { color: var(--text); }

/* ── Auth Modal — Full-screen overlay ────────────────────────────────── */
/* Triggered by any CTA requiring auth when user isn't signed in.
   Uses theme-clarity layer for frosted glass feel. */

.auth-modal-overlay {
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(0,0,0,0.82);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  animation: tcFadeIn 0.2s ease-out;
}
.auth-modal-card {
  width: 100%; max-width: 420px;
  background: var(--tc-surface, #0e1014);
  border: 1px solid var(--tc-border, rgba(255,255,255,0.06));
  border-radius: var(--tc-radius, 8px);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.03);
  animation: tcSpring 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards;
  overflow: hidden;
}
.auth-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.25rem 1.5rem 0;
}
.auth-modal-logo {
  font-family: var(--font-display); font-weight: 900;
  font-size: 1rem; letter-spacing: -0.02em; color: var(--text);
}
.auth-modal-close {
  background: none; border: none; color: var(--text-faint);
  font-size: 1.2rem; cursor: pointer; padding: 0.25rem;
  line-height: 1; transition: color 0.15s;
}
.auth-modal-close:hover { color: var(--text); }
.auth-modal-body { padding: 1.25rem 1.5rem 1.5rem; }
.auth-modal-headline {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.3rem; line-height: 1.25; margin-bottom: 0.3rem; color: var(--text);
}
.auth-modal-sub {
  font-size: 0.82rem; color: var(--text-dim); margin-bottom: 1.25rem; line-height: 1.5;
}
.auth-modal-email-row { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.auth-modal-email-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 0.6rem 0.75rem;
  font-size: 0.9rem; font-family: var(--font-body);
  border-radius: 4px; outline: none; transition: border-color 0.15s;
}
.auth-modal-email-input:focus { border-color: var(--text-faint); }
.auth-modal-email-input::placeholder { color: var(--text-faint); }
.auth-modal-submit {
  background: var(--text); color: var(--bg); border: none;
  padding: 0.6rem 1rem; cursor: pointer;
  font-size: 0.88rem; font-weight: 600; font-family: var(--font-body);
  border-radius: 4px; white-space: nowrap; transition: opacity 0.15s;
}
.auth-modal-submit:hover { opacity: 0.85; }
.auth-modal-submit:disabled { opacity: 0.5; cursor: wait; }
.auth-modal-otp { display: none; }
.auth-modal-otp.visible { display: block; }
.auth-modal-otp-hint { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.auth-modal-otp-input {
  letter-spacing: 0.3em; text-align: center;
  font-family: var(--font-mono); font-size: 1.1rem;
}
.auth-modal-back {
  background: none; border: none; color: var(--text-faint);
  font-size: 0.78rem; cursor: pointer; padding: 0.3rem 0;
  font-family: var(--font-body); margin-top: 0.25rem;
}
.auth-modal-back:hover { color: var(--text-dim); }
.auth-modal-oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.65rem;
  width: 100%; padding: 0.75rem 1rem; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  cursor: pointer; font-size: 0.9rem; font-weight: 500; font-family: var(--font-body);
  border-radius: 6px; transition: background 0.15s, border-color 0.15s;
  margin-bottom: 0.6rem; letter-spacing: 0.01em;
}
.auth-modal-oauth-btn:last-of-type { margin-bottom: 0; }
.auth-modal-oauth-btn:hover { background: var(--surface-2); border-color: var(--text-faint); }
.auth-modal-oauth-btn:disabled { opacity: 0.6; cursor: wait; }
.am-btn-icon { display: flex; align-items: center; flex-shrink: 0; }
.auth-modal-x-btn:hover { border-color: rgba(255,255,255,0.3); }
.auth-modal-discord-btn:hover { border-color: rgba(88,101,242,0.5); }
.auth-modal-divider {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 1rem 0; color: var(--text-faint); font-size: 0.78rem;
}
.auth-modal-divider::before,
.auth-modal-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-modal-wallet-link {
  display: block; text-align: center; margin-top: 0.75rem; font-size: 0.82rem; color: var(--text-faint);
}
.auth-modal-wallet-link a { color: var(--text-dim); text-decoration: underline; text-underline-offset: 2px; }
.auth-modal-wallet-link a:hover { color: var(--text); }
.auth-modal-footer {
  padding: 0 1.5rem 1.25rem; font-size: 0.75rem; color: var(--text-faint); line-height: 1.5;
}
.auth-modal-status { font-size: 0.78rem; min-height: 1.1rem; margin-top: 0.5rem; color: var(--text-dim); }
.auth-modal-status.error { color: var(--kill); }
.auth-modal-status.success { color: #3ddc84; }

@media (max-width: 480px) {
  .auth-modal-card { max-width: none; border-radius: 0; min-height: 100dvh; }
  .auth-modal-overlay { padding: 0; }
}
