/* =========================================================
   RESEARCH CITY — PREMIUM UI
   Compact · Animated · Multi-source ready
========================================================= */

/* =================================
   PAPER CARD (MAIN)
================================= */

.zar-paper {
  position: relative;

  border-radius: 14px;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.55rem;

  background: linear-gradient(
    180deg,
    rgba(40, 60, 120, 0.12),
    rgba(20, 30, 80, 0.08)
  );

  border: 1px solid rgba(120,160,255,0.08);

  transition: all 0.25s ease;
}

.zar-paper:hover {
  border-color: rgba(120,160,255,0.25);
  transform: translateY(-1px);
}

/* =================================
   SUMMARY (TITLE ROW)
================================= */

.zar-paper summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;

  cursor: pointer;
  list-style: none;

  font-size: 0.95rem;
  font-weight: 600;

  line-height: 1.35;
}

/* Arrow (animated) */
.zar-paper summary::before {
  content: "›";
  font-size: 1rem;
  color: #7aa6ff;

  transition: transform 0.25s ease;
}

/* ONLY paper chevron */
.zar-paper[open] > summary::before {
  transform: rotate(90deg);
}

/* =================================
   CONTENT (SMOOTH EXPAND)
================================= */

.zar-paper-content {
  overflow: hidden;

  max-height: 0;
  opacity: 0;

  transform: translateY(-6px);
  transition:
    max-height 0.35s ease,
    opacity 0.25s ease,
    transform 0.25s ease;

  font-size: 0.88rem;
  line-height: 1.5;
}

.zar-paper[open] > .zar-paper-content {
  max-height: 1200px;
  opacity: 1;
  transform: translateY(0);
}

/* =================================
   META (AUTHORS / JOURNAL)
================================= */

.zar-paper-content strong {
  color: #cfe1ff;
}

.zar-paper-content {
  margin-top: 0.35rem;
}

/* =================================
   ABSTRACT (FIXED CHEVRON)
================================= */

.zar-abstract summary {
    position: relative;
    padding-left: 0.1rem;
    font-size: 0.8rem;
    opacity: 0.85;
    cursor: pointer;
    list-style: none;
}

/* remove default marker (important) */
.zar-abstract summary::-webkit-details-marker {
  display: none;
}
.zar-abstract summary::marker {
  display: none;
}

/* custom chevron */
.zar-abstract summary::before {
    /* padding-left: 5px; */
    content: "›";
    position: relative;
    left: 0;
    top: 0;
    font-size: 0.85rem;
    color: #7aa6ff;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.8;
}

/* rotate when open */
.zar-abstract[open] summary::before {
  transform: rotate(90deg);
  opacity: 1;
}
/* ✅ Abstract chevron rotation */
.zar-abstract[open] > summary::before {
  transform: rotate(90deg);
}
/* =================================
   LINKS (CLEANER)
================================= */

.zar-paper a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;

  margin-top: 0.4rem;

  font-size: 0.8rem;
  opacity: 0.85;

  transition: opacity 0.2s ease;
}

.zar-paper a:hover {
  opacity: 1;
}

/* =================================
   SOURCE BAR (BOTTOM)
================================= */

.zar-source-bar {
  margin-top: 0.8rem;

  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* =================================
   SOURCE BADGES (MULTI-SOURCE READY)
================================= */

.zar-source-badge {
  position: relative;

  display: inline-flex;
  align-items: center;
  gap: 0.3rem;

  padding: 0.28rem 0.55rem;

  border-radius: 999px;

  font-size: 0.72rem;
  font-weight: 500;

  background: rgba(120,160,255,0.08);
  border: 1px solid rgba(120,160,255,0.15);

  backdrop-filter: blur(4px);

  transition: all 0.2s ease;
}

.zar-source-badge:hover {
  background: rgba(120,160,255,0.15);
  border-color: rgba(120,160,255,0.3);
}

/* Individual sources */
.zar-source-pubmed { color: #7aa6ff; }
.zar-source-arxiv { color: #ff6b6b; }
.zar-source-openalex { color: #4ade80; }

/* =================================
   TOOLTIP (SMOOTH)
================================= */

.zar-source-tooltip {
    text-align: center;
    /* overflow-wrap: anywhere; */
    /* word-break: normal; */
    /* white-space: normal; */
    /* overflow: auto; */
    width: min(8rem, calc(100vw - 4rem));
    /* display: flex; */
    /* width: 100px; */
    position: absolute;
    bottom: 135%;
    left: 80%;
    transform: translateX(-50%) translateY(4px);
    background: #0f172a;
    padding: 0.25rem 0.45rem;
    border-radius: 6px;
    font-size: 0.68rem;
    white-space: normal;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
}

.zar-source-badge:hover .zar-source-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =================================
   MOBILE — COMPACT MODE
================================= */

@media (max-width: 768px) {

  .zar-paper {
    padding: 0.5rem 0.6rem;
  }

  .zar-paper summary {
    font-size: 0.9rem;
  }

  .zar-paper-content {
    font-size: 0.85rem;
  }

  .zar-abstract-content {
    font-size: 0.8rem;
  }

  .zar-source-badge {
    font-size: 0.68rem;
  }
}

.zar-research-citation-link {
  display: inline;
  border: 0;
  padding: 0 0.12em;
  margin: 0;
  background: transparent;
  color: #7da7ff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.18em;
}

.zar-research-citation-link:hover {
  color: #a9c2ff;
}

.zar-paper--citation-focus {
  outline: 2px solid rgba(125, 167, 255, 0.8);
  box-shadow: 0 0 0 6px rgba(125, 167, 255, 0.12);
}
.zar-research-citation-link {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    margin: 0 0.1em;
    padding: 0.12em 0.42em;
    /* border-radius: 999px; */
    /* border: 1px solid rgba(120, 140, 255, 0.28); */
    /* background: rgba(120, 140, 255, 0.08); */
    font: inherit;
    line-height: 1.25;
    cursor: pointer;
    transform-origin: center;
    transition: opacity 180ms ease,
    transform 180ms ease,
    background-color 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease;
}

.zar-research-citation-link--pending {
  opacity: 0.72;
  transform: translateY(0);
}

.zar-research-citation-link--resolved {
    opacity: 1;
    transform: translateY(-1px);
    /* background: rgba(90, 180, 160, 0.12); */
    /* border-color: rgba(90, 180, 160, 0.36); */
    /* box-shadow: 0 0 0 3px rgba(90, 180, 160, 0.08); */
    animation: zarCitationResolvedIn 260ms ease both;
}

@keyframes zarCitationResolvedIn {
  from {
    opacity: 0.45;
    transform: translateY(2px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(-1px) scale(1);
  }
}

.zar-research-actions {
  display: flex;
  justify-content: flex-start;
  margin: 10px 0 14px;
}

.zar-research-synthesis-btn {
  border: 1px solid rgba(142, 169, 255, 0.28);
  background: rgba(142, 169, 255, 0.08);
  color: rgba(235, 241, 255, 0.88);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 0.86rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    opacity 180ms ease;
}

.zar-research-synthesis-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(142, 169, 255, 0.44);
  background: rgba(142, 169, 255, 0.13);
}

.zar-research-synthesis-btn:disabled {
  cursor: default;
  opacity: 0.65;
  transform: none;
}

.zar-research-synthesis-btn.is-generating {
  position: relative;
  overflow: hidden;
}

.zar-research-synthesis-btn.is-generating::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.12),
    transparent
  );
  transform: translateX(-100%);
  animation: zarResearchSynthesisSweep 1.3s ease-in-out infinite;
}

@keyframes zarResearchSynthesisSweep {
  to {
    transform: translateX(100%);
  }
}