/*
    The club year planner (Views/ClubYearAdmin). Each annual event is drawn in one of the colours
    in AnnualEventColours; the class is club-year-colour-<name in lower case>.
*/

.club-year-colour-blue { --club-year-colour: #185fa5; }
.club-year-colour-teal { --club-year-colour: #0f6e56; }
.club-year-colour-green { --club-year-colour: #3b6d11; }
.club-year-colour-amber { --club-year-colour: #ba7517; }
.club-year-colour-coral { --club-year-colour: #d85a30; }
.club-year-colour-red { --club-year-colour: #a32d2d; }
.club-year-colour-pink { --club-year-colour: #993556; }
.club-year-colour-purple { --club-year-colour: #534ab7; }
.club-year-colour-grey { --club-year-colour: #5f5e5a; }

.club-year-swatch {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    margin-right: 0.35rem;
    border-radius: 50%;
    background: var(--club-year-colour, #5f5e5a);
    vertical-align: baseline;
}

.club-year-colour-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.club-year-colour-choice {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--club-year-colour);
    border: 3px solid transparent;
    cursor: pointer;
}

.btn-check:checked + .club-year-colour-choice {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--club-year-colour);
}

.btn-check:focus-visible + .club-year-colour-choice {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* ---- Club year screen ---------------------------------------------------------------------- */

.club-year-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.club-year-attention {
    height: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-top-width: 4px;
    border-radius: 0.5rem;
    background: #fff;
}

.club-year-attention--overdue { border-top-color: #dc3545; }
.club-year-attention--overdue h3 { color: #b02a37; }
.club-year-attention--soon { border-top-color: #ffc107; }
.club-year-attention--soon h3 { color: #997404; }

.club-year-attention__task {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
}

.club-year-attention__task:first-child { border-top: 0; }

/* The one-press "done" box: big enough to hit with a thumb. */
.club-year-tick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 2px solid #adb5bd;
    border-radius: 0.35rem;
    background: #fff;
    color: transparent;
    line-height: 1;
}

.club-year-tick:hover,
.club-year-tick:focus-visible {
    border-color: #198754;
    color: #198754;
}

/* The "set up the whole year" strip above a year that is not set up yet. */
.club-year-setup {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border: 1px dashed #86b7fe;
    border-radius: 0.5rem;
    background: #f3f8ff;
}

/* The timeline: a name column and a track per event, drawn in SVG because the content security
   policy allows no inline style, and SVG positions by attribute. */
.club-year-row {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
}

.club-year-row--months {
    border-top: 0;
    padding-bottom: 0;
}

.club-year-row__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.club-year-track {
    display: block;
    overflow: visible;
}

.club-year-month-label {
    font-size: 0.75rem;
    fill: #6c757d;
}

.club-year-gridline {
    stroke: #e9ecef;
    stroke-width: 1;
}

.club-year-today {
    stroke: #0d6efd;
    stroke-width: 2;
}

.club-year-bar {
    fill: var(--club-year-colour, #5f5e5a);
}

/* The event's date beside its bar, in the event's own colour. */
.club-year-bar-label {
    font-size: 0.75rem;
    font-weight: 600;
    fill: var(--club-year-colour, #5f5e5a);
}

.club-year-bar--suggested {
    fill: #fff;
    stroke: var(--club-year-colour, #5f5e5a);
    stroke-width: 1.5;
    stroke-dasharray: 3 2;
}

.club-year-dot { stroke-width: 1.5; }
.club-year-dot--done { fill: #198754; stroke: #198754; }
.club-year-dot--overdue { fill: #dc3545; stroke: #dc3545; }
.club-year-dot--soon { fill: #ffc107; stroke: #cc9a06; }
.club-year-dot--later { fill: #fff; stroke: #6c757d; }
.club-year-dot--wont { fill: #adb5bd; stroke: #adb5bd; }
.club-year-dot--missed { fill: #fff; stroke: #dc3545; stroke-dasharray: 2 1.5; }

.club-year-legend svg { vertical-align: -1px; }

.club-year-legend-today {
    display: inline-block;
    width: 2px;
    height: 0.8rem;
    background: #0d6efd;
    vertical-align: -1px;
}

/* The same year as a list, for a phone. */
.club-year-agenda-month {
    margin: 1rem 0 0.25rem;
}

.club-year-agenda-month:first-child { margin-top: 0; }

.club-year-agenda__item {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
}

.club-year-agenda__item--event { font-weight: 600; }
.club-year-agenda__date { color: #6c757d; font-size: 0.875rem; }

/* ---- Event page ---------------------------------------------------------------------------- */

.club-year-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.club-year-summary__countdown {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.club-year-summary__progress {
    flex: 1 1 16rem;
    max-width: 28rem;
}

.club-year-progress {
    display: block;
    width: 100%;
    height: 0.6rem;
    border: 0;
    border-radius: 0.3rem;
    background: #e9ecef;
    overflow: hidden;
    appearance: none;
}

.club-year-progress::-webkit-progress-bar { background: #e9ecef; }
.club-year-progress::-webkit-progress-value { background: #198754; }
.club-year-progress::-moz-progress-bar { background: #198754; }

.club-year-task {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.75rem 0 0.75rem 0.75rem;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    border-left: 4px solid transparent;
}

.club-year-task:first-child { border-top: 0; }

/* Returning to #task-N after a status change: clear of the sticky header. */
.club-year-task { scroll-margin-top: 6rem; }
.club-year-task--overdue { border-left-color: #dc3545; }
.club-year-task--duesoon { border-left-color: #ffc107; }
.club-year-task--done { border-left-color: #198754; }

.club-year-task--done .club-year-task__title,
.club-year-task--wontdo .club-year-task__title {
    color: #6c757d;
}

.club-year-task--wontdo .club-year-task__title { text-decoration: line-through; }

.club-year-task__main {
    flex: 1 1 18rem;
    min-width: 0;
}

.club-year-task__title { font-weight: 600; }

.club-year-task__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.club-year-task__edit {
    display: flex;
    gap: 0.75rem;
}

.club-year-due-soon { color: #997404; }

@media (max-width: 575.98px) {
    .club-year-task__actions { align-items: stretch; width: 100%; }
    .club-year-task__actions .btn-group { width: 100%; }
    .club-year-task__actions .btn-group .btn { flex: 1 1 0; }
}

/* ---- Start from an example ----------------------------------------------------------------- */

.club-year-examples {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
    gap: 1rem;
    /* Each card its own height: stretched to the tallest in the row, a closed card is a tall empty
       box with its summary line stranded in the middle. */
    align-items: start;
}

.club-year-examples .club-year-example { margin: 0; }

.club-year-example__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

.club-year-example__tasks { margin-top: 0.75rem; }

.club-year-example__task {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.25rem 0;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
}

/* Notes are typed with line breaks, and should keep them. */
.club-year-notes {
    white-space: pre-line;
}

/* Suggested tasks to tick (Suggest tasks on a year). */
.club-year-suggestion {
    padding: 0.75rem 0;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
}

.club-year-suggestion .club-year-notes {
    margin-top: 0.25rem;
}
