/* styles/references.css */
/* Mobile-first layout for the reference library */
:root {
  --ref-radius: 16px;
  --ref-gap: 12px;
  --ref-pad: 12px;
  --ref-border: 1px solid rgba(0, 0, 0, 0.08);
  --muted: #6b7280;
}

.library-container {
  padding: 12px;
  display: grid;
  gap: 16px;
}

.ref-accordion {
  border: none;
  margin: 0;
  background: transparent;
}

.ref-accordion > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 2px;
  font-weight: 600;
  font-size: 1.05rem;
}

.ref-accordion > summary::-webkit-details-marker {
  display: none;
}

.ref-accordion > summary:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.ref-accordion[open] > summary .ref-section-title::after {
  content: "−";
  margin-left: 8px;
  font-weight: 400;
  color: var(--muted);
}

.ref-accordion:not([open]) > summary .ref-section-title::after {
  content: "+";
  margin-left: 8px;
  font-weight: 400;
  color: var(--muted);
}

.ref-count {
  color: var(--muted);
  font-size: 0.9rem;
}

.ref-desc {
  margin: 0 0 8px 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.ref-list {
  display: grid;
  gap: var(--ref-gap);
  margin-top: 6px;
}

.ref-card {
  border: var(--ref-border);
  border-radius: var(--ref-radius);
  padding: var(--ref-pad);
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ref-row {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "title"
    "actions";
  row-gap: 10px;
  align-items: center;
}

.ref-title {
  grid-area: title;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 1rem;
  line-height: 1.3;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.ref-doc-title {
  font-weight: 600;
  min-width: 0;
}

.ref-title .chip {
  font-size: 0.75rem;
  line-height: 1.2;
}


.ref-actions {
  grid-area: actions;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.action-btn {
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f8fafc;
}

.action-btn.icon-only {
  gap: 0;
}

.action-btn:active {
  transform: translateY(0.5px);
}

.icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.ref-empty {
  margin: 4px 0 0;
  font-size: 0.95rem;
}

@media (min-width: 641px) {
  .library-container {
    padding: 16px 0;
  }

  .ref-row {
    column-gap: 12px;
  }

  .ref-doc-title {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
}

@supports (padding: max(0px)) {
  .bottom-nav {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}
