/* ==========================================================================
   References (Display)
   ========================================================================== */

/* ==========================================================================
   Promoted Reference Sections (main content area)
   ========================================================================== */

.promoted-ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

/* Member card — name full-width, then avatar + details below */
.member-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-sm);
  background: var(--parchment-100);
  border: 1px solid var(--parchment-400);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.member-card:hover {
  border-color: var(--campaign-primary-color, var(--parchment-600));
  box-shadow: var(--shadow-sm);
}

.member-card-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 var(--space-xs) 0;
  line-height: 1.2;
}

.member-card-body {
  display: flex;
  gap: var(--space-sm);
}

.member-card-avatar {
  flex-shrink: 0;
}

.member-card-avatar .hub-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  object-fit: cover;
}

.member-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}

.member-card-playbook {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--campaign-primary-color, var(--text-muted));
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.member-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   Reference Tag Component (Base Styles)
   ========================================================================== */

/* Container for multiple reference tags */
.reference-tags {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);  /* Tighter within section */
  margin-top: var(--space-xs);
}

/* Individual reference tag card */
.reference-tag {
  position: relative; /* For absolute positioned × button */
  background-color: var(--parchment-300);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  border-left-width: 3px;
  border-left-style: solid;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base) ease;
}

.reference-tag:hover {
  background-color: var(--parchment-400);
  box-shadow: var(--shadow-md);
}

/* Entrance animation for newly auto-created references.
   Slides in, glows with accent highlight, then fades to normal. */
.reference-tag-new {
  animation: reference-appear 1.2s ease-out;
}

@keyframes reference-appear {
  0% {
    opacity: 0;
    transform: translateY(-0.5rem);
    background-color: var(--parchment-50);
    box-shadow: 0 0 10px var(--parchment-400);
  }
  30% {
    opacity: 1;
    transform: translateY(0);
    background-color: var(--parchment-50);
    box-shadow: 0 0 10px var(--parchment-400);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    background-color: var(--parchment-300);
    box-shadow: var(--shadow-sm);
  }
}

.reference-tag-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.reference-tag-header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.reference-tag-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.reference-icon-image {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
  fill: currentcolor;
}

.reference-tag-name {
  font-family: var(--font-heading);
  color: var(--grey-700);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
}

.reference-tag-name a {
  color: inherit;
  transition: color 0.2s;
}

.reference-tag-name a:hover {
  color: var(--accent-color, var(--color-link));
  text-decoration: underline;
}

.reference-tag-note {
  color: var(--warm-grey);
  font-size: 0.9rem;
  font-style: italic;
}

.reference-note-container {
  margin-left: calc(1.25rem + var(--space-xs));
}

/* Editable reference note in display mode */
.reference-tag .reference-note-display {
  padding: var(--space-2xs);
  border-radius: var(--radius-sm);
  cursor: text;
  transition: background-color var(--transition-base) ease;
}

.reference-tag .reference-note-display:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.reference-tag .reference-note-text {
  display: block;
}

.reference-tag .reference-note-placeholder {
  color: var(--warm-grey-light);
  font-style: normal;
}

/* Remove/delete button (× in top-right corner) */
.reference-remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.2s ease, transform var(--transition-base) ease;
}

.reference-remove:hover {
  opacity: 1;
  transform: scale(1.2);
}

/* Note input (replaces display when editing) */
.reference-note-input {
  /* Base input styling (matches forms.css .text-input pattern) */
  width: 100%;
  padding: 0.5rem;
  border: 2px solid var(--input-border-color, var(--warm-grey));
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  background-color: var(--input-bg-color, var(--parchment-light));
  color: var(--warm-grey-dark);

  /* Reference-specific */
  margin-top: var(--space-2xs);
}

.reference-note-input:focus {
  outline: none;
  border-color: var(--input-border-focus-color, var(--warm-grey-dark));
  background-color: var(--input-bg-focus-color, white);
}

/* Reference type display/edit */
.reference-type-container {
  margin-left: calc(1.25rem + var(--space-xs));
  margin-top: var(--space-2xs);
  margin-bottom: var(--space-2xs);
}

.reference-type-display {
  display: inline-block;
  padding: 0.125rem 0.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-base) ease;
}

.reference-type-display:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.reference-type-label {
  font-size: 0.8125rem;
  font-style: italic;
  color: var(--warm-grey);
  line-height: 1.3;
}

/* Reference type select (replaces display when editing) */
.reference-type-select {
  padding: 0.375rem 0.5rem;
  border: 2px solid var(--input-border-color, var(--warm-grey));
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-style: italic;
  background-color: var(--input-bg-color, var(--parchment-light));
  color: var(--warm-grey-dark);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color var(--transition-base) ease;
}

.reference-type-select:focus {
  outline: none;
  border-color: var(--input-border-focus-color, var(--warm-grey-dark));
  background-color: var(--input-bg-focus-color, white);
}

/* ==========================================================================
   Reference Layouts
   ========================================================================== */

/* Reference Edit Layout - Side by Side */
.reference-edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.reference-edit-main {
  min-width: 0; /* Prevents grid overflow */
}

.reference-edit-sidebar {
  position: sticky;
  top: var(--space-md);
  height: fit-content;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

/* Resource Show Page Two-Column Layout */
.resource-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--space-xl);
  margin-top: var(--space-lg);
}

.resource-main {
  min-width: 0; /* Prevents grid overflow */
}

.resource-main .content-section:first-child h2 {
  margin-top: 0;
}

.resource-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.resource-sidebar .content-section {
  margin-bottom: 0;
  padding-top: var(--space-xl);  /* More space between sections */
  border-top: 1px solid var(--parchment-400);  /* Visual separator */
}

.resource-sidebar .content-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.resource-sidebar h3 {
  /* Section label style - smaller, lighter, acts as category marker */
  margin-top: 0;
  margin-bottom: var(--space-xs);  /* Tighter to content below */
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-500);  /* Muted - not competing with card titles */
}

/* Responsive Layout */
@media (max-width: 1024px) /* wide */ {
  .reference-edit-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .reference-edit-sidebar {
    position: static;
    max-height: none;
  }

  .resource-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) /* tablet */ {
  .reference-tags {
    gap: var(--space-xs);  /* Tighter spacing */
  }

  .reference-tag {
    padding: var(--space-sm);  /* Slightly less padding */
  }
}
