/* SW CloudCalendar – base frontend styles. Everything is scoped below .swc-calendar / .swc-detail / .swc-dialog. */
.swc-calendar, .swc-detail, .swc-dialog { --swc-border: rgba(0, 0, 0, .12); --swc-muted: rgba(0, 0, 0, .62); --swc-accent: #2271b1; --swc-today: rgba(34, 113, 177, .08); box-sizing: border-box; }
.swc-calendar *, .swc-detail *, .swc-dialog * { box-sizing: inherit; }
.swc-screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.swc-calendar a:focus-visible, .swc-dialog a:focus-visible, .swc-dialog button:focus-visible { outline: 2px solid var(--swc-accent); outline-offset: 2px; }
.swc-container__header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1rem; }
.swc-container__title { margin: 0; }
.swc-empty, .swc-loading, .swc-error { padding: 1rem 0; color: var(--swc-muted); }
.swc-error { color: #b32d2e; }

/* Lists and cards */
.swc-events { list-style: none; margin: 0; padding: 0; }
.swc-events--list {     list-style-type: none !important; margin: 0 !important; }
.swc-events--list > .swc-events__item + .swc-events__item { border-top: 1px solid var(--swc-border); }
.swc-events--cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 1rem; list-style:none; }
.swc-events__item.is-tentative { opacity: .8; }

/* Month grid: table on wide screens, agenda on small screens */
.swc-nav { display: flex; align-items: center; gap: .75rem; }
.swc-nav a { text-decoration: none; padding: .25rem .5rem; border: 1px solid var(--swc-border); border-radius: 4px; }
.swc-nav__label { font-weight: 600; min-width: 9em; text-align: center; }
.swc-nav--list { justify-content: space-between; margin-top: 1rem; }
.swc-nav .is-disabled { padding: .25rem .5rem; border: 1px solid transparent; color: var(--swc-muted); opacity: .6; }
.swc-calendar:focus { outline: none; }
.swc-month { width: 100%; border-collapse: collapse; table-layout: fixed; }
.swc-month__caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.swc-month th { padding: .4rem; font-weight: 600; text-align: left; border-bottom: 2px solid var(--swc-border); }
.swc-month abbr { text-decoration: none; }
.swc-month td { vertical-align: top; height: 6.5rem; padding: .25rem; border: 1px solid var(--swc-border); overflow: hidden; }
.swc-month td.is-other-month { color: var(--swc-muted); background: rgba(0, 0, 0, .02); }
.swc-month td.is-today { background: var(--swc-today); }
.swc-month__date { font-size: .85em; margin-bottom: .2rem; }
.swc-month td.is-today .swc-month__date time { font-weight: 700; }
.swc-month__today { font-size: .75em; color: var(--swc-accent); }
.swc-month__events { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
@media (max-width: 700px) {
	.swc-month, .swc-month tbody, .swc-month tr, .swc-month td { display: block; width: 100%; height: auto; }
	.swc-month thead { display: none; }
	.swc-month td { border: 0; border-bottom: 1px solid var(--swc-border); padding: .5rem 0; }
	.swc-month td:not(.has-events), .swc-month td.is-other-month { display: none; }
	.swc-month td.is-other-month { background: none; }
	.swc-month__date { font-size: 1em; font-weight: 600; }
	.swc-month__date time::before { content: attr(aria-label); }
	.swc-month__date time { font-size: 0; }
	.swc-month__date time::before { font-size: 1rem; }
}

/* Attachments */
.swc-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; margin: .75rem 0; }
.swc-gallery__item img { display: block; width: 100%; height: 120px; object-fit: cover; border-radius: 4px; }
.swc-files { list-style: none; margin: .5rem 0; padding: 0; }
.swc-files__item { margin: .25rem 0; }
.swc-files__link { display: inline-flex; align-items: center; gap: .4rem; }
.swc-files__size { color: var(--swc-muted); font-size: .9em; }
.swc-file-icon { display: inline-block; width: 1.6em; height: 1.9em; border-radius: 3px; background: #6c7781; position: relative; flex: none; }
.swc-file-icon::after { position: absolute; inset: auto 0 .25em 0; text-align: center; color: #fff; font-size: .5em; font-weight: 700; letter-spacing: .02em; }
.swc-file-icon--pdf { background: #c0392b; } .swc-file-icon--pdf::after { content: "PDF"; }
.swc-file-icon--doc { background: #2b579a; } .swc-file-icon--doc::after { content: "DOC"; }
.swc-file-icon--sheet { background: #217346; } .swc-file-icon--sheet::after { content: "XLS"; }
.swc-file-icon--slides { background: #d24726; } .swc-file-icon--slides::after { content: "PPT"; }
.swc-file-icon--archive { background: #7f6a00; } .swc-file-icon--archive::after { content: "ZIP"; }
.swc-file-icon--text { background: #555d66; } .swc-file-icon--text::after { content: "TXT"; }
.swc-file-icon--image { background: #8e44ad; } .swc-file-icon--image::after { content: "IMG"; }
.swc-file-icon--file::after { content: "FILE"; }

/* Detail */
.swc-detail-card__title { margin: 0 0 .25rem; }
.swc-detail-card__meta { display: flex; align-items: center; gap: .5rem; margin: 0 0 .5rem; }
.swc-dot { display: inline-block; width: .8em; height: .8em; border-radius: 50%; }
.swc-badge { display: inline-block; padding: 0 .4em; border-radius: 3px; background: rgba(0, 0, 0, .08); font-size: .8em; }
.swc-detail-card__location, .swc-detail-card__calendar { margin: .25rem 0; color: var(--swc-muted); }
.swc-back { margin: 0 0 1rem; }

/* Dialog */
.swc-dialog { width: min(720px, calc(100vw - 2rem)); max-height: calc(100vh - 4rem); border: 0; border-radius: 8px; padding: 1.5rem; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.swc-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.swc-dialog__close { position: absolute; top: .5rem; right: .5rem; width: 2.25rem; height: 2.25rem; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .06); font-size: 1.4rem; line-height: 1; cursor: pointer; }
@media (prefers-reduced-motion: no-preference) { .swc-dialog[open] { animation: swc-fade .15s ease-out; } }
@keyframes swc-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Shared presentation options also apply to externally supplied calendars. */
.swc-calendar .swc-events__item { min-width: 0; }
.swc-calendar.swc-color-titles .swc-events__item h3 a[data-swc-detail] { color: var(--swc-event-color); }
.swc-calendar .swc-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; list-style: none; padding: 0; }
.swc-calendar .swc-legend li { display: flex; align-items: center; gap: .4rem; }
.swc-calendar .swc-legend__color { width: .8rem; height: .8rem; border-radius: 50%; display: inline-block; }
.swc-calendar .swc-month__event .swc-chip { background: var(--swc-event-color); color: var(--swc-event-text); }
.swc-calendar .swc-month__more { list-style: none; }
.swc-calendar .swc-month__more summary { cursor: pointer; }
@media (min-width: 48rem) {
 .swc-calendar.swc-columns-2 .swc-events { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1.5rem; list-style:none; }
 .swc-calendar.swc-columns-3 .swc-events { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1.5rem; list-style:none; }
 .swc-calendar.swc-columns-4 .swc-events { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1.5rem; list-style:none; }
}

.swc-calendar .swc-month-group + .swc-month-group { margin-top: 2rem; }
.swc-calendar .swc-month-group__title { display: flex; align-items: center; gap: 1rem; margin: 0 0 1rem; font-size: 1rem; font-weight: 600; color: var(--swc-muted); }
.swc-calendar .swc-month-group__title::after { content: ""; flex: 1; border-top: 1px solid var(--swc-border); }

/* Calendar controls: native links and form, progressively enhanced. */
.swc-calendar .swc-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 1rem 2rem; margin: 0 0 1.25rem; }
.swc-calendar .swc-mode-tabs { display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .25rem; border: 1px solid #dce1e8; border-radius: .5rem; background: #f1f3f6; }
.swc-calendar a.swc-mode-tabs__tab { padding: .6rem 1rem; border: 0; border-radius: .3rem; color: #334155; background: transparent; font: inherit; text-decoration: none; }
.swc-calendar a.swc-mode-tabs__tab[aria-current="page"] { color: var(--swc-primary-text, #fff); background: var(--swc-primary, #2271b1); font-weight: 600; }
.swc-calendar .swc-search { display: flex; flex: 1 1 20rem; flex-wrap: wrap; align-items: end; gap: .5rem; margin: 0; }
.swc-calendar .swc-search__label { display: flex; flex: 1 1 12rem; flex-direction: column; gap: .25rem; margin: 0; font-size: .9rem; }
.swc-calendar .swc-search input[type="search"] { width: 100%; min-width: 0; padding: .65rem .75rem; border: 1px solid #94a3b8; border-radius: .35rem; color: #0f172a; background: #fff; font: inherit; margin-bottom:0; }
.swc-calendar .swc-search button { padding: .65rem 1rem; border: 1px solid #2271b1; border-radius: .35rem; background: #2271b1; color: #fff; font: inherit; cursor: pointer; }
.swc-calendar .swc-search__hint, .swc-calendar .swc-search__results { flex-basis: 100%; margin: 0; font-size: .85rem; color: var(--swc-muted); }
.swc-calendar input:focus-visible, .swc-calendar button:focus-visible { outline: 2px solid var(--swc-accent); outline-offset: 2px; }

/* Month layout stays readable even in themes that style all tables, lists and links. */
.swc-calendar table.swc-month { width: 100%; table-layout: fixed; border-collapse: collapse; border: 2px solid #dce1e8; background: #fff; color: #1e293b; }
.swc-calendar .swc-month th { padding: 1rem .4rem; background: #e5e8ed; color: #475569; text-align: center; font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; border: 2px solid #dce1e8; }
.swc-calendar .swc-month td { height: 11rem; padding: .4rem; border: 2px solid #dce1e8; background: #fff; color: #1e293b; }
.swc-calendar .swc-month td.is-other-month { background: #f7f8fa; color: #64748b; }
.swc-calendar .swc-month td.is-today { background: #eff6ff; box-shadow: inset 0 3px #2271b1; }
.swc-calendar .swc-month__date { margin: .15rem 0 .6rem; font-size: .8rem; }
.swc-calendar .swc-month ul.swc-month__events { display: grid; gap: .25rem; list-style: none; padding: 0; margin: 0; }
.swc-calendar .swc-month ul.swc-month__events > li { list-style: none; margin: 0; padding: 0; min-width: 0; }
.swc-calendar .swc-month ul.swc-month__events > li::marker { content: ""; }
.swc-calendar .swc-month ul.swc-month__events > li::before { content: none; }
.swc-calendar .swc-month__event a.swc-chip { display: flex; align-items: center; gap: .3rem; min-height: 2.25rem; padding: .5rem .35rem; border: 0; border-radius: .2rem; background: var(--swc-event-color, #2271b1); color: var(--swc-event-text, #fff); font-size: .75rem; line-height: 1.25; font-weight: 600; text-decoration: none; overflow: hidden; }
.swc-calendar .swc-month__event .swc-chip__time { display: inline; flex: none; opacity: 1; color: inherit; font-size: inherit; }
.swc-calendar .swc-month__event .swc-chip__title { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.swc-calendar .swc-month__event a.swc-chip:hover { filter: brightness(.94); }
.swc-calendar .swc-month__more summary { list-style: none; padding: .5rem .25rem; color: #0759a3; font-size: .75rem; font-weight: 600; text-align: center; }
.swc-calendar .swc-month__more summary::-webkit-details-marker { display: none; }
.swc-calendar .swc-month__more summary::before { content: "+"; }
@media (max-width: 700px) {
 .swc-calendar table.swc-month { border: 0; }
 .swc-calendar .swc-month td { height: auto; border: 0; border-bottom: 2px solid #dce1e8; padding: .75rem .5rem; }
 .swc-calendar .swc-month__event a.swc-chip { font-size: .9rem; }
 .swc-calendar .swc-month__event .swc-chip__title { white-space: normal; }
}

/* Search stays on the controls row, with a compact native GET form. */
.swc-calendar .swc-controls { align-items: center; gap: 1rem; }
.swc-calendar .swc-search { flex: 1 1 22rem; align-items: center; border: 2px solid #d5d8dc; background: #fff; padding: .65rem 1.2rem; gap: .5rem 1rem; }
.swc-calendar .swc-search__label { flex: 1 1 10rem; min-width: 0; margin: 0; }
.swc-calendar .swc-search input[type="search"] { min-height: 2.25rem; padding: .25rem 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: #111827; font-size: .875rem; appearance: none; }
.swc-calendar .swc-search input::placeholder { color: #111827; opacity: 1; }
.swc-calendar .swc-search button { display: inline-flex; align-items: center; justify-content: center; gap: .65rem; min-height: 2.25rem; padding: .55rem 1rem; border: 0; border-radius: .75rem; background: #fce05a; color: #334155; font-size: .75rem; font-weight: 600; line-height: 1.2; text-transform: uppercase; }
.swc-calendar .swc-search button:hover { background: #f5d43a; }
/* Per-view primary colour (CalendarView::primaryColor) replaces the default accent of tabs and search button. */
.swc-calendar.swc-has-primary .swc-search button { background: var(--swc-primary); color: var(--swc-primary-text); }
.swc-calendar.swc-has-primary .swc-search button:hover { background: var(--swc-primary); filter: brightness(.9); }
.swc-calendar .swc-search__icon { position: relative; display: inline-block; width: .65rem; height: .65rem; border: 2px solid currentColor; border-radius: 50%; flex: none; }
.swc-calendar .swc-search__icon::after { content: ""; position: absolute; width: .35rem; height: 2px; background: currentColor; transform: rotate(45deg); top: .45rem; left: .4rem; }

/* Explicitly reset theme positioning so the native top-layer dialog stays centered. */
dialog.swc-dialog { position: fixed !important; inset: 0 !important; margin: auto !important; transform: none !important; width: min(960px, calc(100vw - 2rem)); max-width: calc(100vw - 2rem); height: fit-content; max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); padding: 0; border: 1px solid #dce1e8; border-radius: .75rem; background: #fff; color: #334155; text-align: left; overflow: hidden; }
dialog.swc-dialog[open] { display: flex; flex-direction: column; }
dialog.swc-dialog:not([open]) { display: none; }
dialog.swc-dialog .swc-dialog__header { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.5rem; border-bottom: 1px solid #dce1e8; background: #f7f9fb; }
dialog.swc-dialog .swc-dialog__title { margin: 0; font-size: 1rem; font-weight: 600; text-transform: uppercase; }
dialog.swc-dialog .swc-dialog__close { position: static; display: grid; place-items: center; flex: none; width: 2rem; height: 2rem; margin: 0; padding: 0; border: 0; background: transparent; color: #475569; line-height: 1; cursor: pointer; }
dialog.swc-dialog .swc-dialog__body { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.swc-detail .swc-event-detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(15rem, 1fr); background: #fff; color: #334155; }
.swc-detail .swc-event-detail__main { min-width: 0; padding: 2rem 1.75rem; }
.swc-detail .swc-event-detail__title { margin: 0 0 1.75rem; color: #3f4148; font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 600; line-height: 1.25; text-transform: uppercase; overflow-wrap: anywhere; }
.swc-detail .swc-event-detail__source { display: inline-block; margin: 0 0 1rem; padding: .65rem .8rem; border-radius: .25rem; font-size: .75rem; font-weight: 600; }
.swc-detail .swc-event-detail__description, .swc-detail .swc-event-detail__fact { padding: 1.25rem; border: 1px solid #dce1e8; border-radius: .5rem; background: #fff; overflow-wrap: anywhere; font-size: .875rem; line-height: 1.8; }
.swc-detail .swc-event-detail__description h3 { margin: 0 0 .75rem; font-size: .8rem; font-weight: 600; text-transform: uppercase; }
.swc-detail .swc-event-detail__description p { margin: 0 0 .9rem; }
.swc-detail .swc-event-detail__description div { white-space: pre-wrap; }
.swc-detail .swc-event-detail__plain { white-space: pre-line; }
.swc-detail .swc-event-detail__sidebar { display: flex; flex-direction: column; gap: 1rem; min-width: 0; padding: 2rem 1.5rem; border-left: 1px solid #dce1e8; background: #f7f9fb; }
.swc-detail .swc-event-detail__image-link { display: block; position: relative; margin: .5rem 0 1rem; text-decoration: none; }
.swc-detail .swc-event-detail__image-link img { display: block; width: 100%; max-height: 20rem; height: auto; object-fit: contain; }
.swc-detail .swc-event-detail__image-link > span { position: absolute; bottom: -.5rem; right: .5rem; padding: .4rem .7rem; border-radius: 2rem; background: #334155; color: #fff; font-size: .75rem; }
.swc-detail .swc-event-detail__fact h3 { display: flex; align-items: center; gap: .5rem; margin: 0 0 .75rem; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.swc-detail .swc-event-detail__fact h3 > span { color: #2563eb; font-size: 1.25rem; }
.swc-detail .swc-event-detail__fact p { margin: 0; font-size: .8rem; }
@media (max-width: 640px) {
 .swc-detail .swc-event-detail { grid-template-columns: minmax(0, 1fr); }
 .swc-detail .swc-event-detail__main, .swc-detail .swc-event-detail__sidebar { padding: 1.25rem; }
 .swc-detail .swc-event-detail__sidebar { border-left: 0; border-top: 1px solid #dce1e8; }
 dialog.swc-dialog .swc-dialog__header { padding: .75rem 1rem; }
}
.swc-detail .swc-event-detail__gallery > summary { cursor: pointer; font-size: .8rem; font-weight: 600; color: #2271b1; }
