/* activity-feed.css
 *
 * Styles for the shared activity feed (js/activity-feed.js), used by both the
 * home column and the /activity page.
 *
 * Every colour comes from a theme.css custom property or has an explicit
 * [data-theme="dark"] override -- nothing here assumes a light background.
 */

/* ── Tabs ─────────────────────────────────────────────────────────── */
.af-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  overflow-x: auto;
}
.af-tab {
  background: none;
  border: none;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.35rem 0.8rem;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.af-tab:hover { color: var(--text-heading); background: var(--bg-hover); }
.af-tab.active {
  color: var(--blue);
  background: rgba(107, 184, 232, 0.1);
  font-weight: 700;
}

/* ── Controls (search + date range) ───────────────────────────────── */
.af-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.af-controls input[type="search"],
.af-controls select {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-heading);
}
.af-controls input[type="search"] { flex: 1; min-width: 160px; }
.af-controls input[type="search"]:focus,
.af-controls select:focus {
  outline: none;
  border-color: var(--border-input-focus);
}

/* ── Rows ─────────────────────────────────────────────────────────── */
.af-list { display: flex; flex-direction: column; }

.af-row {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.7rem 0.2rem;
  border-bottom: 1px solid var(--border-light);
}
.af-row:last-child { border-bottom: none; }

.af-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  /* Neutral default; per-category tints below. */
  background: var(--bg-hover);
  color: var(--text-secondary);
}
.af-icon iconify-icon { display: inline-flex; }

.af-body { flex: 1; min-width: 0; }

.af-title {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-heading);
  text-decoration: none;
  line-height: 1.35;
  /* Long client names must not push the timestamp off the row. */
  overflow-wrap: anywhere;
}
a.af-title:hover { color: var(--blue); text-decoration: underline; }

.af-detail,
.af-meta {
  font-size: 0.72rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.af-detail { color: var(--text-secondary); margin-top: 0.1rem; }
.af-meta   { color: var(--text-muted);     margin-top: 0.15rem; }

.af-time {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  padding-top: 0.15rem;
  white-space: nowrap;
}

/* ── Category tints ───────────────────────────────────────────────── */
.af-row[data-cat="people"]      .af-icon { background: rgba(168, 85, 247, 0.14); color: #7c3aed; }
.af-row[data-cat="recruitment"] .af-icon { background: rgba(217, 119, 6, 0.14);  color: #b45309; }
.af-row[data-cat="training"]    .af-icon { background: rgba(107, 184, 232, 0.16); color: #1d6fa5; }
.af-row[data-cat="customers"]   .af-icon { background: rgba(34, 197, 94, 0.14);  color: #047857; }
.af-row[data-cat="sales"]       .af-icon { background: rgba(20, 184, 166, 0.14); color: #0f766e; }
.af-row[data-cat="ops"]         .af-icon { background: rgba(100, 116, 139, 0.16); color: #475569; }

[data-theme="dark"] .af-row[data-cat="people"]      .af-icon { color: #c4a8fb; }
[data-theme="dark"] .af-row[data-cat="recruitment"] .af-icon { color: #fbbf24; }
[data-theme="dark"] .af-row[data-cat="training"]    .af-icon { color: #7dc4ee; }
[data-theme="dark"] .af-row[data-cat="customers"]   .af-icon { color: #4ade80; }
[data-theme="dark"] .af-row[data-cat="sales"]       .af-icon { color: #5eead4; }
[data-theme="dark"] .af-row[data-cat="ops"]         .af-icon { color: #cbd5e1; }

/* ── Rollup groups ────────────────────────────────────────────────── */
.af-group-toggle {
  background: none;
  border: none;
  padding: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-heading);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  text-align: left;
}
.af-group-toggle:hover { color: var(--blue); }

.af-chev {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.15s;
}
.af-group-toggle[aria-expanded="true"] .af-chev { transform: rotate(180deg); }

.af-sublist {
  margin-top: 0.4rem;
  padding-left: 0.7rem;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.af-sub {
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.af-sub a { color: var(--text-secondary); text-decoration: none; }
.af-sub a:hover { color: var(--blue); text-decoration: underline; }

/* ── Pagination ───────────────────────────────────────────────────── */
/* Mirrors the pager on hr/personnel-log.html so the two read as one system. */
.af-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.85rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  flex-wrap: wrap;
}
.af-pager-left,
.af-pager-right { display: flex; align-items: center; gap: 0.55rem; }

.af-pager-size {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}
.af-pager-size select {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.75rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border-input);
  border-radius: 7px;
  background: var(--bg-card);
  color: var(--text-heading);
}
.af-pager-size select:focus { outline: none; border-color: var(--border-input-focus); }

.af-pager-info { font-size: 0.75rem; color: var(--text-muted); }
.af-pager-info strong { color: var(--text); font-weight: 700; }
.af-pager-page { font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); }

.af-page-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}
.af-page-btn:hover:not(:disabled) { color: var(--blue); border-color: var(--blue); }
.af-page-btn:disabled { opacity: 0.45; cursor: default; }

/* Narrow columns (the home dashboard) and phones: stack the two halves
   rather than letting the pager squeeze into an unreadable single row. */
@media (max-width: 560px) {
  .af-pager { justify-content: center; }
  .af-pager-left,
  .af-pager-right { width: 100%; justify-content: center; }
}

/* ── Empty + loading ──────────────────────────────────────────────── */
.af-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 1rem;
  color: var(--text-muted);
  text-align: center;
}
.af-empty iconify-icon { font-size: 26px; opacity: 0.5; }
.af-empty p { margin: 0; font-size: 0.8rem; }

.af-skeleton { pointer-events: none; }
.af-skeleton .af-icon { background: var(--bg-hover); }
.af-sk-line {
  display: block;
  height: 9px;
  border-radius: 4px;
  background: var(--bg-hover);
  margin-bottom: 0.35rem;
}
.af-sk-line:not(.af-sk-short) { width: 72%; }
.af-sk-short { width: 40%; }

.af-skeleton .af-icon,
.af-sk-line { animation: af-pulse 1.4s ease-in-out infinite; }

@keyframes af-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .af-skeleton .af-icon,
  .af-sk-line { animation: none; }
  .af-chev { transition: none; }
}

/* ── Mobile ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .af-row { gap: 0.55rem; padding: 0.6rem 0; }
  .af-icon { width: 24px; height: 24px; font-size: 14px; }
  .af-title { font-size: 0.8rem; }
  .af-tabs { gap: 0.2rem; }
  .af-tab { font-size: 0.72rem; padding: 0.3rem 0.6rem; }
}

/* ── Date filter ───────────────────────────────────────────────────
   Deliberately small: a text button that sits inline in a header row
   alongside things like "View all activity", not a calendar widget. The
   popover uses a native <input type="date"> so the OS provides the calendar. */
.af-datefilter { position: relative; display: inline-flex; }

.af-df-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  padding: 0.2rem 0.35rem;
  border-radius: 6px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.af-df-btn:hover { color: var(--blue); background: var(--bg-hover); }
.af-df-btn iconify-icon { font-size: 13px; }
.af-df-btn[aria-expanded="true"] { color: var(--blue); background: var(--bg-hover); }

.af-df-pop {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 40;
  min-width: 168px;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
[data-theme="dark"] .af-df-pop { box-shadow: 0 8px 24px rgba(0,0,0,0.45); }
.af-df-pop[hidden] { display: none; }

.af-df-opt {
  text-align: left;
  background: none;
  border: none;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}
.af-df-opt:hover { background: var(--bg-hover); color: var(--blue); }

.af-df-pick {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.25rem;
  padding: 0.4rem 0.5rem 0.2rem;
  border-top: 1px solid var(--border);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.af-df-input {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.76rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-heading);
}
.af-df-input:focus { outline: none; border-color: var(--border-input-focus); }

/* The popover would otherwise hang off the right edge on a narrow screen. */
@media (max-width: 480px) {
  .af-df-pop { right: auto; left: 0; }
}
