/* ==========================================================================
   Reference Panel Styles
   Extracted from reference.js injectStyles()
   ========================================================================== */

/* Search area layout */
.reference-search-area {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

#reference-search-input {
  flex: 1 1 200px;
  min-width: 180px;
}

#reference-collection-filter {
  flex: 0 1 180px;
}

/* Mode pill row */
.ref-mode-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.ref-control-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ref-pill-group {
  display: flex;
  gap: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.ref-pill {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  background-color: var(--surface);
  color: var(--text);
  border: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.ref-pill:not(:last-child) {
  border-right: 1px solid var(--border);
}

.ref-pill:hover {
  background-color: var(--surface-light);
}

.ref-pill.active {
  background-color: var(--accent);
  color: #fff;
}

.ref-count-label {
  margin-left: auto;
}

.ref-count-select {
  width: 4rem;
  padding: 0.35rem 0.4rem;
  font-size: 0.8rem;
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ref-search-btn {
  padding: 0.45rem 1.25rem;
  white-space: nowrap;
}

/* Loading / empty */
.ref-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.ref-spinner {
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ref-spin 0.7s linear infinite;
}

@keyframes ref-spin {
  to { transform: rotate(360deg); }
}

.ref-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Result cards */
.ref-result-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ref-result-card:hover {
  border-color: var(--border-light);
}

.ref-result-card.expanded {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(217, 119, 6, 0.08);
}

.ref-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.ref-card-title {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
  cursor: pointer;
  flex: 1;
}

.ref-card-title:hover {
  text-decoration: underline;
}

/* Score indicator */
.ref-score {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.ref-score-bar {
  width: 60px;
  height: 6px;
  background-color: var(--bg-dark);
  border-radius: 3px;
  overflow: hidden;
}

.ref-score-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--text-secondary));
  border-radius: 3px;
  transition: width 0.3s;
}

.ref-score-num {
  font-size: 0.7rem;
  color: var(--text-muted);
  min-width: 2rem;
  text-align: right;
}

/* Collection badge */
.ref-collection-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background-color: var(--surface-light);
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: capitalize;
}

/* Snippet */
.ref-card-snippet {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Card actions */
.ref-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.ref-card-actions .btn {
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
}

/* Expanded content area */
.ref-card-expand {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-light) var(--surface);
}

.ref-card-expand::-webkit-scrollbar {
  width: 6px;
}

.ref-card-expand::-webkit-scrollbar-track {
  background: var(--surface);
}

.ref-card-expand::-webkit-scrollbar-thumb {
  background: var(--surface-light);
  border-radius: 3px;
}

/* Document view */
.reference-document-view {
  padding: 0;
}

.ref-doc-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.ref-back-btn {
  flex-shrink: 0;
}

.ref-doc-title {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text);
}

.ref-doc-body {
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  padding-right: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-light) var(--surface);
}

.ref-doc-body::-webkit-scrollbar {
  width: 6px;
}

.ref-doc-body::-webkit-scrollbar-track {
  background: var(--surface);
}

.ref-doc-body::-webkit-scrollbar-thumb {
  background: var(--surface-light);
  border-radius: 3px;
}

/* Results container */
.reference-results {
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-light) var(--surface);
}

.reference-results::-webkit-scrollbar {
  width: 6px;
}

.reference-results::-webkit-scrollbar-track {
  background: var(--surface);
}

.reference-results::-webkit-scrollbar-thumb {
  background: var(--surface-light);
  border-radius: 3px;
}

/* Recently Shared section */
.ref-recently-shared {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.ref-shared-heading {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ref-shared-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ref-shared-item {
  padding: 0.3rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.ref-shared-item:last-child {
  border-bottom: none;
}

.ref-shared-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.ref-shared-link:hover {
  text-decoration: underline;
}

.ref-shared-by {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}
