/* ═══════════════════════════════════════════════════════════════════════════
   Paragram Halo (v0.4.2) — visual styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Fix Chromium dialog text-color regression (v0.4.2.1) ────────────────── */
/* <dialog> in modal mode establishes its own inheritance context. On some
   browsers (Chromium on Windows in particular), text inside the dialog falls
   back to `CanvasText` (system color, usually black) instead of inheriting
   from <body>. Setting it explicitly on the dialog lets every descendant
   inherit normally, while explicit per-element overrides (.dialog-desc etc.)
   still win on their own. */
dialog {
  color: var(--text);
}

/* ─── Halo badge (inline, next to usernames) ──────────────────────────────── */
.halo-badge,
.halo-inline-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  position: relative;
  line-height: 0;
}
.halo-inline-badge {
  margin-left: 6px;
  width: 14px;
  height: 14px;
}
.halo-badge svg,
.halo-badge img,
.halo-inline-badge svg,
.halo-inline-badge img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0 4px rgba(255, 110, 196, 0.55));
  pointer-events: none;
}
.halo-badge::before,
.halo-inline-badge::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 100, 180, 0.30), transparent 70%);
  animation: halo-pulse 12s ease-in-out infinite;
  z-index: -1;
  pointer-events: none;
}
@keyframes halo-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.20); }
}
.halo-badge-gray svg {
  filter: none;
}
.halo-badge-gray::before {
  display: none;
}

/* Tab marker (small inline halo on the settings tab button) */
.settings-tab-halo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.halo-tab-mark {
  display: inline-block;
  width: 14px;
  height: 14px;
  line-height: 0;
}
.halo-tab-mark svg,
.halo-tab-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0 3px rgba(255, 110, 196, 0.5));
}

/* ─── Rail avatar ring when Halo active ───────────────────────────────────── */
.halo-rail-active {
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.6) inset,
    0 0 0 4px rgba(199, 113, 237, 0.7),
    0 0 12px rgba(255, 110, 196, 0.4);
}

/* ─── Halo settings pane ──────────────────────────────────────────────────── */
.halo-settings-pane {
  max-width: 100%;
}
.halo-hero {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 20px;
  margin-bottom: 16px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 0% 0%, rgba(199, 113, 237, 0.15), transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(96, 165, 250, 0.12), transparent 60%),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.halo-hero-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 12px rgba(255, 110, 196, 0.6));
}
.halo-hero-icon svg, .halo-hero-icon img { width: 100%; height: 100%; }
.halo-hero-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 20px;
  margin: 0 0 4px 0;
}
.halo-hero-sub {
  color: rgba(255, 255, 255, 0.65);
  font-size: 14px;
}

.halo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.halo-grid-cell {
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.halo-grid-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 4px;
}
.halo-grid-value {
  font-size: 14px;
  font-weight: 500;
}

.halo-section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 20px 0 8px 0;
  color: rgba(255, 255, 255, 0.6);
}

.halo-perks {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
}
.halo-perks li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
}
.halo-perks-mark {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  line-height: 0;
}
.halo-perks-mark svg, .halo-perks-mark img { width: 100%; height: 100%; filter: drop-shadow(0 0 3px rgba(255, 110, 196, 0.5)); }

.halo-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  margin: 16px 0;
}

.halo-plan-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.halo-plan-card {
  position: relative;
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.halo-plan-card:hover { transform: translateY(-2px); }
.halo-plan-card.active {
  border-color: rgba(199, 113, 237, 0.7);
  background: rgba(199, 113, 237, 0.10);
}
.halo-plan-card:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.halo-plan-tag {
  position: absolute;
  top: -8px;
  right: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ff6ec4, #7aa8ff);
  color: #0d0d10;
  padding: 3px 8px;
  border-radius: 99px;
}
.halo-plan-price {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 22px;
}
.halo-plan-sub {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  margin-top: 2px;
}

.halo-redeem-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.halo-redeem-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 1px;
  flex: 1;
}
.halo-redeem-result {
  margin-top: 8px;
  font-size: 13px;
  min-height: 18px;
}
.halo-redeem-result.success { color: #34d399; }
.halo-redeem-result.error { color: #f87171; }

.halo-keep {
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

.halo-loading {
  padding: 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
}

.halo-since-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}
.halo-since-line.halo-since-inactive {
  color: rgba(255, 255, 255, 0.45);
}

/* ─── Customization dialog ────────────────────────────────────────────────── */
.halo-custom-dialog::backdrop {
  background: rgba(6, 6, 8, 0.65);
  backdrop-filter: blur(8px);
}
.halo-custom-card {
  max-width: 720px;
  width: 90vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.halo-custom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.halo-custom-header h3 {
  margin: 0;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
}
.halo-custom-preview-wrap {
  padding: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.halo-custom-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.halo-custom-section {
  margin-bottom: 24px;
}
.halo-custom-section h4 {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 10px 0;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  gap: 8px;
}
.halo-locked-section h4 {
  color: rgba(255, 255, 255, 0.45);
}
.halo-lock {
  display: inline-block;
  width: 14px;
  height: 14px;
  line-height: 0;
}
.halo-lock svg, .halo-lock img { width: 100%; height: 100%; }
.halo-custom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.halo-mode-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.halo-mode-tab {
  padding: 8px 14px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.halo-mode-tab:hover { background: rgba(255, 255, 255, 0.07); }
.halo-mode-tab.active {
  background: rgba(199, 113, 237, 0.18);
  border-color: rgba(199, 113, 237, 0.6);
  color: #fff;
}
.halo-mode-tab-locked .halo-lock { width: 12px; height: 12px; }

.halo-color-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.halo-color-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}
.halo-color-pick input[type="color"] {
  width: 36px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.halo-emoji-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.halo-emoji-row .field-input {
  width: 120px;
  text-align: center;
  font-size: 18px;
}

/* ─── Profile card preview ────────────────────────────────────────────────── */
.halo-preview-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(20, 20, 28, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.halo-preview-banner {
  height: 100px;
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.halo-preview-banner-img { /* image-mode banner */ }
.halo-preview-banner-emoji { position: relative; }
.halo-scatter-emoji {
  position: absolute;
  font-size: 26px;
  opacity: 0.85;
  pointer-events: none;
  transform-origin: center;
}
.halo-preview-body {
  padding: 16px;
  position: relative;
}
.halo-preview-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(20, 20, 28, 0.95);
  background: rgba(255, 255, 255, 0.05);
  margin-top: -40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 22px;
}
.halo-preview-avatar img {
  width: 100%; height: 100%; object-fit: cover;
}
.halo-preview-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 18px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.halo-preview-since {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.halo-preview-status {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 4px;
}

/* ─── CTA card (for non-Halo users in customization) ───────────────────────── */
.halo-cta-card {
  margin-top: 16px;
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  border-radius: 14px;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 110, 196, 0.18), transparent 60%),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(199, 113, 237, 0.35);
}
.halo-cta-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(255, 110, 196, 0.6));
}
.halo-cta-icon svg, .halo-cta-icon img { width: 100%; height: 100%; }
.halo-cta-text { flex: 1; }
.halo-cta-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 15px;
}
.halo-cta-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
}
.halo-active-note {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  background: rgba(199, 113, 237, 0.12);
  border: 1px solid rgba(199, 113, 237, 0.4);
  font-size: 13px;
}
.halo-active-mark {
  display: inline-block;
  width: 14px;
  height: 14px;
  line-height: 0;
}
.halo-active-mark svg, .halo-active-mark img { width: 100%; height: 100%; }

/* ─── Admin codes panel ───────────────────────────────────────────────────── */
.halo-admin-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  align-items: end;
}
.halo-admin-form .field-group.small { margin: 0; }
.halo-admin-form .btn-primary {
  align-self: stretch;
  min-height: 38px;
}
.halo-admin-fresh {
  padding: 12px;
  border-radius: 10px;
  margin-top: 12px;
  background: rgba(34, 211, 153, 0.10);
  border: 1px solid rgba(34, 211, 153, 0.30);
}
.halo-admin-fresh-list {
  margin: 8px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.halo-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 1px;
}
.halo-admin-codes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.halo-admin-code-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  flex-wrap: wrap;
}
.halo-admin-code-row.revoked {
  opacity: 0.55;
}
.halo-admin-code-meta {
  display: flex;
  gap: 12px;
  flex: 1;
  flex-wrap: wrap;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}
.halo-admin-code-meta .muted { color: rgba(255, 255, 255, 0.4); }
.halo-revoked-tag {
  color: #f87171;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 10px;
}
.halo-admin-code-actions {
  display: flex;
  gap: 6px;
}

/* ─── Apply gradient + banner to live profile rendering (future hooks) ────── */
.halo-profile-card-gradient {
  background-image: var(--halo-card-gradient) !important;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .halo-plan-picker { grid-template-columns: 1fr; }
  .halo-custom-card { width: 96vw; max-height: 92vh; }
  .halo-admin-form { grid-template-columns: 1fr; }
  .halo-grid { grid-template-columns: 1fr 1fr; }
}
