/* assets/css/auth-pill.css
 *
 * Shared user-pill + dropdown styles. Used by every public-facing page
 * (home, login, legal, status, access). Pair with auth-pill.js.
 *
 * Two integration modes:
 *
 *   1) Inline HTML — drop the `#auth-out` + `#auth-in` blocks into your
 *      own nav. The JS finds them and wires them.
 *
 *   2) Auto-mount — drop a `<div id="mdr-auth-pill-slot"></div>` anywhere
 *      and the JS builds the HTML inside it. Easiest for pages that
 *      didn't ship a nav.
 *
 * Both use these classes.
 */

:root {
  --mdr-pill-ring:   rgba(255, 255, 255, 0.10);
  --mdr-pill-ring-2: rgba(255, 255, 255, 0.06);
  --mdr-pill-mute:   rgba(255, 255, 255, 0.55);
  --mdr-pill-faint:  rgba(255, 255, 255, 0.40);
}

/* ── User pill ────────────────────────────────────────────────────── */
.mdr-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--mdr-pill-ring);
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s;
  font-family: 'Onest', system-ui, -apple-system, sans-serif;
}
.mdr-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}
.mdr-pill__avatar {
  position: relative;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: conic-gradient(from 220deg, #a855f7, #ec4899, #f59e0b, #a855f7);
  overflow: hidden;
  flex-shrink: 0;
}
.mdr-pill__avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.mdr-pill__avatar img:not([src]),
.mdr-pill__avatar img[src=""] { display: none; }
.mdr-pill__avatar-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}
.mdr-pill__avatar img[src]:not([src=""]) ~ .mdr-pill__avatar-fallback {
  display: none;
}
.mdr-pill__text {
  display: flex; flex-direction: column;
  line-height: 1.1;
  text-align: left;
}
.mdr-pill__handle {
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
}
.mdr-pill__frame {
  font-size: 10px;
  color: var(--mdr-pill-faint);
  font-weight: 500;
  margin-top: 2px;
}
.mdr-pill__frame:empty { display: none; }
.mdr-pill__chev {
  font-style: normal;
  color: var(--mdr-pill-mute);
  font-size: 11px;
  margin-left: 2px;
  transition: transform 0.16s;
}
.mdr-pill[aria-expanded="true"] .mdr-pill__chev { transform: rotate(180deg); color: #fff; }

/* The pill needs a relative parent for the dropdown to anchor against. */
.mdr-pill-container { position: relative; display: inline-block; }
.mdr-pill-container[hidden] { display: none; }

@media (max-width: 540px) {
  .mdr-pill { padding: 5px 10px 5px 5px; gap: 8px; }
  .mdr-pill__avatar { width: 26px; height: 26px; }
  .mdr-pill__frame { display: none; }
}

/* ── Dropdown menu ────────────────────────────────────────────────── */
.mdr-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 260px;
  padding: 8px;
  background: rgba(15, 15, 20, 0.92);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--mdr-pill-ring);
  border-radius: 16px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.55);
  z-index: 60;
  animation: mdrMenuIn 0.16s ease-out;
  color: #fff;
}
@keyframes mdrMenuIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.mdr-menu__head {
  padding: 12px 12px 10px;
  border-radius: 10px;
  margin-bottom: 4px;
}
.mdr-menu__head-row {
  display: flex; align-items: center; gap: 10px;
}
.mdr-menu__head-avatar {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: conic-gradient(from 220deg, #a855f7, #ec4899, #f59e0b, #a855f7);
  overflow: hidden;
  flex-shrink: 0;
}
.mdr-menu__head-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.mdr-menu__head-avatar img:not([src]),
.mdr-menu__head-avatar img[src=""] { display: none; }
.mdr-menu__head-letter {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 15px;
}
.mdr-menu__head-avatar img[src]:not([src=""]) ~ .mdr-menu__head-letter {
  display: none;
}
.mdr-menu__head-text { min-width: 0; }
.mdr-menu__head-name {
  margin: 0;
  font-size: 13.5px; font-weight: 600;
  color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mdr-menu__head-handle {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--mdr-pill-faint);
}
.mdr-menu__frame-row {
  display: flex; align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--mdr-pill-mute);
}
.mdr-menu__frame-row strong { color: #fff; font-weight: 600; }
.mdr-menu__frame-swatch {
  width: 10px; height: 10px;
  border-radius: 3px;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  flex-shrink: 0;
}

/* Trial / billing notice — only renders if subscription_end is within
 * ~7 days. Subtle warning chip; click takes you to dashboard. */
.mdr-menu__trial {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 0 4px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.10), rgba(245, 158, 11, 0.06));
  border: 1px solid rgba(251, 191, 36, 0.20);
  border-radius: 10px;
  font-size: 12px;
  color: #fef3c7;
  text-decoration: none;
}
.mdr-menu__trial-icon {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: rgba(251, 191, 36, 0.18);
  color: #fbbf24;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}
.mdr-menu__trial strong { color: #fff; font-weight: 600; }
.mdr-menu__trial[data-state="expired"] {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.12), rgba(220, 38, 38, 0.06));
  border-color: rgba(248, 113, 113, 0.25);
  color: #fee2e2;
}
.mdr-menu__trial[data-state="expired"] .mdr-menu__trial-icon {
  background: rgba(248, 113, 113, 0.18);
  color: #f87171;
}

.mdr-menu__divider {
  height: 1px;
  background: var(--mdr-pill-ring-2);
  margin: 6px 4px;
}
.mdr-menu__row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.14s;
  font-family: inherit;
}
.mdr-menu__row:hover { background: rgba(255, 255, 255, 0.06); }
.mdr-menu__row--danger { color: #f87171; }
.mdr-menu__row--danger:hover { background: rgba(248, 113, 113, 0.10); }
.mdr-menu__row-icon {
  width: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px;
  opacity: 0.7;
}
.mdr-menu__row:hover .mdr-menu__row-icon { opacity: 1; }

/* ── Auto-mount slot fallback ────────────────────────────────────── */
/* When the page uses `<div id="mdr-auth-pill-slot">`, hide it before the
 * JS has rendered so there's no flash of empty container. */
#mdr-auth-pill-slot:empty { display: none; }
