/* The dashboard is the one page in the app allowed to run wider than
   .content-shell's ordinary 1080px — it's the site's landing page, and a
   musician juggling several groups needs room for a real schedule +
   calendar side by side (see UserSchedule). */

/* The one new color this file adds to the app's palette — Rehearsal
   events reuse the existing --primary blue, Concert events get this
   purple accent so the two kinds are always visually distinguishable
   (schedule list, conflict panel, calendar dots). */
:root {
  --concert-bg: #ede9fe;
  --concert-text: #6d28d9;
  --concert-dot: #7c3aed;
}

.dashboard-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.3fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.dashboard-main,
.dashboard-aside {
  display: grid;
  gap: 1.5rem;
  min-width: 0;
}

@media (max-width: 960px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
}

/* Profile summary — a compact, single-row identity strip, distinct from
   shared/_profile_header (which is bio/social-link-heavy and built for a
   full profile page, not a dashboard's own top strip). */
.profile-summary-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.profile-summary-card__details {
  flex: 1 1 auto;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.profile-summary-card__name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.profile-summary-card__name-row h1 {
  margin: 0;
  font-size: 1.5rem;
}

.profile-summary-card__name-row .secondary-link {
  width: auto;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.profile-summary-card__role {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

/* At-a-glance row */
.glance-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.glance-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.glance-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.glance-card--alert {
  background: var(--danger-bg);
  border-color: transparent;
}

.glance-card__icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  background: var(--secondary);
  color: var(--secondary-text);
}

.glance-card--rehearsal .glance-card__icon {
  background: #dbeafe;
  color: var(--primary-dark);
}

.glance-card--concert .glance-card__icon {
  background: #ede9fe;
  color: var(--concert-text);
}

.glance-card--alert .glance-card__icon {
  background: #fecaca;
  color: var(--danger-text);
}

.glance-card__label {
  margin: 0 0 0.15rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.glance-card--alert .glance-card__label {
  color: var(--danger-text);
}

.glance-card__headline {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
}

.glance-card__meta {
  margin: 0.1rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Event kind pill + dot, shared by the schedule list, conflict panel,
   and calendar legend. */
.event-kind-pill {
  display: inline-flex;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.event-kind-pill--rehearsal {
  background: #dbeafe;
  color: var(--primary-dark);
}

.event-kind-pill--concert {
  background: var(--concert-bg);
  color: var(--concert-text);
}

.event-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.event-dot--rehearsal {
  background: var(--primary);
}

.event-dot--concert {
  background: var(--concert-dot);
}

/* Marks the At a Glance row's Next Rehearsal/Next Concert card when
   that event.date is today — sits inline right after the date inside
   .glance-card__headline (see _at_a_glance.html.erb). */
.today-pill {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--success-bg);
  color: var(--success-text);
  white-space: nowrap;
}

/* Upcoming schedule */
.schedule-card {
  padding: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.schedule-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.schedule-card__header h2 {
  margin: 0;
}

.schedule-filter-tabs {
  display: flex;
  gap: 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.schedule-filter-tabs button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.5rem 0.1rem;
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.schedule-filter-tabs button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.schedule-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

/* schedule_filter_controller.js toggles the `hidden` attribute to filter
   rows — but .schedule-row's own `display: flex` above is an
   author-origin rule, which otherwise outranks `[hidden]`'s
   user-agent-origin `display: none` regardless of selector specificity
   (see application.css's own [data-edit-mode-target="control"][hidden]
   for the same fix, same reasoning). Without this, `hidden` is set on
   the element but nothing actually disappears. */
.schedule-row[hidden] {
  display: none !important;
}

.schedule-row:last-child {
  border-bottom: none;
}

/* Same red as .conflict-panel/.conflict-row and .mini-calendar__day--conflict
   (var(--danger-bg)) — a row whose event is party to a real conflict
   (UserSchedule#conflicted_events) reuses that exact shade so all three
   read as the same signal. Horizontal padding + a matching negative
   margin bleed the highlight out to .schedule-card's own edges (the
   plain .schedule-row above has no horizontal padding at all) without
   disturbing the other rows' alignment. */
.schedule-row--conflict {
  background: var(--danger-bg);
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  margin: 0 -0.75rem;
  border-radius: 10px;
  border-bottom-color: transparent;
}

/* Same light-green shade as .today-pill (var(--success-bg)), applied to
   the whole row the same way .schedule-row--conflict applies its own
   red — a row whose event is today, and isn't already a real conflict
   (see the view's own is_conflicted check). */
.schedule-row--today {
  background: var(--success-bg);
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  margin: 0 -0.75rem;
  border-radius: 10px;
  border-bottom-color: transparent;
}

.schedule-row__date {
  flex: 0 0 56px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  line-height: 1.2;
}

.schedule-row__date strong {
  display: block;
  font-size: 1.15rem;
  color: var(--text);
}

.schedule-row__body {
  flex: 1 1 auto;
  min-width: 0;
}

.schedule-row__title {
  margin: 0;
  font-weight: 700;
}

.schedule-row__meta {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Conflict alerts */
.conflict-panel {
  padding: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--danger-bg);
  border-radius: 16px;
}

.conflict-panel h2 {
  margin: 0 0 1rem;
  color: var(--danger-text);
}

.conflict-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.conflict-row {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem;
  background: var(--danger-bg);
  border-radius: 12px;
}

.conflict-row__mark {
  flex: 0 0 auto;
  font-weight: 800;
  color: var(--danger-text);
}

.conflict-row__body p {
  margin: 0;
}

.conflict-row__headline {
  font-weight: 700;
  color: var(--danger-text);
}

.conflict-row__detail {
  font-size: 0.9rem;
  color: var(--text);
}

/* Sidebar cards */
.sidebar-card {
  padding: 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
}

/* The mini calendar's own .sidebar-card is a <turbo-frame> (see
   _mini_calendar.html.erb), which the UA stylesheet defaults to
   `display: inline` like any unrecognized element -- without this
   override the card's padding/border stop behaving like a block box. */
turbo-frame.sidebar-card {
  display: block;
}

.sidebar-card h2 {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
}

/* A collapsible sidebar card (see shows/show.html.erb's own Production
   Credits — defaults collapsed, unlike every other sidebar card) uses a
   <summary> in place of the plain <h2> the others have; matches that
   same heading treatment, plus the pointer cursor <summary> doesn't get
   by default in every browser. */
.sidebar-card > details > summary {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}

.sidebar-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.sidebar-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 0;
}

.sidebar-links a:hover {
  color: var(--primary);
}

/* My Groups' own row (see _schedule_sidebar.html.erb) -- the plain
   .sidebar-links a above already fills the whole row on its own via
   "display: flex", which leaves no room for a trailing sibling; this
   puts the row itself in charge of that layout instead, so the group
   link and its own .kebab-menu (options trigger, only rendered for a
   group admin/Personnel Manager) can sit side by side with the menu
   pushed to the far right (that positioning is .kebab-menu's own
   "margin-left: auto", already built for exactly this). */
.group-row {
  display: flex;
  align-items: center;
}

.group-row a {
  flex: 1 1 auto;
  min-width: 0;
}

/* Groups the Action Items card's own per-category item lists (see
   _action_items.html.erb) -- each category is a .card-meta label
   followed by its own .sidebar-links, stacked directly with no wrapper
   element, so this spaces one category's label from the previous
   category's list above it. */
.sidebar-card .sidebar-links + .card-meta {
  margin-top: 1rem;
}

/* Mini calendar */
.mini-calendar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.mini-calendar__header h3 {
  margin: 0;
  font-size: 1rem;
}

.mini-calendar__nav {
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
}

.mini-calendar__nav:hover {
  color: var(--primary);
}

.mini-calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.2rem;
  text-align: center;
}

.mini-calendar__weekday {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 0.35rem;
}

.mini-calendar__day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  border-radius: 8px;
  font-size: 0.8rem;
}

.mini-calendar__day--outside {
  color: var(--border);
}

/* Same red as .conflict-panel/.conflict-row (var(--danger-bg)) — a date
   with a scheduling conflict (see UserSchedule#conflicts) reuses the
   exact shade the conflict summary itself uses, so the two read as the
   same signal. Declared before --today below so today's own blue
   highlight still wins when a conflict falls on today — losing the red
   for that one day is better than today becoming unreadable as "today". */
.mini-calendar__day--conflict {
  background: var(--danger-bg);
}

/* Same light green as .today-pill/.schedule-row--today (var(--success-bg))
   — pale enough that a rehearsal's own blue dot (.event-dot--rehearsal)
   or a concert's purple one still shows up against today's highlight
   instead of disappearing into it. */
.mini-calendar__day--today {
  background: var(--success-bg);
  color: var(--success-text);
  font-weight: 700;
}

.mini-calendar__day-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  max-width: 20px;
}

/* Hover/focus card listing every rehearsal/concert on a date — one dot
   per event above already shows the count+kind at a glance, this spells
   out what each one actually is. Positioned above the day cell (not
   inside it, which the tiny 1fr grid column has no room for) and
   dark/high-contrast rather than matching the app's own light-card
   look, the same way a native OS tooltip always reads as "system
   chrome" distinct from the page under it. */
.mini-calendar__tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  min-width: 190px;
  max-width: 240px;
  padding: 0.6rem 0.75rem;
  background: var(--text);
  color: #ffffff;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.28);
  font-size: 0.75rem;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.1s ease;
}

.mini-calendar__day:hover .mini-calendar__tooltip,
.mini-calendar__day:focus-within .mini-calendar__tooltip {
  opacity: 1;
  visibility: visible;
}

.mini-calendar__tooltip-date {
  margin: 0 0 0.35rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  font-weight: 700;
}

.mini-calendar__tooltip-event {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.25rem 0;
}

@media (max-width: 640px) {
  .dashboard-shell {
    padding: 1.25rem;
  }

  .schedule-row__date {
    flex-basis: 44px;
  }
}
