/* ─── Timeline Component — Universal Activity Timeline ────────────────────────
   Roadmap 2 Milestone 2
   Used by: Property HQ (first), Transaction HQ, Contact HQ, CEO HQ (future)
   Rules:
   - CSS variables only. Zero hardcoded colors.
   - Any HQ that hosts a timeline gets identical visual treatment.
   - All values use existing variables from :root (css/styles.css).
   ──────────────────────────────────────────────────────────────────────────── */

/* ── Container ───────────────────────────────────────────────────────────────*/
.tl-container {
  display: flex;
  flex-direction: column;
  min-height: 200px;
  padding-bottom: 32px;
}

/* ── Header (+ Log Activity button row) ──────────────────────────────────────*/
.tl-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 16px 20px 12px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.tl-btn-add {
  background: var(--gold);
  color: #fff; /* white on colored background — matches styles.css button convention */
  border: none;
  border-radius: var(--radius);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.tl-btn-add:hover { opacity: 0.85; }

/* ── Log Activity inline form ────────────────────────────────────────────────*/
.tl-add-form {
  display: none;           /* toggled to flex by JS */
  flex-direction: column;
  gap: 10px;
  margin: 12px 20px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.tl-form-row {
  display: flex;
  flex-direction: column;
}

.tl-form-select,
.tl-form-input,
.tl-form-textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.tl-form-select:focus,
.tl-form-input:focus,
.tl-form-textarea:focus {
  outline: none;
  border-color: var(--gold);
}
.tl-form-textarea {
  resize: vertical;
  min-height: 64px;
  line-height: 1.4;
}
.tl-input-error {
  border-color: var(--red) !important;
}

.tl-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}
.tl-btn-save {
  background: var(--gold);
  color: #fff; /* white on colored background — matches styles.css button convention */
  border: none;
  border-radius: var(--radius);
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.tl-btn-cancel {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tl-btn-save:hover   { opacity: 0.85; }
.tl-btn-cancel:hover { color: var(--text); border-color: var(--text-3); }

/* ── Date group ──────────────────────────────────────────────────────────────*/
.tl-group {
  display: flex;
  flex-direction: column;
  margin-top: 12px;
}

.tl-group-label {
  padding: 8px 20px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  position: relative;
}
.tl-group-label::after {
  content: '';
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 0;
  height: 1px;
  background: var(--border);
}

/* ── Activity card ───────────────────────────────────────────────────────────*/
.tl-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  overflow: hidden;
  margin: 8px 20px 0;
  padding: 12px 14px 12px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s;
}
.tl-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* Left color accent bar — color set inline via style="background:var(--gold)" etc. */
.tl-card-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

/* Activity type icon */
.tl-card-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Right content column */
.tl-card-content {
  flex: 1;
  min-width: 0;
}

/* Meta row: type label · time · author */
.tl-card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
  flex-wrap: wrap;
}
.tl-card-type {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  /* color set inline via style="color:var(--gold)" etc. */
}
.tl-card-time {
  font-size: 11px;
  color: var(--text-3);
}
.tl-card-time::before { content: '·'; margin-right: 3px; color: var(--text-3); }

.tl-card-author {
  font-size: 11px;
  color: var(--text-3);
}
.tl-card-author::before { content: '·'; margin-right: 3px; color: var(--text-3); }

.tl-card-source {
  font-size: 10px;
  color: var(--text-3);
  background: var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 2px;
  letter-spacing: 0.02em;
}

/* Title */
.tl-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

/* Optional detail body */
.tl-card-body {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 4px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Form labels (Brief Description / Notes) ─────────────────────────────────*/
.tl-form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
  letter-spacing: 0.03em;
}
.tl-form-required {
  color: var(--danger, #dc2626);
  margin-left: 2px;
}
.tl-form-optional {
  font-weight: 400;
  color: var(--text-3);
}

/* ── Card action buttons (edit / delete — manual activities only) ─────────────*/
.tl-card-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
  align-self: center;
}
.tl-card:hover .tl-card-actions {
  opacity: 1;
}
.tl-card-btn-edit,
.tl-card-btn-delete {
  background: transparent;
  border: none;
  padding: 3px 5px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  color: var(--text-3);
  transition: background 0.1s, color 0.1s;
}
.tl-card-btn-edit:hover  { background: var(--surface); color: var(--text); }
.tl-card-btn-delete:hover { background: var(--surface); color: var(--danger, #dc2626); }

/* ── Empty state ─────────────────────────────────────────────────────────────*/
.tl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 20px;
  text-align: center;
  gap: 8px;
}
.tl-empty-icon {
  font-size: 40px;
  opacity: 0.35;
  margin-bottom: 4px;
}
.tl-empty-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-2);
}
.tl-empty-sub {
  font-size: 13px;
  color: var(--text-3);
}
