/*
 * Vikunja board overlay styles — /opt/vikunja/custom/board.css on hades, injected by nginx with board.js.
 * Plain class hooks only, never Vue's data-v-* attributes. Every rule that hides a stock element is gated
 * on a marker board.js sets ([data-vk-dec], .vk-has-count), so if the script stops working the stock look
 * comes back instead of information going missing. Colours come from Vikunja's own variables where they
 * exist, so dark mode follows. Wiki: vikunja → Board UI.
 */

/* the colour theme (gray + purple) lives in its own file so it can be dropped without touching the board */
@import url('theme.css');

/* ---- columns ---------------------------------------------------------------------------------- */

.kanban-bucket-container .bucket.vk-col {
	--vk-bg: color-mix(in srgb, var(--vk-col) 6%, var(--grey-100));
	border-block-start: 3px solid var(--vk-col);
	background: var(--vk-bg);
}

/* the header, every card slot (and its drag handle) and the sticky footer paint their own --grey-100 over the
   column, which left the tint showing only below the last card; same tint, still opaque so cards scrolling
   under the sticky footer stay hidden */
.kanban-bucket-container .bucket.vk-col .bucket-header,
.kanban-bucket-container .bucket.vk-col .bucket-footer,
.kanban-bucket-container .bucket.vk-col .task-item,
.kanban-bucket-container .bucket.vk-col .task-item .handle {
	background: var(--vk-bg);
}

/* the sticky footer also draws a 1 px stock-grey shadow below itself (to close a sub-pixel gap) — a visible line
   on a tinted column */
.kanban-bucket-container .bucket.vk-col .bucket-footer {
	box-shadow: 0 1px 0 0 var(--vk-bg);
}

/* the column dot is a button (board.js) that opens the colour picker; the hit area is bigger than the dot */
.vk-dot {
	flex: none;
	display: grid;
	place-items: center;
	inline-size: 1.3rem;
	block-size: 1.3rem;
	margin-inline-end: -.3rem;   /* the title's own left padding supplies the gap */
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
}

.vk-dot::before {
	content: '';
	inline-size: .6rem;
	block-size: .6rem;
	border-radius: 50%;
	background: var(--vk-col);
	transition: transform .12s;
}

.vk-dot:hover::before,
.vk-dot:focus-visible::before { transform: scale(1.4); }
.vk-dot:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.vk-picker {
	position: fixed;
	z-index: 1000;
	padding: .65rem;
	border: 1px solid var(--grey-200);
	border-radius: 8px;
	background: var(--white);
	box-shadow: var(--shadow-md);
	color: var(--text);
	font-size: .8rem;
}

.vk-picker__swatches {
	display: grid;
	grid-template-columns: repeat(5, 1.5rem);
	gap: .45rem;
}

.vk-swatch {
	inline-size: 1.5rem;
	block-size: 1.5rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--c);
	cursor: pointer;
	transition: transform .1s;
}

.vk-swatch:hover { transform: scale(1.12); }
.vk-swatch:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.vk-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--c); }

.vk-picker__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .5rem;
	margin-block-start: .6rem;
}

.vk-picker__custom,
.vk-picker__reset {
	padding: .2rem .5rem;
	border: 0;
	border-radius: 4px;
	background: none;
	color: var(--text);
	font: inherit;
	cursor: pointer;
}

/* the native colour input sits invisibly over its label, so a click on "Custom…" opens the system picker
   anchored there */
.vk-picker__custom { position: relative; }
.vk-picker__custom input { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; opacity: 0; cursor: pointer; }
.vk-picker__custom:hover,
.vk-picker__reset:hover:not(:disabled) { background: var(--grey-100); }
.vk-picker__reset:disabled { opacity: .45; cursor: default; }

.vk-toast {
	position: fixed;
	z-index: 1001;
	inset-inline: 0;
	inset-block-end: 1.5rem;
	inline-size: max-content;
	max-inline-size: 90vw;
	display: flex;
	align-items: center;
	gap: .9rem;
	margin-inline: auto;
	padding: .5rem .9rem;
	border-radius: 6px;
	font-size: .85rem;
	box-shadow: var(--shadow-md);
}

.vk-toast--error { background: var(--danger); color: #fff; }
/* the gray scale flips with the colour mode, so 800-on-50 is an inverted snackbar in both */
.vk-toast--note { background: var(--grey-800); color: var(--grey-50); }

.vk-toast__action {
	padding: .2rem .55rem;
	border: 0;
	border-radius: 4px;
	background: color-mix(in srgb, currentColor 14%, transparent);
	color: inherit;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.vk-toast__action:hover { background: color-mix(in srgb, currentColor 24%, transparent); }

.kanban-bucket-container .bucket.vk-has-count .bucket-header .limit {
	display: none !important;
}

.vk-count {
	align-self: center;
	flex: none;
	margin-inline: .35rem;
	padding: .05rem .5rem;
	border-radius: 999px;
	font-size: .75rem;
	font-weight: 600;
	line-height: 1.4;
	white-space: nowrap;
	background: color-mix(in srgb, var(--vk-col, var(--grey-500)) 28%, transparent);
	color: var(--text);
}

.vk-count[data-level="ok"] { background: #d3f4e1; color: #14532d; }
.vk-count[data-level="near"] { background: #fde8b0; color: #713f12; }
.vk-count[data-level="over"] { background: #fdd3d3; color: #7f1d1d; }
.vk-count[data-level="near"]::after,
.vk-count[data-level="over"]::after { content: ' !'; }

/* ---- cards ------------------------------------------------------------------------------------ */

.kanban-bucket-container .kanban-card.task h3 {
	font-size: .9rem;
	font-weight: 600;
	line-height: 1.35;
}

/* a thin edge on cards that are stuck or holding others up — visible at a glance down a column */
.kanban-bucket-container .kanban-card.task[data-vk-blocked] {
	box-shadow: inset 3px 0 0 var(--danger), var(--shadow-xs);
}

.kanban-bucket-container .kanban-card.task[data-vk-blocking]:not([data-vk-blocked]) {
	box-shadow: inset 3px 0 0 #f59e0b, var(--shadow-xs);
}

/* done tick, top right, on hover (ClickUp's "close task"): open = outlined circle, done = filled green */
.kanban-bucket-container .kanban-card.task { position: relative; }

.vk-tick {
	position: absolute;
	z-index: 2;
	inset-block-start: .4rem;
	inset-inline-end: .4rem;
	display: grid;
	place-items: center;
	inline-size: 1.4rem;
	block-size: 1.4rem;
	padding: 0;
	border: 1.5px solid var(--grey-400);
	border-radius: 50%;
	background: var(--white);
	color: var(--grey-500);
	cursor: pointer;
	opacity: 0;
	transition: opacity .12s, background-color .12s, border-color .12s, color .12s;
}

.vk-tick svg {
	inline-size: .85rem;
	block-size: .85rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.kanban-card.task:hover > .vk-tick,
.vk-tick:focus-visible { opacity: 1; }
.vk-tick:hover { border-color: var(--success); color: var(--success); }
.vk-tick[data-done] { border-color: var(--success); background: var(--success); color: #fff; }
.vk-tick[data-done]:hover { background: var(--white); color: var(--success); }
.kanban-card.task[data-vk-busy] > .vk-tick { opacity: 1; cursor: progress; }

/* just ticked: the tick fills and the card fades for the moment before it moves (kept short — Mikhail) */
.kanban-card.task[data-vk-leaving] { opacity: .5; transition: opacity .15s; }
.kanban-card.task[data-vk-leaving] > .vk-tick { border-color: var(--success); background: var(--success); color: #fff; }

/* where it landed: a ring that fades out (the card is scrolled into view first) */
@keyframes vk-flash {
	0%, 35% { box-shadow: 0 0 0 2px var(--primary), 0 0 16px 2px color-mix(in srgb, var(--primary) 45%, transparent); }
	100% { box-shadow: 0 0 0 2px transparent, 0 0 16px 2px transparent; }
}
.kanban-bucket-container .kanban-card.task.vk-flash { animation: vk-flash .7s ease-out; }
.kanban-bucket-container.is-dragging .vk-tick { display: none; }

/* no hover on touch screens: keep it faintly visible so it can be tapped */
@media (hover: none) {
	.vk-tick { opacity: .6; }
}

/* in the footer row with the stock icons (comments, attachments), just before the avatars */
.vk-badges {
	display: inline-flex;
	align-items: center;
	gap: .25rem;
}

.vk-badges:empty { display: none; }

.vk-badge {
	display: inline-flex;
	align-items: center;
	gap: .2rem;
	padding: .12rem .4rem .12rem .3rem;
	border-radius: 999px;
	font-size: .7rem;
	font-weight: 700;
	line-height: 1;
	cursor: help;
}

.vk-badge svg {
	inline-size: .85rem;
	block-size: .85rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.vk-badge svg .vk-fill { fill: currentColor; stroke: none; }
.vk-badge--blocked svg .vk-cut { fill: #e5484d; stroke: none; }   /* the bar is cut out in the badge colour */

/* red stop sign = this card cannot move; amber warning triangle = this card is what others wait on */
.vk-badge--blocked { background: #e5484d; color: #fff; }
.vk-badge--blocking { background: #f5b52e; color: #3d2600; }

/* due dates: overdue keeps the stock red text, now on a chip; today orange; done on time green */
.kanban-card.task[data-vk-due] .due-date { font-weight: 600; }
.kanban-card.task[data-vk-due="overdue"] .due-date { background: #fdd3d3 !important; color: #7f1d1d !important; }
.kanban-card.task[data-vk-due="today"] .due-date { background: #fed7aa !important; color: #7c2d12 !important; }
.kanban-card.task[data-vk-due="ontime"] .due-date { background: #d3f4e1 !important; color: #14532d !important; }

/* priority: flag for every level replaces the stock label once the card is decorated */
.kanban-card.task[data-vk-dec] .footer .priority-label { display: none !important; }

.vk-prio {
	display: inline-flex;
	align-items: center;
	gap: .2rem;
	font-size: .7rem;
	font-weight: 700;
	color: var(--vk-p);
}

.vk-prio svg {
	inline-size: .9rem;
	block-size: .9rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linejoin: round;
}

.vk-prio svg .vk-fill { fill: currentColor; fill-opacity: .9; }
.vk-prio[data-p="1"] { --vk-p: #8b8d98; }
.vk-prio[data-p="2"] { --vk-p: var(--primary, #a87eed); }
.vk-prio[data-p="3"] { --vk-p: #f5a524; }
.vk-prio[data-p="4"],
.vk-prio[data-p="5"] { --vk-p: #e5484d; }

/* assignees: pushed to the right edge, stacked, three shown then "+N" (board.js marks the rest .vk-over) */
.kanban-card.task[data-vk-dec] .footer .assignees-list {
	display: flex;
	align-items: center;
	margin-inline-start: auto;
}
.kanban-card.task[data-vk-dec] .footer .assignees-list > .assignee + .assignee { margin-inline-start: -.45rem; }
.kanban-card.task[data-vk-dec] .footer .assignees-list img {
	border-radius: 50%;
	box-shadow: 0 0 0 2px var(--scheme-main, #fff);
}
.kanban-card.task[data-vk-dec] .footer .assignees-list > .vk-over { display: none !important; }

.vk-more {
	margin-inline-start: .25rem;
	font-size: .7rem;
	font-weight: 700;
	color: var(--text-light, var(--text));
}
