/*
  V2 UI overlay (Papers + Rating v2 + Tasks v2)
  This stylesheet is intentionally scoped with .v2* classes and #*-v2 ids
  to avoid affecting existing screens.
*/

/* Generic chips / tabs */
.v2tabs{ display:flex; gap:8px; flex-wrap:wrap; }
.v2chip{
  border:1px solid var(--border, rgba(0,0,0,0.12));
  background: transparent;
  color: inherit;
  padding:6px 10px;
  border-radius:999px;
  cursor:pointer;
  font-weight:700;
  font-size:12px;
}
.v2chip.active{ background: rgba(99,102,241,0.14); border-color: rgba(99,102,241,0.35); }
.v2chip:disabled{ opacity:0.6; cursor:not-allowed; }

/* Details blocks */
.v2details{ border:1px solid var(--border, rgba(0,0,0,0.12)); border-radius:12px; padding:10px 12px; background: rgba(0,0,0,0.02); }
[data-theme="dark"] .v2details{ background: rgba(255,255,255,0.03); }
.v2details summary{ cursor:pointer; user-select:none; list-style:none; }
.v2details summary::-webkit-details-marker{ display:none; }
.v2details__summary{ display:flex; justify-content:space-between; align-items:center; gap:12px; }
.v2details__title{ font-weight:900; }
.v2details__sub{ font-size:12px; }

/* Papers */
#papersV2Details .papersV2Photo,
#papersV2DetailsModal .papersV2Photo{
  width:100%;
  max-height:360px;
  object-fit:contain;
  border-radius:12px;
  border:1px solid var(--border, rgba(0,0,0,0.12));
  background: rgba(0,0,0,0.03);
}

.papersV2AttachList{ display:flex; flex-direction:column; gap:8px; }
.papersV2AttachItem{ display:flex; justify-content:space-between; align-items:center; gap:10px; padding:8px 10px; border:1px solid var(--border, rgba(0,0,0,0.12)); border-radius:10px; background: rgba(255,255,255,0.6); }
[data-theme="dark"] .papersV2AttachItem{ background: rgba(0,0,0,0.18); }
.papersV2AttachLeft{ display:flex; flex-direction:column; gap:2px; min-width:0; flex:1; }
.papersV2AttachName{ font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.papersV2AttachMeta{ font-size:12px; }

.papersV2AttachThumbWrap{
  width:56px;
  height:56px;
  flex:0 0 auto;
  border-radius:10px;
  overflow:hidden;
  border:1px solid var(--border, rgba(0,0,0,0.12));
  background: rgba(0,0,0,0.03);
  display:flex;
  align-items:center;
  justify-content:center;
}

/* Sidebar badge (red circle counter) */
.navbtn__badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  margin-left: 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  background: var(--danger);
  color: #fff;
}
[data-theme="dark"] .papersV2AttachThumbWrap{ background: rgba(255,255,255,0.04); }

.papersV2AttachThumb{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.papersV2AttachIcon{
  font-size:22px;
  line-height:1;
}

/* Papers: processing state badge */
.pv2Proc{ display:flex; flex-direction:column; gap:2px; }
.pv2ProcBadge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:4px 8px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  border:1px solid var(--border, rgba(0,0,0,0.12));
  background: rgba(0,0,0,0.03);
}
[data-theme="dark"] .pv2ProcBadge{ background: rgba(255,255,255,0.04); }
.pv2ProcSub{ font-size:11px; line-height:1.2; }

.pv2ProcBadge.pv2Proc--new{ background: rgba(0,0,0,0.03); }
.pv2ProcBadge.pv2Proc--work{ background: rgba(245,158,11,0.14); border-color: rgba(245,158,11,0.35); }
.pv2ProcBadge.pv2Proc--done{ background: rgba(16,185,129,0.14); border-color: rgba(16,185,129,0.35); }
[data-theme="dark"] .pv2ProcBadge.pv2Proc--work{ background: rgba(245,158,11,0.18); }
[data-theme="dark"] .pv2ProcBadge.pv2Proc--done{ background: rgba(16,185,129,0.18); }


.papersV2Preview{ width:100%; max-height:220px; object-fit:contain; border-radius:12px; border:1px dashed var(--border, rgba(0,0,0,0.24)); background: rgba(0,0,0,0.03); }

/* Tasks v2 */
#tasksV2ListCard .table td{ vertical-align:top; }
.tasksV2Title{ font-weight:900; }
.tasksV2Meta{ font-size:12px; }
.tasksV2Actions{ display:flex; gap:6px; justify-content:flex-end; flex-wrap:wrap; }

/* Rating v2 */
.ratingV2Toolbar{ display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; }
.ratingV2PeriodRow{ display:flex; align-items:center; gap:6px; flex-wrap:nowrap; }
.ratingV2PeriodRow .muted{ white-space:nowrap; }
.ratingV2PeriodRow .input{ width:150px; min-width:140px; max-width:170px; }
.ratingV2PeriodRow .btn{ white-space:nowrap; }
@media (max-width: 820px){
  .ratingV2PeriodRow{ flex-wrap:wrap; }
  .ratingV2PeriodRow .input{ width:100%; min-width:0; max-width:100%; }
}
.ratingV2Grid{ display:flex; flex-direction:column; gap:12px; }
.ratingV2Metrics{ display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.ratingV2Metrics .metriccard{ min-width:130px; }

.ratingV2TableCompact td, .ratingV2TableCompact th{ font-size:12px; }
.ratingV2TableCompact .link{ font-weight:800; }

/* Modal tweaks */
.v2modalKpis{ display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:10px; }
@media (max-width: 760px){
  .v2modalKpis{ grid-template-columns: 1fr; }
}
.v2kpi{ padding:10px 12px; border:1px solid var(--border, rgba(0,0,0,0.12)); border-radius:12px; background: rgba(0,0,0,0.02); }
[data-theme="dark"] .v2kpi{ background: rgba(255,255,255,0.03); }
.v2kpi__label{ font-size:12px; }
.v2kpi__value{ font-size:22px; font-weight:900; margin-top:4px; }
.v2kpi__hint{ margin-top:6px; font-size:11px; }
.v2kpi--action{
  appearance:none;
  width:100%;
  text-align:left;
  color:inherit;
  font:inherit;
  cursor:pointer;
  transition:border-color .16s ease, box-shadow .16s ease, transform .16s ease, background .16s ease;
}
.v2kpi--action:hover,
.v2kpi--action:focus-visible{
  border-color:rgba(55,111,208,.65);
  box-shadow:0 0 0 3px rgba(55,111,208,.12);
  background:rgba(55,111,208,.05);
}
.v2kpi--action:active{
  transform:translateY(1px);
}
