/* =============================================================================
   Adventures — Sidebar Nav + Scoped Entity Sections
   ============================================================================= */

/* Adventure sidebar nav — mirrors .campaign-nav */
.adventure-nav {
  background: var(--bg-primary);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border-primary);
}

.adventure-nav .nav-header {
  border-bottom: 2px solid var(--accent-red);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.adventure-nav h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.1rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adventure-nav .nav-status {
  margin-top: 0.25rem;
}

.adventure-nav .nav-status .badge {
  font-size: 0.6rem;
  padding: 0.15rem 0.35rem;
}

.adventure-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.adventure-nav li {
  margin-bottom: 0.25rem;
}

.adventure-nav li.nav-divider {
  margin: 0.75rem 0;
  border-top: 1px solid var(--border-primary);
}

.adventure-nav a {
  display: block;
  padding: 0.6rem 1rem;
  text-decoration: none;
  color: var(--text-secondary);
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
  font-size: 0.9rem;
}

.adventure-nav a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.adventure-nav a.active {
  background: var(--accent-red);
  color: #ffffff;
  font-weight: 500;
}

/* =============================================================================
   Scoped Entity Sections — adventure vs campaign bordered lists
   ============================================================================= */

.scope-section {
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}

.scope-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.scope-section .section-header h3 {
  margin: 0;
  font-size: 1rem;
}

/* Adventure-scoped — normal emphasis */
.scope-section.adventure {
  border-color: var(--accent-red);
}

.scope-section.adventure .section-header h3 {
  color: var(--text-primary);
}

/* Campaign-scoped — subdued/inherited */
.scope-section.campaign {
  border-color: var(--border-primary);
  background: var(--bg-secondary);
}

.scope-section.campaign .section-header h3 {
  color: var(--text-muted);
}

.scope-section.campaign .admin-table tbody td {
  color: var(--text-secondary);
}

.scope-section.campaign .admin-table tbody a {
  color: var(--text-secondary);
}

/* Scope badge — small inline label on entity rows */
.scope-badge {
  display: inline-block;
  font-size: 0.6rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.scope-badge.adventure {
  background: var(--accent-red-bg);
  color: var(--accent-red);
}

.scope-badge.campaign {
  background: var(--info-bg);
  color: var(--info);
}

.scope-badge.encounter {
  background: var(--warning-bg);
  color: var(--warning);
}

/* Inherited label */
.inherited-label {
  font-size: 0.8rem;
  color: var(--text-disabled);
  margin-bottom: 0.75rem;
}

/* ============================================================
   Browse Standalone Adventures
   ============================================================ */

.adventures-browse-page .page-header {
  margin-bottom: 1.5rem;
}

.adventures-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.adventure-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 1rem;
  transition: border-color 0.15s;
}

.adventure-card:hover {
  border-color: var(--accent-red);
}

.adventure-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.adventure-card-name {
  font-size: 1.1rem;
  margin: 0;
}

.adventure-card-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
  line-height: 1.4;
}

.adventure-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.adventure-card-system {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.adventure-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.adventure-card-actions {
  display: flex;
  gap: 0.5rem;
}

/* Adventure progress badges */
.adventure-progress {
  margin: 0.5rem 0;
}

.adventure-progress-partial {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.adventure-progress-complete {
  background: rgba(74, 222, 128, 0.3);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.5);
}

/* ============================================================
   Adventure Detail Page
   ============================================================ */

.adventure-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.adventure-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.adventure-description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.adventure-entity-section {
  margin-bottom: 1rem;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  overflow: hidden;
}

.adventure-entity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  cursor: pointer;
  user-select: none;
}

.adventure-entity-header h3 {
  margin: 0;
  font-size: 1rem;
}

.adventure-entity-list {
  padding: 0.5rem;
}

.adventure-entity-card {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-primary);
}

.adventure-entity-card:last-child {
  border-bottom: none;
}

.adventure-entity-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.adventure-entity-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0 0 0.25rem;
  line-height: 1.4;
}

.adventure-entity-notes {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  margin-top: 0.25rem;
}

.adventure-entity-read-aloud {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(96, 165, 250, 0.08);
  border-left: 3px solid var(--info);
  padding: 0.4rem 0.6rem;
  border-radius: 0 4px 4px 0;
  margin-top: 0.25rem;
}

.notes-label {
  font-weight: 600;
  color: var(--warning);
}

/* Current adventure highlight */
.adventure-current {
  border-color: var(--warning);
  border-width: 2px;
}

/* Star toggle for pinning current adventure */
.star-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  color: var(--warning);
  padding: 0;
  line-height: 1;
  transition: transform 0.15s;
}

.star-toggle:hover {
  transform: scale(1.2);
}

/* Campaign adventures page */
.campaign-adventures-page .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

/* Attach to campaign */
.adventure-attach-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
}

.adventure-attach-section h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.adventure-campaign-select {
  width: 100%;
  max-width: 400px;
  padding: 0.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
  border-radius: 4px;
}

/* Campaign adventures section */
.campaign-adventures-section {
  margin: 1rem 0;
}

.campaign-adventures-section h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.adventure-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.5rem;
}

.adventure-list li {
  display: flex;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-primary);
}

.adventure-list li:last-child {
  border-bottom: none;
}

/* Entity CRUD forms within adventure sections */
.adventure-entity-list .section-panel {
  background: var(--bg-primary);
  margin: 0.5rem;
  padding: 1rem;
}

.adventure-entity-list .section-panel .form-field {
  margin-bottom: 0.5rem;
}

.adventure-entity-list .detail-actions {
  padding-top: 0.5rem;
}

.adventure-entity-card .detail-actions {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-primary);
}

/* Collapse icon next to add button */
.adventure-entity-header .collapse-icon {
  font-size: 1.2rem;
  color: var(--text-muted);
  min-width: 1rem;
  text-align: center;
}

/* =============================================================================
   Entity Ref Picker
   ============================================================================= */

.ref-picker {
  margin: 0.5rem 0;
  border-left: 3px solid rgba(96, 165, 250, 0.4);
}

.ref-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.ref-picker-header h4 {
  margin: 0;
  font-size: 0.95rem;
}

.ref-picker-type-select {
  margin-bottom: 0.5rem;
}

.ref-picker-type-select select {
  width: 100%;
  max-width: 250px;
  padding: 0.4rem 0.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
  border-radius: 4px;
  font-size: 0.85rem;
}

.ref-picker-linked h5,
.ref-picker-available h5 {
  margin: 0.5rem 0 0.25rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.ref-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border-primary);
  font-size: 0.9rem;
}

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

.ref-picker-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 0.5rem;
}

/* Entity refs display on cards */
.adventure-entity-refs {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.adventure-entity-refs .notes-label {
  font-size: 0.8rem;
  margin-right: 0.25rem;
}

.adventure-entity-refs .badge.small {
  font-size: 0.7rem;
}

/* Read-aloud text */
.adventure-entity-read-aloud {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  margin-top: 0.25rem;
  border-left: 2px solid var(--info);
}

@media (max-width: 480px) {
  .adventures-grid {
    grid-template-columns: 1fr;
  }

  .adventure-detail-header {
    flex-direction: column;
    gap: 0.5rem;
  }
}
