/* MvcBB.Calendar - served from the mod's DLL at /_mods/calendar/css/calendar.css */

/* Category colours arrive as --cal-colour (and --cal-text, black or white
   for text on it), set inline from the API's checked #rrggbb values. */

/* ---- Month grid (md and up; phones get the list instead) ---- */

.cal-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-top: 1px solid #dee2e6;
    border-left: 1px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
}

.cal-weekday {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
    background-color: #f1f3f5;
    border-right: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
}

.cal-day {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-height: 7.5rem;
    min-width: 0;
    padding: 0.3rem;
    border-right: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
    background-color: #fff;
}

.cal-other-month {
    background-color: #f8f9fa;
}

.cal-other-month .cal-day-number {
    color: #adb5bd;
}

.cal-day-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cal-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 600;
}

.cal-today .cal-day-number {
    background-color: var(--bs-primary, #0d6efd);
    color: #fff;
}

/* The "add on this day" plus shows on hover or keyboard focus. */
.cal-add {
    opacity: 0;
    color: inherit;
    text-decoration: none;
    line-height: 1;
    padding: 0 0.25rem;
    border-radius: 0.25rem;
}

.cal-day:hover .cal-add,
.cal-add:focus {
    opacity: 0.7;
}

.cal-add:hover {
    opacity: 1;
}

/* One event in a day cell: timed ones get a coloured dot and the time, all-day
   (and continuing multi-day) ones a coloured bar. */
.cal-chip {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    padding: 0.05rem 0.35rem;
    border-radius: 0.25rem;
    border-left: 3px solid var(--cal-colour, #6c757d);
    font-size: 0.78rem;
    line-height: 1.35;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.cal-chip:hover,
.cal-chip:focus {
    background-color: rgba(0, 0, 0, 0.06);
}

.cal-chip-allday {
    background-color: var(--cal-colour, #6c757d);
    color: var(--cal-text, #fff);
}

.cal-chip-allday:hover,
.cal-chip-allday:focus {
    background-color: var(--cal-colour, #6c757d);
    filter: brightness(0.92);
}

.cal-chip-time {
    font-variant-numeric: tabular-nums;
    opacity: 0.8;
}

.cal-chip-title {
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-more {
    padding-left: 0.35rem;
}

/* ---- Lists ---- */

.cal-row {
    border-left: 4px solid var(--cal-colour, #6c757d) !important;
}

.cal-dot {
    display: inline-block;
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    background-color: var(--cal-colour, #6c757d);
    vertical-align: baseline;
}

.cal-legend .list-inline-item {
    margin-right: 0.9rem;
}

.cal-list-day {
    scroll-margin-top: 4.5rem;
}

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

.cal-title {
    overflow-wrap: anywhere;
}

.cal-facts {
    display: grid;
    grid-template-columns: 1.5rem 1fr;
    gap: 0.4rem 0.5rem;
}

.cal-facts dt {
    font-weight: normal;
    color: #6c757d;
}

.cal-facts dd {
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

/* BBCode output: core's renderer turns line breaks into <br />; pre-wrap
   additionally keeps runs of spaces. Keep long words and images inside. */
.cal-content {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.cal-content img:not(.smilie) {
    max-width: 100%;
    height: auto;
}

.cal-order-input {
    width: 5rem;
}

/* ---- Dark scheme ----
   Core sets <html data-theme="dark"> and defines the --mvcbb-dark-* colours
   (see MvcBB.App's site.css). Core's own dark rules already cover .card,
   .list-group-item, .text-muted and form controls. */

:root[data-theme="dark"] .cal-grid,
:root[data-theme="dark"] .cal-weekday,
:root[data-theme="dark"] .cal-day {
    border-color: var(--mvcbb-dark-border, #3c3847);
}

:root[data-theme="dark"] .cal-weekday {
    background-color: var(--mvcbb-dark-surface-alt, #2a2732);
    color: var(--mvcbb-dark-text-muted, #a9a4b8);
}

:root[data-theme="dark"] .cal-day {
    background-color: var(--mvcbb-dark-surface, #201d26);
}

:root[data-theme="dark"] .cal-other-month {
    background-color: var(--mvcbb-dark-bg, #16141a);
}

:root[data-theme="dark"] .cal-other-month .cal-day-number {
    color: var(--mvcbb-dark-text-muted, #a9a4b8);
    opacity: 0.6;
}

/* Core's dark scheme colours every link; event chips keep the cell's text
   colour, and all-day bars the black or white picked for their colour. */
:root[data-theme="dark"] .cal-chip,
:root[data-theme="dark"] .cal-add {
    color: var(--mvcbb-dark-text, #e7e4ee);
}

:root[data-theme="dark"] .cal-chip-allday,
:root[data-theme="dark"] .cal-chip-allday:hover {
    color: var(--cal-text, #fff);
}

:root[data-theme="dark"] .cal-chip:hover,
:root[data-theme="dark"] .cal-chip:focus {
    background-color: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .cal-chip-allday:hover,
:root[data-theme="dark"] .cal-chip-allday:focus {
    background-color: var(--cal-colour, #6c757d);
}

:root[data-theme="dark"] .cal-facts dt {
    color: var(--mvcbb-dark-text-muted, #a9a4b8);
}

/* ---- Birthdays ---- */

.cal-birthday {
    border-left-color: #d63384;
    font-style: italic;
}

.cal-birthday .bi,
.cal-birthday-line .bi {
    color: #d63384;
}
