/* =====================================================================
   AprovAKI — Notificações + Userchip (sino e menu de perfil) — v4
   -----------------------------------------------------------------
   Novidades v4 (em cima da v3):
   - Anel de progresso da patente volta a ser PROGRESSIVO no avatar
     do userchip (SVG stroke-dasharray + stroke-dashoffset), tanto
     no chip mini quanto no head do dropdown.
   - Bloco "Pontos" do dropdown ganha ícone da moeda AKIcoins
     (imagem em assets/img/icones/AKIcoins.png) com FALLBACK CSS
     (letra "A" dourada em círculo) caso o PNG falhe.
   - Item "Painel Administrativo" (aki-userchip__admin) recebe
     estilo próprio, discreto.
   Respeita prefers-reduced-motion.
   ===================================================================== */

/* ---------- SINO / NOTIFICAÇÕES ---------- */
.aki-notif {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.aki-notif__btn {
  background: transparent;
  border: 0;
  padding: 8px;
  border-radius: 999px;
  cursor: pointer;
  color: #4B3CB8;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .15s ease, transform .15s ease;
}
.aki-notif__btn:hover,
.aki-notif__btn:focus-visible {
  background: rgba(75, 60, 184, 0.10);
  outline: none;
}
.aki-notif__btn i { font-size: 22px; line-height: 1; }
.aki-notif__btn[aria-expanded="true"] { background: rgba(75, 60, 184, 0.14); }

.aki-notif.has-unread .aki-notif__btn i {
  transform-origin: 50% 20%;
  animation: aki-bell-shake 1.4s ease-in-out .4s 1 both;
}
@keyframes aki-bell-shake {
  0%, 100%   { transform: rotate(0deg); }
  15%        { transform: rotate(-12deg); }
  30%        { transform: rotate(10deg); }
  45%        { transform: rotate(-8deg); }
  60%        { transform: rotate(6deg); }
  75%        { transform: rotate(-3deg); }
  90%        { transform: rotate(1deg); }
}

.aki-notif__badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #E5484D;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  border: 1.5px solid #ffffff;
  box-shadow:
    0 1px 2px rgba(150, 20, 25, 0.35),
    0 0 0 1px rgba(229, 72, 77, 0.25);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: 0;
  animation: aki-badge-pop .32s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.aki-notif__badge[hidden] { display: none; }

@keyframes aki-badge-pop {
  0%   { opacity: 0; transform: scale(0.4); }
  60%  { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

.aki-notif__pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, 92vw);
  max-height: 70vh;
  overflow: hidden;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid rgba(75, 60, 184, 0.08);
  box-shadow:
    0 1px 2px rgba(20, 12, 60, 0.06),
    0 8px 20px rgba(20, 12, 60, 0.10),
    0 24px 48px rgba(20, 12, 60, 0.14);
  z-index: 9999;
  display: none;
  flex-direction: column;
  transform-origin: top right;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transition: opacity .18s ease, transform .18s ease;
}
.aki-notif__pop[data-open="true"] {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}
.aki-notif__pop::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 14px;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-left: 1px solid rgba(75, 60, 184, 0.08);
  border-top: 1px solid rgba(75, 60, 184, 0.08);
  transform: rotate(45deg);
  border-top-left-radius: 3px;
}
.aki-notif__pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(75, 60, 184, 0.08);
  background: linear-gradient(180deg, #FAF9FF 0%, #FFFFFF 100%);
}
.aki-notif__pop-title {
  font-size: 14px;
  font-weight: 700;
  color: #2D2464;
  margin: 0;
  letter-spacing: .2px;
}
.aki-notif__marcar {
  background: transparent;
  border: 0;
  color: #4B3CB8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background-color .12s ease, color .12s ease;
}
.aki-notif__marcar:hover,
.aki-notif__marcar:focus-visible {
  background: rgba(75, 60, 184, 0.08);
  outline: none;
}
.aki-notif__marcar[disabled] { color: #A9A5C4; cursor: default; }

.aki-notif__lista {
  overflow-y: auto;
  padding: 4px 0;
  scrollbar-width: thin;
}
.aki-notif__lista::-webkit-scrollbar { width: 8px; }
.aki-notif__lista::-webkit-scrollbar-thumb {
  background: rgba(75, 60, 184, 0.20);
  border-radius: 999px;
}

.aki-notif__item {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  width: 100%;
  gap: 10px;
  padding: 10px 14px 10px 18px;
  border: 0;
  border-bottom: 1px solid rgba(75, 60, 184, 0.05);
  cursor: pointer;
  background: transparent;
  transition: background-color .12s ease, box-shadow .12s ease;
  text-decoration: none;
  text-align: left;
  font: inherit;
  color: inherit;
  position: relative;
  animation: aki-notif-in .22s ease both;
}
.aki-notif__item:last-child { border-bottom: 0; }
.aki-notif__item:hover,
.aki-notif__item:focus-visible {
  background: #FAF9FF;
  outline: none;
}
.aki-notif__item:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(75, 60, 184, 0.14);
}
.aki-notif__item.is-nova { background: rgba(229, 72, 77, 0.045); }
.aki-notif__item.is-nova:hover { background: rgba(229, 72, 77, 0.09); }

.aki-notif__item.is-nova::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #E5484D;
  transform: translateY(-50%);
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.20);
}

.aki-notif__ico {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(75, 60, 184, 0.08);
  color: #4B3CB8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}
.aki-notif__item.is-nova .aki-notif__ico {
  background: linear-gradient(135deg, #4B3CB8 0%, #6E5CE0 100%);
  color: #ffffff;
}

.aki-notif__body { flex: 1 1 auto; min-width: 0; }
.aki-notif__tit {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
  color: #2D2464;
  line-height: 1.25;
  margin: 0 0 2px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.aki-notif__msg {
  display: block;
  font-size: 12.5px;
  color: #514c74;
  line-height: 1.35;
  margin: 0 0 4px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.aki-notif__meta { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.aki-notif__tag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(244, 194, 74, 0.20);
  color: #6f5200;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .2px;
}
.aki-notif__tempo { font-size: 11px; color: #8b86a8; }
.aki-notif__item--temporada .aki-notif__ico {
  background: linear-gradient(135deg, rgba(244, 194, 74, 0.26) 0%, rgba(75, 60, 184, 0.12) 100%);
  color: #4B3CB8;
}
.aki-notif__item--temporada.is-nova .aki-notif__ico {
  background: linear-gradient(135deg, #4B3CB8 0%, #F4C24A 140%);
  color: #ffffff;
}
.aki-notif__item--meta .aki-notif__ico {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.20) 0%, rgba(75, 60, 184, 0.10) 100%);
  color: #059669;
}
.aki-notif__item--meta.is-nova .aki-notif__ico {
  background: linear-gradient(135deg, #059669 0%, #4B3CB8 120%);
  color: #ffffff;
}

.aki-notif__empty {
  padding: 30px 18px;
  text-align: center;
  color: #6b6690;
  font-size: 13px;
}
.aki-notif__empty i {
  font-size: 40px;
  color: #C7C2E5;
  display: inline-block;
  margin-bottom: 8px;
  padding: 12px;
  background: rgba(75, 60, 184, 0.06);
  border-radius: 50%;
}

.aki-notif__pop-foot {
  padding: 10px 14px;
  border-top: 1px solid rgba(75, 60, 184, 0.08);
  background: #FAF9FF;
  font-size: 12px;
  color: #6b6690;
  text-align: center;
  letter-spacing: .3px;
}

@keyframes aki-notif-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0);   }
}

@media (max-width: 380px) {
  .aki-notif__pop { right: -8px; width: 94vw; }
  .aki-notif__pop::before { right: 22px; }
}

/* ---------- USERCHIP (menu de perfil) ---------- */
.aki-userchip {
  position: relative;
  display: inline-flex;
  align-items: center;
  --aki-p: #4B3CB8;
  --aki-p-track: #E4E0F5;
}
.aki-userchip__btn {
  background: transparent;
  border: 0;
  padding: 4px 6px 4px 4px;
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background-color .15s ease;
}
.aki-userchip__btn:hover,
.aki-userchip__btn:focus-visible {
  background: rgba(75, 60, 184, 0.08);
  outline: none;
}
.aki-userchip__btn[aria-expanded="true"] { background: rgba(75, 60, 184, 0.14); }
.aki-userchip__caret {
  font-size: 14px;
  color: #6b6690;
  transition: transform .18s ease;
}
.aki-userchip.is-open .aki-userchip__caret { transform: rotate(180deg); }

/* Avatar mini (32px) com anel progressivo em SVG */
.aki-userchip__avatar {
  position: relative;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.aki-userchip__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* começa do topo */
  pointer-events: none;
}
.aki-userchip__ring-track {
  fill: none;
  stroke: var(--aki-p-track);
  stroke-width: 3;
}
.aki-userchip__ring-bar {
  fill: none;
  stroke: var(--aki-p);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset .5s ease;
}
.aki-userchip__avatar-img {
  position: relative;
  z-index: 1;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  background: #eae7f6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.aki-userchip__avatar-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.aki-userchip__avatar-img i { font-size: 22px; color: #4B3CB8; }

/* Dropdown */
.aki-userchip__pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(320px, 92vw);
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid rgba(75, 60, 184, 0.08);
  box-shadow:
    0 1px 2px rgba(20, 12, 60, 0.06),
    0 8px 20px rgba(20, 12, 60, 0.10),
    0 24px 48px rgba(20, 12, 60, 0.14);
  z-index: 9999;
  display: none;
  flex-direction: column;
  transform-origin: top right;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transition: opacity .18s ease, transform .18s ease;
}
.aki-userchip__pop[data-open="true"] {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}
.aki-userchip__pop::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 22px;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-left: 1px solid rgba(75, 60, 184, 0.08);
  border-top: 1px solid rgba(75, 60, 184, 0.08);
  transform: rotate(45deg);
  border-top-left-radius: 3px;
}

.aki-userchip__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid rgba(75, 60, 184, 0.08);
  background: linear-gradient(180deg, #FAF9FF 0%, #FFFFFF 100%);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}
.aki-userchip__head-av {
  position: relative;
  width: 60px;
  height: 60px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 60px;
}
.aki-userchip__ring--big { position: absolute; inset: 0; }
.aki-userchip__ring--big .aki-userchip__ring-track,
.aki-userchip__ring--big .aki-userchip__ring-bar { stroke-width: 4; }
.aki-userchip__head-av-img {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: #eae7f6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.aki-userchip__head-av-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.aki-userchip__head-av-img i { font-size: 44px; color: #4B3CB8; }
.aki-userchip__head-medal {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 24px;
  height: 24px;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(20,12,60,0.25));
}
.aki-userchip__head-info { display: flex; flex-direction: column; min-width: 0; }
.aki-userchip__head-nome {
  font-size: 15px;
  font-weight: 800;
  color: #2D2464;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aki-userchip__head-user {
  font-size: 12.5px;
  color: #6b6690;
  line-height: 1.2;
  margin-top: 1px;
}
.aki-userchip__head-patente {
  font-size: 11.5px;
  color: var(--aki-p);
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: .2px;
  cursor: help;
}

/* Stats: pontos + próxima patente */
.aki-userchip__stats {
  padding: 12px 14px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid rgba(75, 60, 184, 0.06);
}
.aki-userchip__stat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(244, 194, 74, 0.12) 0%, rgba(75, 60, 184, 0.06) 100%);
  cursor: help;
}
.aki-userchip__coin {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 22px;
}
.aki-userchip__coin img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
/* Fallback CSS quando o PNG falha: círculo dourado com "A" */
.aki-userchip__coin.is-fallback {
  background: radial-gradient(circle at 30% 30%, #F9D77E 0%, #F4C24A 55%, #C89312 100%);
  box-shadow:
    inset 0 -2px 3px rgba(120, 80, 0, 0.35),
    inset 0 2px 3px rgba(255, 255, 255, 0.45),
    0 1px 2px rgba(120, 80, 0, 0.30);
}
.aki-userchip__coin.is-fallback::after {
  content: "A";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 900;
  font-size: 13px;
  color: #5a3a00;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
.aki-userchip__stat-num {
  font-weight: 900;
  color: #2D2464;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.aki-userchip__stat-lbl {
  font-size: 12px;
  color: #6b6690;
  font-weight: 700;
  letter-spacing: .3px;
}
.aki-userchip__next {
  padding: 6px 4px 2px;
  cursor: help;
}
.aki-userchip__next--max { text-align: center; color: var(--aki-p); font-weight: 700; font-size: 12.5px; }
.aki-userchip__next-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #514c74;
  margin-bottom: 4px;
}
.aki-userchip__next-top strong { color: var(--aki-p); }
.aki-userchip__next-faltam {
  font-size: 11px;
  color: #8b86a8;
  font-weight: 600;
}
.aki-userchip__next-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--aki-p-track);
  overflow: hidden;
}
.aki-userchip__next-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--aki-p) 0%, #F4C24A 100%);
  border-radius: 999px;
  transition: width .5s ease;
}

/* Menu */
.aki-userchip__menu {
  list-style: none;
  margin: 0;
  padding: 6px 6px 8px;
}
.aki-userchip__menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  color: #2D2464;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  transition: background-color .12s ease, color .12s ease;
}
.aki-userchip__menu a:hover,
.aki-userchip__menu a:focus-visible {
  background: rgba(75, 60, 184, 0.08);
  outline: none;
}
.aki-userchip__menu i { font-size: 18px; color: #4B3CB8; }
.aki-userchip__sep {
  border: 0;
  border-top: 1px solid rgba(75, 60, 184, 0.10);
  margin: 6px 4px;
}
.aki-userchip__exit { color: #b91c1c !important; }
.aki-userchip__exit i { color: #b91c1c; }
.aki-userchip__exit:hover { background: rgba(185, 28, 28, 0.08) !important; }

.aki-userchip__admin {
  color: #7c3aed !important;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.06) 0%, rgba(244, 194, 74, 0.06) 100%);
}
.aki-userchip__admin i { color: #7c3aed; }
.aki-userchip__admin:hover {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.14) 0%, rgba(244, 194, 74, 0.14) 100%) !important;
}

/* Reduzir movimento */
@media (prefers-reduced-motion: reduce) {
  .aki-notif__btn,
  .aki-notif__item,
  .aki-notif__pop,
  .aki-userchip__btn,
  .aki-userchip__pop,
  .aki-userchip__ring-bar,
  .aki-userchip__next-bar i { transition: none; }
  .aki-notif.has-unread .aki-notif__btn i { animation: none; }
  .aki-notif__item,
  .aki-notif__badge { animation: none; }
}

/* Mobile: dropdown do userchip ocupa mais espaço */
@media (max-width: 480px) {
  .aki-userchip__pop { width: 94vw; right: -8px; }
  .aki-userchip__pop::before { right: 30px; }
}

/* Hotfix 2026-07-19 — popover de notificações sem corte no mobile. */
@media (max-width: 720px) {
  .aki-notif__pop {
    position: fixed !important;
    top: 74px !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-width: none !important;
    max-height: calc(100dvh - 112px) !important;
    transform-origin: top center !important;
    border-radius: 18px !important;
  }
  .aki-notif__pop::before { display: none !important; }
  .aki-notif__pop-head { gap: 10px; }
  .aki-notif__pop-title { flex: 0 0 auto; }
  .aki-notif__marcar { text-align: right; }
}
