/* ── Auth & Paywall overlay styles ──────────────────────────────── */

/* Backdrops */
#auth-backdrop,
#upgrade-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(3px);
  z-index: 900;
}

/* ── Auth Modal ─────────────────────────────────────────────────── */
#auth-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 901;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 14px;
  padding: 28px 24px 24px;
  width: min(92vw, 360px);
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
}

#auth-modal .auth-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
#auth-modal .auth-logo img { width: 28px; height: 28px; border-radius: 6px; }
#auth-modal .auth-logo span { font-size: 16px; font-weight: 700; color: #e6edf3; }

.auth-tabs {
  display: flex;
  gap: 4px;
  background: #0d1117;
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  padding: 7px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #8b949e;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.auth-tab.active {
  background: #21262d;
  color: #e6edf3;
}

.auth-form { display: flex; flex-direction: column; gap: 12px; }

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.auth-field label {
  font-size: 12px;
  color: #8b949e;
  font-weight: 500;
}
.auth-field input {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e6edf3;
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s;
}
.auth-field input:focus { border-color: #58a6ff; }

.auth-error {
  min-height: 18px;
  font-size: 12px;
  color: #f85149;
  text-align: center;
}

.auth-btn-primary {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #238636;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.auth-btn-primary:hover { background: #2ea043; }
.auth-btn-primary:disabled { opacity: .55; cursor: default; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0;
  color: #484f58;
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #30363d;
}

.auth-btn-google {
  width: 100%;
  padding: 9px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #21262d;
  color: #e6edf3;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, border-color .15s;
}
.auth-btn-google:hover { background: #30363d; border-color: #58a6ff; }
.auth-btn-google svg { flex-shrink: 0; }

.auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #8b949e;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-close:hover { color: #e6edf3; background: #30363d; }

/* ── Topbar user controls ──────────────────────────────────────── */
#auth-open-btn {
  background: #238636;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
#auth-open-btn:hover { background: #2ea043; }

#user-menu-btn {
  position: relative;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e6edf3;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .15s;
}
#user-menu-btn:hover { background: #30363d; }

.user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #238636;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

#user-menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 6px;
  min-width: 180px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-menu-item {
  background: none;
  border: none;
  color: #e6edf3;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .12s;
}
.user-menu-item:hover { background: #21262d; }
.user-menu-item.danger { color: #f85149; }
.user-menu-sep {
  height: 1px;
  background: #30363d;
  margin: 4px 0;
}

/* Paywall hint in frame nav */
#paywall-hint {
  font-size: 10px;
  color: #f0883e;
  text-align: center;
  margin-top: 2px;
  min-height: 14px;
}

/* ── Upgrade Modal ──────────────────────────────────────────────── */
#upgrade-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 901;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 16px;
  padding: 32px 28px 28px;
  width: min(92vw, 340px);
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
}

.upgrade-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

#upgrade-modal h2 {
  font-size: 18px;
  font-weight: 700;
  color: #e6edf3;
  margin: 0 0 8px;
}

#upgrade-modal p {
  font-size: 13px;
  color: #8b949e;
  line-height: 1.5;
  margin: 0 0 20px;
}

.upgrade-price {
  display: inline-block;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 10px 20px;
  margin-bottom: 20px;
  font-size: 22px;
  font-weight: 700;
  color: #e6edf3;
}
.upgrade-price span { font-size: 13px; color: #8b949e; font-weight: 400; }

.upgrade-perks {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.upgrade-perks li {
  font-size: 13px;
  color: #c9d1d9;
  display: flex;
  align-items: center;
  gap: 8px;
}
.upgrade-perks li::before {
  content: '✓';
  color: #3fb950;
  font-weight: 700;
  flex-shrink: 0;
}

#upgrade-cta-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: #238636;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  margin-bottom: 10px;
}
#upgrade-cta-btn:hover { background: #2ea043; }

#upgrade-close-btn {
  background: none;
  border: none;
  color: #8b949e;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
}
#upgrade-close-btn:hover { color: #e6edf3; }

.upgrade-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #8b949e;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.upgrade-modal-close:hover { color: #e6edf3; background: #30363d; }

/* Near-limit indicator */
.paywall-near .fn-label-wrap { border-color: #f0883e !important; }
