/* auth/auth.css — Login/Register modal + account button. Matches dark/cyan theme. */
:root {
  --ip-accent: #06b6d4;
  --ip-accent-light: #22d3ee;
  --ip-bg: #06080d;
  --ip-card: #0c1017;
  --ip-border: rgba(6, 182, 212, 0.18);
  --ip-text: #f0f4f8;
  --ip-muted: #94a3b8;
}

/* ── Account / Login button in navbar ── */
.ip-auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--ip-border);
  border-radius: 8px;
  background: rgba(6, 182, 212, 0.06);
  color: var(--ip-text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  font-family: inherit;
}
.ip-auth-btn:hover {
  background: rgba(6, 182, 212, 0.14);
  border-color: var(--ip-accent);
  transform: translateY(-1px);
}
.ip-auth-btn i { color: var(--ip-accent); }

.ip-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ip-accent), var(--ip-accent-light));
  color: #04222b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  text-decoration: none;
  border: 1px solid var(--ip-border);
  box-shadow: 0 0 0 2px rgba(6,182,212,0.22);
  transition: transform 0.15s, box-shadow 0.2s;
  flex-shrink: 0;
}
.ip-avatar i { font-size: 0.8rem; }
.ip-avatar-lg { width: 40px; height: 40px; }
.ip-avatar-lg i { font-size: 1rem; }

/* ── Account widget (trigger + dropdown) ── */
.ip-account { position: relative; display: inline-flex; align-items: center; }
.ip-account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(6,182,212,0.08);
  border: 1px solid var(--ip-border);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  color: var(--ip-text, #e6eef2);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.2s, transform 0.15s;
}
.ip-account-trigger:hover { background: rgba(6,182,212,0.16); transform: translateY(-1px); }
.ip-account-label { white-space: nowrap; }
.ip-account-caret { font-size: 0.7rem; opacity: 0.6; transition: transform 0.2s; }
.ip-account.open .ip-account-caret { transform: rotate(180deg); }

.ip-account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 230px;
  background: #0b1220;
  border: 1px solid var(--ip-border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.55);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.16s, transform 0.16s, visibility 0.16s;
  z-index: 1000;
}
.ip-account.open .ip-account-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.ip-account-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 12px; margin-bottom: 6px;
  border-bottom: 1px solid var(--ip-border);
}
.ip-account-id { display: flex; flex-direction: column; min-width: 0; }
.ip-account-id strong { font-size: 0.92rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.ip-account-id span { font-size: 0.74rem; color: var(--ip-muted, #8aa0aa); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.ip-account-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--ip-text, #e6eef2);
  font: inherit; font-size: 0.86rem; font-weight: 500;
  text-decoration: none;
  background: none; border: none; text-align: left; cursor: pointer;
  transition: background 0.12s;
}
.ip-account-item i { color: var(--ip-accent); width: 16px; text-align: center; }
.ip-account-item:hover { background: rgba(6,182,212,0.12); }
.ip-account-signout { color: #ff7a7a; }
.ip-account-signout i { color: #ff7a7a; }
.ip-account-signout:hover { background: rgba(255,90,90,0.12); }

/* ── Mobile: turn the trigger into a full profile chip, show menu inline ── */
@media (max-width: 768px) {
  #ip-auth-holder { width: 100%; margin-left: 0 !important; margin-top: 8px; }
  .ip-account { width: 100%; display: block; }
  .ip-account-trigger {
    width: 100%;
    justify-content: flex-start;
    border-radius: 12px;
    padding: 10px 14px;
  }
  .ip-account-label::after { content: " — tap for menu"; opacity: 0.5; font-weight: 400; font-size: 0.78rem; }
  .ip-account-caret { margin-left: auto; }
  .ip-account-menu {
    position: static;
    width: 100%;
    min-width: 0;
    margin-top: 8px;
    box-shadow: none;
    /* show profile head always on mobile so identity is clear */
  }
}
.ip-avatar:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.25);
}

/* ── Modal ── */
.ip-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 8, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  animation: ip-fade 0.2s ease;
}
.ip-modal-overlay.open { display: flex; }
@keyframes ip-fade { from { opacity: 0; } to { opacity: 1; } }

.ip-modal {
  width: 100%;
  max-width: 400px;
  background: var(--ip-card);
  border: 1px solid var(--ip-border);
  border-radius: 16px;
  padding: 32px 28px;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(6, 182, 212, 0.05);
  animation: ip-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: 'Inter', 'Segoe UI', sans-serif;
}
@keyframes ip-pop { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: none; } }

.ip-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--ip-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
.ip-modal-close:hover { color: var(--ip-text); }

.ip-modal h2 {
  color: var(--ip-text);
  font-size: 1.4rem;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.ip-modal .ip-sub {
  color: var(--ip-muted);
  font-size: 0.88rem;
  margin-bottom: 22px;
}

.ip-field { margin-bottom: 14px; }
.ip-field label {
  display: block;
  color: var(--ip-muted);
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ip-field input {
  width: 100%;
  padding: 11px 13px;
  background: rgba(6, 182, 212, 0.04);
  border: 1px solid var(--ip-border);
  border-radius: 9px;
  color: var(--ip-text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
}
.ip-field input:focus {
  outline: none;
  border-color: var(--ip-accent);
  background: rgba(6, 182, 212, 0.08);
}

.ip-submit {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  background: linear-gradient(135deg, var(--ip-accent), var(--ip-accent-light));
  border: none;
  border-radius: 9px;
  color: #04222b;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  font-family: inherit;
}
.ip-submit:hover { opacity: 0.92; transform: translateY(-1px); }
.ip-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.ip-switch {
  text-align: center;
  margin-top: 18px;
  color: var(--ip-muted);
  font-size: 0.85rem;
}
.ip-switch a { color: var(--ip-accent); cursor: pointer; text-decoration: none; font-weight: 600; }
.ip-switch a:hover { text-decoration: underline; }

.ip-msg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  display: none;
}
.ip-msg.show { display: block; }
.ip-msg.error { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.25); }
.ip-msg.success { background: rgba(34, 197, 94, 0.12); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.25); }

/* ── Toast ── */
.ip-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ip-card);
  border: 1px solid var(--ip-border);
  color: var(--ip-text);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  z-index: 100000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.ip-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ip-toast i { color: var(--ip-accent); margin-right: 8px; }

/* ── Bookmark button (injected on topic pages) ── */
.ip-bookmark-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--ip-border);
  border-radius: 8px;
  background: rgba(6, 182, 212, 0.05);
  color: var(--ip-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.ip-bookmark-btn:hover { color: var(--ip-text); border-color: var(--ip-accent); }
.ip-bookmark-btn.saved { color: var(--ip-accent); border-color: var(--ip-accent); background: rgba(6, 182, 212, 0.12); }

/* ════════════════════════════════════════════
   Welcome / signup nudge popup
   ════════════════════════════════════════════ */
.ip-welcome-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(2, 4, 8, 0.78);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.ip-welcome-overlay.show { opacity: 1; visibility: visible; }
.ip-welcome {
  position: relative;
  width: 100%; max-width: 440px;
  background: linear-gradient(180deg, #0e1622, #0a111a);
  border: 1px solid var(--ip-border);
  border-radius: 20px;
  padding: 0 28px 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.3s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
.ip-welcome-overlay.show .ip-welcome { transform: translateY(0) scale(1); }
.ip-welcome-close {
  position: absolute; top: 12px; right: 14px; z-index: 3;
  background: rgba(255,255,255,0.06); border: none; color: #9fb2bb;
  width: 32px; height: 32px; border-radius: 50%; font-size: 1.3rem; line-height: 1;
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.ip-welcome-close:hover { background: rgba(255,255,255,0.14); color: #fff; }

/* Heatmap teaser strip */
.ip-welcome-teaser {
  position: relative; margin: 0 -28px 22px;
  padding: 26px 28px 22px;
  background: radial-gradient(120% 100% at 50% 0%, rgba(6,182,212,0.16), transparent 70%);
  border-bottom: 1px solid var(--ip-border);
}
.ip-wt-grid {
  display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px;
  max-width: 320px; margin: 0 auto;
}
.ip-wt-cell { aspect-ratio: 1; border-radius: 3px; background: rgba(255,255,255,0.05); }
.ip-wt-cell.l1 { background: rgba(6,182,212,0.3); }
.ip-wt-cell.l2 { background: rgba(6,182,212,0.5); }
.ip-wt-cell.l3 { background: rgba(6,182,212,0.75); }
.ip-wt-cell.l4 { background: var(--ip-accent-light); }
.ip-wt-shine {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.08) 48%, transparent 60%);
  background-size: 220% 100%;
  animation: ip-wt-sweep 3.2s ease-in-out infinite;
}
@keyframes ip-wt-sweep { 0%{background-position:120% 0} 100%{background-position:-120% 0} }

.ip-welcome h2 {
  font-size: 1.42rem; font-weight: 800; color: #fff; text-align: center;
  letter-spacing: -0.02em; margin: 0 0 10px;
}
.ip-welcome p {
  color: #9fb2bb; font-size: 0.92rem; line-height: 1.55; text-align: center;
  margin: 0 0 22px;
}
.ip-welcome p b { color: var(--ip-accent-light); }
.ip-welcome-actions { display: flex; flex-direction: column; gap: 10px; }
.ip-welcome-primary {
  width: 100%; justify-content: center; font-size: 0.96rem; padding: 13px;
}
.ip-welcome-secondary {
  width: 100%; background: none; border: none; color: #8aa0aa;
  font: inherit; font-size: 0.86rem; cursor: pointer; padding: 6px;
  transition: color 0.15s;
}
.ip-welcome-secondary:hover { color: var(--ip-accent-light); text-decoration: underline; }
.ip-welcome-foot {
  text-align: center; color: #5f7480; font-size: 0.74rem; margin-top: 16px;
}
.ip-welcome-foot i { color: var(--ip-accent); margin-right: 5px; }
@media (max-width: 480px) {
  .ip-welcome { max-width: 100%; padding: 0 20px 22px; }
  .ip-welcome-teaser { margin: 0 -20px 18px; padding: 22px 20px 18px; }
  .ip-welcome h2 { font-size: 1.25rem; }
}

/* ── Save-progress prompt icon ── */
.ip-save-card { padding-top: 28px; }
.ip-save-icon {
  width: 60px; height: 60px; margin: 4px auto 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(6,182,212,0.35), rgba(6,182,212,0.08));
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--ip-border);
}
.ip-save-icon i { font-size: 1.5rem; color: var(--ip-accent-light); }

/* ── Locked teaser heatmap (content pages, logged out) ── */
.ip-teaser-hm {
  position: relative;
  max-width: 760px;
  margin: 22px auto 30px;
  padding: 22px;
  border: 1px solid var(--ip-border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(14,22,34,0.9), rgba(10,17,26,0.9));
  overflow: hidden;
}
.ip-teaser-grid {
  display: grid;
  grid-template-columns: repeat(17, 1fr);
  gap: 4px;
  filter: blur(1.5px);
  opacity: 0.5;
}
.ip-teaser-grid .ip-wt-cell { aspect-ratio: 1; border-radius: 3px; background: rgba(255,255,255,0.06); }
.ip-teaser-grid .ip-wt-cell.l1 { background: rgba(6,182,212,0.3); }
.ip-teaser-grid .ip-wt-cell.l2 { background: rgba(6,182,212,0.5); }
.ip-teaser-grid .ip-wt-cell.l3 { background: rgba(6,182,212,0.75); }
.ip-teaser-grid .ip-wt-cell.l4 { background: var(--ip-accent-light); }
.ip-teaser-lock {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 8px; padding: 16px;
  background: radial-gradient(120% 120% at 50% 50%, rgba(8,12,18,0.55), rgba(8,12,18,0.85));
}
.ip-teaser-lock > i { font-size: 1.3rem; color: var(--ip-accent); margin-bottom: 2px; }
.ip-teaser-lock strong { font-size: 1.08rem; color: #fff; font-weight: 800; letter-spacing: -0.01em; }
.ip-teaser-lock span { font-size: 0.85rem; color: #9fb2bb; max-width: 420px; line-height: 1.5; }
.ip-teaser-lock .ip-auth-btn { margin-top: 8px; }
@media (max-width: 560px) {
  .ip-teaser-grid { grid-template-columns: repeat(12, 1fr); }
  .ip-teaser-lock strong { font-size: 0.98rem; }
  .ip-teaser-lock span { font-size: 0.8rem; }
}

/* ── Shared responsive mobile nav (injected by auth-ui.js) ────────── */
.ip-mobile-toggle {
  display: none;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: var(--accent, #06b6d4);
  width: 42px;
  height: 42px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.15rem;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: background 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.ip-mobile-toggle:hover { background: rgba(6, 182, 212, 0.16); border-color: var(--accent, #06b6d4); }

@media (max-width: 860px) {
  /* Make the bar a clean two-item row: logo (left) + hamburger (right) */
  .ip-mnav-bar {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    position: relative;
  }
  .ip-mobile-toggle { display: inline-flex; }

  /* Collapse the links list into a dropdown panel */
  .ip-mnav-links {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    padding: 10px 16px 16px;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    background: #080b12;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
    z-index: 1200;
    list-style: none;
  }
  .ip-mnav-links.ip-mnav-open { display: flex !important; }

  /* Each link / list item becomes a full-width row */
  .ip-mnav-links > li { width: 100%; list-style: none; }
  .ip-mnav-links > li > a,
  .ip-mnav-links > a,
  .ip-mnav-links .nav-link-custom {
    display: block;
    width: 100%;
    text-align: left;
    padding: 13px 14px !important;
    border-radius: 9px;
    font-size: 0.98rem;
  }
  .ip-mnav-links > li > a:hover,
  .ip-mnav-links > a:hover,
  .ip-mnav-links .nav-link-custom:hover {
    background: rgba(6, 182, 212, 0.08);
  }
  /* kill animated underlines inside the dropdown */
  .ip-mnav-links a::after { display: none !important; }

  /* Auth holder (login button / account chip) sits as its own full-width row */
  #ip-auth-holder {
    width: 100%;
    margin: 8px 0 0 0 !important;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    display: flex !important;
    justify-content: center;
  }
  #ip-auth-holder .ip-auth-btn { width: 100%; justify-content: center; }
  #ip-auth-holder .ip-account { width: 100%; }
  #ip-auth-holder .ip-account-trigger { width: 100%; justify-content: center; }
  /* account dropdown opens full width inside the panel */
  #ip-auth-holder .ip-account-menu { position: static; width: 100%; margin-top: 8px; }
}
