/* Palette pulled from the background gradient: warm oranges into pinks and purples. */
:root {
  --ink: #2a1436;
  --ink-soft: #6b5876;
  --ink-muted: #9a8aa6;
  --line: #efdff0;
  --accent: #db2777;
  --accent-strong: #be185d;
  --grad: linear-gradient(135deg, #f97316, #db2777 55%, #a21caf);
  --done-bg: #fdf2f8;
  --done-line: #f9a8d4;
  --done-ink: #be185d;
  --rest-bg: #f3e8ff;
  --rest-line: #d8b4fe;
  --rest-ink: #7e22ce;
  --today: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 1rem;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #e8608a url("magenta_yellow_orange.jpg") center / cover no-repeat fixed;
  color: var(--ink);
}

.card {
  width: 100%;
  min-width: 0; /* let the card shrink on narrow screens; wide content scrolls inside it */
  max-width: 360px;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(80, 20, 90, 0.25);
  text-align: center;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

p {
  margin: 0 0 1.25rem;
  color: var(--ink-soft);
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

input,
button {
  font: inherit;
  padding: 0.75rem 1rem;
  border-radius: 10px;
}

input {
  border: 1px solid #e5d3e8;
  color: var(--ink);
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

button {
  border: none;
  background: var(--grad);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(219, 39, 119, 0.3);
}

button:hover {
  filter: brightness(1.07);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
  filter: none;
}

.error {
  margin: 0;
  color: #dc2626;
  font-size: 0.9rem;
}

.muted {
  color: var(--ink-muted);
  font-size: 0.8rem;
}

/* Workout calendars page */

.card.wide {
  max-width: 1280px;
  text-align: left;
}

/* Calendars on the left, video list on the right. Stacks on narrow screens. */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 2rem;
}

/* The list is pinned to the height of the calendars and scrolls inside its box. */
.library-col {
  position: relative;
  min-height: 0;
}

.library {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
}

/* Stays at the top while you scroll so the month and status are always in view. */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: -2rem -2rem 1rem;
  padding: 1.25rem 2rem 0.75rem;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
}

.month-nav {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.month-nav h1 {
  margin: 0;
  font-size: 1.35rem;
  min-width: 9rem;
  text-align: center;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.month-nav button {
  padding: 0.4rem 0.9rem;
  font-size: 1.1rem;
  line-height: 1;
}

.links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.links button {
  padding: 0.4rem 0.9rem;
}

.hint,
.status {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.85rem;
}

.status {
  font-size: 0.8rem;
  color: var(--ink-muted);
  min-height: 1.2em;
}

.status.error {
  color: #dc2626;
}

.calendar-block {
  margin-bottom: 2rem;
}

.calendar-block:last-child {
  margin-bottom: 0;
}

.calendar-block h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.weekdays,
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
}

.weekdays {
  margin-bottom: 0.4rem;
}

.weekdays div {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.day {
  min-height: 72px;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.day.empty {
  border: none;
  background: none;
}

.day.today {
  border-color: var(--today);
  box-shadow: inset 0 0 0 1px var(--today);
}

.day.done {
  background: var(--done-bg);
  border-color: var(--done-line);
}

.day.rest {
  background: var(--rest-bg);
  border-color: var(--rest-line);
}

.day-number {
  font-size: 0.85rem;
  font-weight: 600;
}

.day select {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.3rem;
  border: 1px solid #e5d3e8;
  border-radius: 8px;
  background: #fff;
  color: inherit;
}

.workout {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--done-ink);
  overflow-wrap: anywhere;
}

.workout.rest {
  color: var(--rest-ink);
}

/* A bubble in the workout's own color around the name; the text keeps its usual color. */
.bubble {
  display: inline-block;
  align-self: flex-start;
  max-width: 100%;
  padding: 0.05rem 0.5rem;
  border: 1.5px solid var(--bubble);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bubble) 14%, white);
  color: var(--ink);
}

select.bubble {
  display: block;
  align-self: stretch;
  padding: 0.3rem;
  border: 1.5px solid var(--bubble);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bubble) 12%, white);
}

.note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-toggle {
  align-self: flex-start;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--accent);
  font-size: 0.75rem;
}

.note-toggle:hover {
  background: none;
  filter: none;
  text-decoration: underline;
}

.note-input {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 0.75rem;
  padding: 0.3rem;
  border: 1px solid #e5d3e8;
  border-radius: 8px;
  resize: vertical;
  color: var(--ink);
}

/* Phone layout: one row per day, both calendars side by side. */

.agenda-row {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.agenda-head {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-align: center;
  margin-bottom: 0.5rem;
}

.agenda-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  font-size: 0.7rem;
  color: var(--ink-muted);
}

.agenda-date .num {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  width: 1.7rem;
  height: 1.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.agenda-row.today .agenda-date .num {
  background: var(--today);
  color: #fff;
}

.agenda-cell {
  min-height: 2.75rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.3rem;
}

.agenda-cell.done {
  background: var(--done-bg);
  border-color: var(--done-line);
}

.agenda-cell.rest {
  background: var(--rest-bg);
  border-color: var(--rest-line);
}

.agenda-cell select {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.3rem;
  border: 1px solid #e5d3e8;
  border-radius: 8px;
  background: #fff;
  color: inherit;
}

/* Video list */

.library h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.video-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.video-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.video-list li:first-child {
  border-top: 1px solid var(--line);
}

.workout-link {
  color: var(--accent-strong);
  font-weight: 600;
  font-size: 0.9rem;
}

.workout-link.bubble {
  color: var(--ink);
  text-decoration: none;
}

.workout-link.bubble:hover {
  text-decoration: underline;
}

.video-list .notes {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.video-list .muted {
  margin-top: 0.2rem;
}

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

  .library {
    position: static;
    border: none;
    padding: 0;
    background: none;
  }
}

@media (max-width: 600px) {
  .card.wide {
    padding: 1rem;
  }

  .toolbar {
    margin: -1rem -1rem 1rem;
    padding: 0.75rem 1rem 0.5rem;
  }

  .month-nav h1 {
    font-size: 1.05rem;
    min-width: 0;
  }

  .month-nav button,
  .links button {
    padding: 0.4rem 0.75rem;
  }
}
