/* =========================================================
   JLPT HARU - SHARED NOTIFICATION POPUP
   ========================================================= */

[data-notification-toggle] {
  position: relative;
}

[data-notification-toggle] .level-notification-dot,
[data-notification-toggle] .n1-notification-dot,
[data-notification-toggle] .n2-notification-dot,
[data-notification-toggle] .n3-notification-dot,
[data-notification-toggle] .n4-notification-dot,
[data-notification-toggle] .n5-notification-dot,
[data-notification-toggle] .notification-dot {
  display: none !important;
}

.jlpt-notification-badge {
  position: absolute !important;
  z-index: 4;
  top: -7px !important;
  right: -8px !important;

  min-width: 21px !important;
  height: 21px !important;
  padding: 0 5px !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  border: 2px solid #ffffff !important;
  border-radius: 999px !important;

  background: #ef233c !important;
  color: #ffffff !important;

  box-shadow:
    0 4px 10px rgba(239, 35, 60, 0.34),
    0 0 0 2px rgba(239, 35, 60, 0.08) !important;

  font-family: Poppins, "Noto Sans JP", sans-serif !important;
  font-size: 10px !important;
  font-weight: 900 !important;
  line-height: 1 !important;

  pointer-events: none;
}

.jlpt-notification-badge[hidden] {
  display: none !important;
}

html.dark .jlpt-notification-badge,
body.dark .jlpt-notification-badge {
  border-color: #202329 !important;
}

.jlpt-notification-dropdown {
  position: fixed;
  z-index: 2147483000;

  width: min(420px, calc(100vw - 24px));
  max-height: min(460px, calc(100vh - 24px));

  overflow: hidden;

  border: 1px solid rgba(216, 224, 237, 0.94);
  border-radius: 25px;

  background: rgba(255, 255, 255, 0.985);
  color: #1a2233;

  box-shadow:
    0 30px 75px rgba(31, 45, 73, 0.25),
    0 10px 24px rgba(31, 45, 73, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.98);

  opacity: 0;
  transform: perspective(900px) rotateX(-5deg) translateY(-9px) scale(0.98);
  transform-origin: top right;

  transition:
    opacity 0.15s ease,
    transform 0.18s ease;

  font-family: Poppins, "Noto Sans JP", sans-serif;
}

.jlpt-notification-dropdown[hidden] {
  display: none !important;
}

.jlpt-notification-dropdown.is-visible {
  opacity: 1;
  transform: perspective(900px) rotateX(0) translateY(0) scale(1);
}

.jlpt-notification-dropdown::before {
  position: absolute;
  top: -8px;
  right: 25px;

  width: 16px;
  height: 16px;

  border-top: 1px solid rgba(216, 224, 237, 0.94);
  border-left: 1px solid rgba(216, 224, 237, 0.94);

  background: #ffffff;
  content: "";
  transform: rotate(45deg);
}

.jlpt-notification-header {
  position: relative;
  z-index: 1;

  min-height: 78px;
  padding: 19px 24px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;

  border-bottom: 1px solid #e7ebf2;
  background: rgba(255, 255, 255, 0.98);
}

.jlpt-notification-header h2 {
  margin: 0;
  color: #161d2b;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.jlpt-notification-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.jlpt-notification-mark-all,
.jlpt-notification-close {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.jlpt-notification-mark-all {
  padding: 7px 2px;
  color: #365fc2;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.jlpt-notification-mark-all:hover {
  color: #2048a8;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.jlpt-notification-mark-all[hidden] {
  display: none !important;
}

.jlpt-notification-close {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;

  display: inline-grid;
  place-items: center;

  border-radius: 11px;
  color: #586174;

  transition:
    background 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.jlpt-notification-close:hover {
  background: #f1f4f8;
  color: #1e2635;
  transform: translateY(-1px);
}

.jlpt-notification-close svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.jlpt-notification-list {
  max-height: min(470px, calc(100vh - 190px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #c6cfdd transparent;
}

.jlpt-notification-item {
  position: relative;
  width: 100%;
  min-height: 130px;
  padding: 20px 22px;

  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;

  border: 0;
  border-bottom: 1px solid #e5eaf1;
  border-radius: 0;

  background: #ffffff;
  color: inherit;
  text-align: left;

  cursor: pointer;
  transition:
    filter 0.16s ease,
    transform 0.16s ease,
    box-shadow 0.16s ease;
}

.jlpt-notification-item:hover {
  z-index: 2;
  filter: saturate(1.04) brightness(0.995);
  box-shadow: inset 4px 0 0 rgba(77, 111, 219, 0.45);
}

.jlpt-notification-item:focus-visible {
  z-index: 3;
  outline: 3px solid rgba(59, 104, 220, 0.25);
  outline-offset: -3px;
}

.jlpt-notification-item.is-opening {
  pointer-events: none;
  opacity: 0.72;
}

.jlpt-notification-item.is-new.jlpt-notification-listening {
  background: linear-gradient(90deg, #fff5f3 0%, #fffafa 100%);
}

.jlpt-notification-item.is-new.jlpt-notification-exam,
.jlpt-notification-item.is-new.jlpt-notification-reading {
  background: linear-gradient(90deg, #f1f7ff 0%, #f9fbff 100%);
}

.jlpt-notification-item.is-new.jlpt-notification-grammar {
  background: linear-gradient(90deg, #f2fff4 0%, #f9fff9 100%);
}

.jlpt-notification-item.is-new.jlpt-notification-vocabulary {
  background: linear-gradient(90deg, #fbf6ff 0%, #fdfbff 100%);
}

.jlpt-notification-item.is-new.jlpt-notification-kanji {
  background: linear-gradient(90deg, #eefbf8 0%, #f8fffd 100%);
}

.jlpt-notification-item-icon {
  width: 68px;
  height: 68px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 18px;

  background: linear-gradient(145deg, #eef3ff, #dae6ff);
  color: #3565d8;

  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.95),
    0 10px 22px rgba(53, 101, 216, 0.11);
}

.jlpt-notification-listening .jlpt-notification-item-icon {
  background: linear-gradient(145deg, #fff0ed, #ffe1dc);
  color: #f06d61;
}

.jlpt-notification-grammar .jlpt-notification-item-icon {
  background: linear-gradient(145deg, #edffec, #d9f8d7);
  color: #299456;
}

.jlpt-notification-vocabulary .jlpt-notification-item-icon {
  background: linear-gradient(145deg, #f5edff, #e8dcff);
  color: #8155d6;
}

.jlpt-notification-kanji .jlpt-notification-item-icon {
  background: linear-gradient(145deg, #e9faf5, #d1f3e9);
  color: #16866c;
}

.jlpt-notification-item-icon svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.jlpt-notification-kana {
  font-family: "Noto Sans JP", sans-serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.jlpt-notification-copy {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.jlpt-notification-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.jlpt-notification-title-line strong {
  color: #182033;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
}

.jlpt-notification-new-label {
  padding: 3px 7px;
  border-radius: 6px;
  background: #ffe2e5;
  color: #e51d3b;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
}

.jlpt-notification-message {
  color: #626c7e;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
}

.jlpt-notification-copy time {
  color: #7c8595;
  font-size: 11px;
  font-weight: 500;
}

.jlpt-notification-item-status {
  min-width: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 15px;
}

.jlpt-notification-unread-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border-radius: 50%;
  background: #ef233c;
  box-shadow: 0 0 0 4px rgba(239, 35, 60, 0.07);
}

.jlpt-notification-item-status svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: #202938;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.jlpt-notification-footer {
  min-height: 54px;
  margin: 0;
  padding: 15px 22px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-top: 1px solid #e7ebf2;
  background: #fbfcfe;
  color: #747e8f;

  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.jlpt-notification-empty {
  min-height: 250px;
  padding: 34px 24px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;

  color: #687386;
  text-align: center;
}

.jlpt-notification-empty-icon {
  width: 62px;
  height: 62px;
  margin-bottom: 5px;

  display: grid;
  place-items: center;

  border-radius: 20px;
  background: #f0f4fa;
  color: #6e7d96;
}

.jlpt-notification-empty-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.jlpt-notification-empty strong {
  color: #273044;
  font-size: 16px;
}

.jlpt-notification-empty small {
  max-width: 390px;
  color: #7b8596;
  font-size: 13px;
  line-height: 1.55;
}

.jlpt-notification-tooltip {
  position: fixed;
  z-index: 2147483646;

  max-width: min(280px, calc(100vw - 20px));
  padding: 9px 12px;

  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 11px;

  background: rgba(24, 32, 51, 0.96);
  color: #ffffff;

  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.24);

  opacity: 0;
  transform: translateY(-5px) scale(0.97);
  transition:
    opacity 0.14s ease,
    transform 0.16s ease;

  font-family: Poppins, "Noto Sans JP", sans-serif;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
  text-align: center;

  pointer-events: none;
}

.jlpt-notification-tooltip[hidden] {
  display: none !important;
}

.jlpt-notification-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* =========================================================
   DARK MODE — ĐỒNG BỘ POPUP TÀI KHOẢN
   ========================================================= */

html.dark .jlpt-notification-dropdown,
body.dark .jlpt-notification-dropdown {
  border-color: rgba(255, 255, 255, 0.12);

  background:
    linear-gradient(
      145deg,
      #4c525b 0%,
      #383d45 100%
    );

  color: #f5f7fa;

  box-shadow:
    0 28px 64px rgba(10, 13, 18, 0.35),
    0 9px 20px rgba(10, 13, 18, 0.24),
    inset 1px 1px 0 rgba(255, 255, 255, 0.10),
    inset -1px -1px 0 rgba(0, 0, 0, 0.20);
}

html.dark .jlpt-notification-dropdown::before,
body.dark .jlpt-notification-dropdown::before {
  border-color: rgba(255, 255, 255, 0.12);
  background: #4c525b;
}

html.dark .jlpt-notification-header,
body.dark .jlpt-notification-header {
  border-bottom-color: #69717c;

  background:
    linear-gradient(
      145deg,
      #4c525b 0%,
      #383d45 100%
    );
}

html.dark .jlpt-notification-header h2,
body.dark .jlpt-notification-header h2,
html.dark .jlpt-notification-title-line strong,
body.dark .jlpt-notification-title-line strong,
html.dark .jlpt-notification-empty strong,
body.dark .jlpt-notification-empty strong {
  color: #f5f7fa;
}

html.dark .jlpt-notification-mark-all,
body.dark .jlpt-notification-mark-all {
  color: #b7ccff;
}

html.dark .jlpt-notification-close,
body.dark .jlpt-notification-close {
  color: #cbd1d9;
}

html.dark .jlpt-notification-close:hover,
body.dark .jlpt-notification-close:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

html.dark .jlpt-notification-list,
body.dark .jlpt-notification-list {
  scrollbar-color: #8a939f transparent;
}

html.dark .jlpt-notification-item,
body.dark .jlpt-notification-item {
  border-bottom-color: #69717c;

  background:
    linear-gradient(
      145deg,
      #555c66 0%,
      #424850 100%
    );
}

html.dark .jlpt-notification-item:hover,
body.dark .jlpt-notification-item:hover {
  background:
    linear-gradient(
      145deg,
      #606873 0%,
      #4b525b 100%
    );

  filter: none;

  box-shadow:
    inset 4px 0 0 rgba(138, 180, 255, 0.65),
    inset 1px 1px 0 rgba(255, 255, 255, 0.08);
}

html.dark
  .jlpt-notification-item.is-new.jlpt-notification-listening,
body.dark
  .jlpt-notification-item.is-new.jlpt-notification-listening {
  background:
    linear-gradient(
      90deg,
      #66555a 0%,
      #4b5059 100%
    );
}

html.dark
  .jlpt-notification-item.is-new.jlpt-notification-exam,
html.dark
  .jlpt-notification-item.is-new.jlpt-notification-reading,
body.dark
  .jlpt-notification-item.is-new.jlpt-notification-exam,
body.dark
  .jlpt-notification-item.is-new.jlpt-notification-reading {
  background:
    linear-gradient(
      90deg,
      #53637c 0%,
      #484f59 100%
    );
}

html.dark
  .jlpt-notification-item.is-new.jlpt-notification-grammar,
body.dark
  .jlpt-notification-item.is-new.jlpt-notification-grammar {
  background:
    linear-gradient(
      90deg,
      #53685c 0%,
      #484f52 100%
    );
}

html.dark
  .jlpt-notification-item.is-new.jlpt-notification-vocabulary,
body.dark
  .jlpt-notification-item.is-new.jlpt-notification-vocabulary {
  background:
    linear-gradient(
      90deg,
      #615875 0%,
      #4b4e59 100%
    );
}

html.dark
  .jlpt-notification-item.is-new.jlpt-notification-kanji,
body.dark
  .jlpt-notification-item.is-new.jlpt-notification-kanji {
  background:
    linear-gradient(
      90deg,
      #47665e 0%,
      #464f50 100%
    );
}

html.dark .jlpt-notification-message,
html.dark .jlpt-notification-copy time,
body.dark .jlpt-notification-message,
body.dark .jlpt-notification-copy time {
  color: #cbd1d9;
}

html.dark .jlpt-notification-item-status svg,
body.dark .jlpt-notification-item-status svg {
  stroke: #f5f7fa;
}

html.dark .jlpt-notification-footer,
body.dark .jlpt-notification-footer {
  border-top-color: #69717c;

  background:
    linear-gradient(
      145deg,
      #4c525b 0%,
      #383d45 100%
    );

  color: #cbd1d9;
}

html.dark .jlpt-notification-empty,
body.dark .jlpt-notification-empty {
  color: #cbd1d9;
}

html.dark .jlpt-notification-empty-icon,
body.dark .jlpt-notification-empty-icon {
  border: 1px solid #646d78;

  background:
    linear-gradient(
      145deg,
      #555c66 0%,
      #424850 100%
    );

  color: #d4def2;

  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.08),
    0 7px 14px rgba(0, 0, 0, 0.18);
}

html.dark .jlpt-notification-empty small,
body.dark .jlpt-notification-empty small {
  color: #cbd1d9;
}

html.dark .jlpt-notification-tooltip,
body.dark .jlpt-notification-tooltip {
  border-color: rgba(255, 255, 255, 0.12);

  background:
    linear-gradient(
      145deg,
      #555c66 0%,
      #424850 100%
    );

  color: #f5f7fa;

  box-shadow:
    0 16px 32px rgba(10, 13, 18, 0.28),
    inset 1px 1px 0 rgba(255, 255, 255, 0.08);
}

@media (max-width: 680px) {
  .jlpt-notification-dropdown {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 20px;
  }

  .jlpt-notification-dropdown::before {
    display: none;
  }

  .jlpt-notification-header {
    min-height: 68px;
    padding: 15px 16px;
  }

  .jlpt-notification-header h2 {
    font-size: 21px;
  }

  .jlpt-notification-mark-all {
    font-size: 11px;
  }

  .jlpt-notification-item {
    min-height: 112px;
    padding: 16px 14px;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 12px;
  }

  .jlpt-notification-item-icon {
    width: 52px;
    height: 52px;
    border-radius: 15px;
  }

  .jlpt-notification-item-icon svg {
    width: 27px;
    height: 27px;
  }

  .jlpt-notification-kana {
    font-size: 31px;
  }

  .jlpt-notification-title-line strong {
    font-size: 14px;
  }

  .jlpt-notification-message {
    font-size: 12px;
  }

  .jlpt-notification-item-status {
    min-width: 25px;
    gap: 8px;
  }

  .jlpt-notification-unread-dot {
    width: 9px;
    height: 9px;
    flex-basis: 9px;
  }

  .jlpt-notification-item-status svg {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 440px) {
  .jlpt-notification-header-actions {
    gap: 5px;
  }

  .jlpt-notification-mark-all {
    max-width: 118px;
    white-space: normal;
    text-align: right;
    line-height: 1.25;
  }

  .jlpt-notification-item {
    grid-template-columns: 46px minmax(0, 1fr) 20px;
    gap: 10px;
  }

  .jlpt-notification-item-icon {
    width: 46px;
    height: 46px;
  }

  .jlpt-notification-unread-dot {
    position: absolute;
    top: 14px;
    right: 13px;
  }
}

.jlpt-notification-dropdown {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.jlpt-notification-header,
.jlpt-notification-footer {
  flex: 0 0 auto;
}

.jlpt-notification-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 16px;
  scroll-padding-bottom: 16px;
  scrollbar-gutter: stable;
}

.jlpt-notification-item:last-child {
  border-bottom: 0;
}

@media (max-width: 680px) {
  .jlpt-notification-list {
    max-height: none;
    padding-bottom: 14px;
    scroll-padding-bottom: 14px;
  }
}
