/* ========================
   COORDINATION TIMELINE — "This Week"
   Week-grid layout. Role colors from existing palette:
     Coordinator → --plum (#5C3A6E)
     Family Member → --gold (#F2B233)
     Support Provider → --teal (#1A6B7A)
     Information Seeker → --olive (#8B9A4A)
   ======================== */

/* ---- ROLE FILTER CHIPS ---- */

.proto-tl-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.proto-tl-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--cream-dk);
  background: var(--white);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.proto-tl-filter:hover {
  border-color: var(--filter-color, var(--plum));
  color: var(--filter-color, var(--plum));
  background: color-mix(in srgb, var(--filter-color, var(--plum)) 6%, var(--white));
}

.proto-tl-filter.active {
  background: var(--filter-color, var(--plum));
  border-color: var(--filter-color, var(--plum));
  color: white;
}

/* "All roles" active uses plum */
.proto-tl-filter[data-role="all"].active {
  background: var(--plum);
  border-color: var(--plum);
}

/* Family active — dark text for legibility on gold */
.proto-tl-filter[data-role="family"].active {
  color: var(--text);
}

.proto-tl-filter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- TIMELINE CARD ---- */

.proto-tl-card {
  overflow: visible; /* tooltip can overflow */
}

/* ---- DESKTOP WEEK GRID ---- */

.proto-tl-grid {
  overflow-x: auto;
  padding-bottom: 4px;
}

.proto-tl-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--cream);
  padding: 0 16px;
}

.proto-tl-day-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 6px 10px;
  gap: 2px;
  position: relative;
}

.proto-tl-day-header.today {
  background: rgba(92,58,110,0.04);
}

.proto-tl-day-name {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
}

.proto-tl-day-date {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
}

.proto-tl-day-header.today .proto-tl-day-name,
.proto-tl-day-header.today .proto-tl-day-date {
  color: var(--plum);
}

.proto-tl-today-badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  background: var(--plum);
  color: white;
  border-radius: var(--r-pill);
  margin-top: 2px;
}

/* Event lanes */
.proto-tl-lanes {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 12px 16px;
  gap: 6px;
  min-height: 120px;
}

.proto-tl-lane {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 60px;
  padding: 4px 2px;
  border-radius: var(--r-sm);
  transition: background 0.2s;
}

.proto-tl-lane.today {
  background: rgba(92,58,110,0.03);
}

/* Event chips */
@keyframes tl-chip-in {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.proto-tl-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  font-size: 0.72rem;
  font-weight: 600;
  color: white;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.15s;
  animation: tl-chip-in 0.38s ease both;
  white-space: nowrap;
}

/* Family chip — dark text because gold background */
.proto-tl-chip[data-role="family"] { color: var(--text); }

.proto-tl-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(242,178,51,0.45), var(--sh-sm);
  z-index: 5;
}

/* Active/focused amber glow consistent with existing micro-interactions */
.proto-tl-chip:focus,
.proto-tl-chip.tl-active {
  outline: none;
  box-shadow: 0 0 0 4px rgba(242,178,51,0.5), var(--sh-md);
}

.proto-tl-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.proto-tl-chip-time {
  font-size: 0.62rem;
  opacity: 0.82;
  font-weight: 500;
  flex-shrink: 0;
}

/* Faded chips when a role filter is active and this role is hidden */
.proto-tl-chip.tl-faded {
  opacity: 0.18;
  pointer-events: none;
}

/* ---- LEGEND ---- */

.proto-tl-legend {
  display: flex;
  gap: 18px;
  padding: 12px 18px;
  border-top: 1px solid var(--cream);
  flex-wrap: wrap;
}

.proto-tl-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-2);
}

.proto-tl-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- TOOLTIP ---- */

.proto-tl-tooltip {
  position: fixed;
  background: var(--text);
  color: white;
  border-radius: var(--r-md);
  padding: 12px 16px;
  min-width: 190px;
  max-width: 260px;
  z-index: 800;
  box-shadow: var(--sh-lg);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.proto-tl-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.proto-tl-tooltip-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--gold);
  line-height: 1.3;
}

.proto-tl-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.proto-tl-tooltip-label {
  color: rgba(255,255,255,0.55);
  flex-shrink: 0;
}

.proto-tl-tooltip-val {
  font-weight: 500;
  text-align: right;
}

/* ---- MOBILE: vertical day stack ---- */

.proto-tl-mobile {
  display: none;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
}

.proto-tl-mobile-day-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--cream);
  margin-bottom: 6px;
}

.proto-tl-mobile-day-label.today {
  color: var(--plum);
}

.proto-tl-mobile-events {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.proto-tl-mobile-events .proto-tl-chip {
  animation: none;
}

.proto-tl-mobile-events:empty::after {
  content: 'Nothing scheduled';
  font-size: 0.75rem;
  color: var(--text-3);
  font-style: italic;
}

/* ---- RESPONSIVE ---- */

/* Below 900px: collapse to mobile vertical list */
@media (max-width: 900px) {
  .proto-tl-grid { display: none; }
  .proto-tl-mobile { display: flex; }
}

@media (max-width: 600px) {
  .proto-tl-filters { gap: 5px; }
  .proto-tl-filter  { font-size: 0.75rem; padding: 5px 10px; }
}
