/* ============================================================
   Journey / Timeline Section
   ============================================================ */

/* ---- Controls bar ---- */
.history-controls {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-date-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.history-date-filters .filter-btn {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border, #333);
  border-radius: 20px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}

.history-date-filters .filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.history-date-filters .filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 600;
}

.history-type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.history-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--border, #333);
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  background: var(--bg-subtle);
  color: var(--text-muted);
  transition: all 0.15s;
  user-select: none;
}

.history-type-chip:hover {
  border-color: var(--accent-dim);
  color: var(--text-primary, #fff);
}

.history-type-chip input[type="checkbox"] {
  width: 12px;
  height: 12px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---- Date group headers ---- */
.history-date-section {
  margin-bottom: 0.5rem;
}

.history-date-header {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 1rem 0 0.5rem;
  border-top: 1px solid var(--border, #2a2a2a);
  margin-top: 0.5rem;
}

.history-date-section:first-child .history-date-header {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

/* ---- Event cards ---- */
.history-event-card {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  background: var(--bg-surface);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
  transition: border-color 0.15s;
}

.history-event-card:hover {
  border-color: var(--accent-dim);
}

.history-event-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.history-event-content {
  flex: 1;
  min-width: 0;
}

.history-event-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin-bottom: 0.3rem;
}

.history-type-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
}

.history-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: auto;
}

.history-points {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
}

.history-points.positive {
  background: #4caf5018;
  color: #4caf50;
}

.history-points.negative {
  background: #f4433618;
  color: #f44336;
}

.history-verified {
  font-size: 0.75rem;
  color: #4caf50;
  font-weight: 600;
}

.history-pending {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.history-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
  color: var(--text-primary, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-body {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.4rem;
  line-height: 1.4;
}

/* ---- Photo thumbnail ---- */
.history-photo-wrap {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  margin: 0.5rem 0 0.4rem;
  transition: opacity 0.3s;
}

.history-photo-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid var(--border, #333);
  transition: border-color 0.15s, transform 0.15s;
}

.history-photo-thumb:hover {
  border-color: var(--accent);
  transform: scale(1.04);
}

.history-photo-remove {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border, #333);
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.history-photo-remove:hover {
  border-color: #f44336;
  color: #f44336;
}

/* ---- Dom note ---- */
.history-dom-note {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--accent);
  margin: 0.3rem 0 0.2rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--accent-dim);
  line-height: 1.4;
}

/* ---- Delete action ---- */
.history-actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
}

.history-delete-btn {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border, #333);
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.history-delete-btn:hover {
  border-color: #f44336;
  color: #f44336;
}

/* ---- Empty / loading states ---- */
#history-timeline-container .history-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---- Full-screen photo viewer ---- */
.history-photo-viewer {
  position: relative;
  background: var(--bg-surface);
  border-radius: 10px;
  overflow: hidden;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.history-photo-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border, #333);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-muted);
  line-height: 1;
  z-index: 1;
}

.history-photo-close:hover {
  color: var(--text-primary, #fff);
}

.history-photo-viewer img {
  max-width: 90vw;
  max-height: calc(90vh - 3rem);
  object-fit: contain;
  display: block;
  padding: 0.5rem;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .history-event-card {
    gap: 0.6rem;
    padding: 0.7rem 0.75rem;
  }

  .history-event-icon {
    width: 30px;
    height: 30px;
    font-size: 0.95rem;
  }

  .history-time {
    margin-left: 0;
  }

  .history-type-filters {
    gap: 0.3rem;
  }
}
