/* Kanban View Container */
.obk-view-container {
	container-type: inline-size;
	height: 100%;
	display: flex;
	flex-direction: column;
	padding: 10px;
	overflow: hidden;
}

/* Property Selector */
.obk-property-selector {
	margin-bottom: 15px;
	padding: 10px;
	background: var(--background-secondary);
	border-radius: 6px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.obk-property-label {
	font-weight: 500;
	color: var(--text-normal);
}

.obk-property-select {
	padding: 6px 12px;
	border: 1px solid var(--background-modifier-border);
	border-radius: 4px;
	background: var(--background-primary);
	color: var(--text-normal);
	font-size: 14px;
	cursor: pointer;
}

.obk-property-select:hover {
	border-color: var(--interactive-hover);
}

.obk-property-select:focus {
	outline: 2px solid var(--interactive-accent);
	outline-offset: 2px;
}

/* Empty State */
.obk-empty-state {
	padding: 40px 20px;
	text-align: center;
	color: var(--text-muted);
	font-style: italic;
}

/* Kanban Board */
.obk-board {
	display: flex;
	gap: 15px;
	overflow-x: auto;
	overflow-y: hidden;
	flex: 1;
	padding-bottom: 10px;
}

.obk-board::-webkit-scrollbar {
	height: 8px;
}

.obk-board::-webkit-scrollbar-track {
	background: var(--background-secondary);
	border-radius: 4px;
}

.obk-board::-webkit-scrollbar-thumb {
	background: var(--background-modifier-border);
	border-radius: 4px;
}

.obk-board::-webkit-scrollbar-thumb:hover {
	background: var(--background-modifier-border-hover);
}

/* Swimlane mode: stack lanes vertically. The lane body becomes the
   horizontal column flex (replacing what .obk-board does in flat mode). */
.obk-board--with-swimlanes {
	flex-direction: column;
	overflow-x: hidden;
	overflow-y: auto;
	gap: 12px;
}

.obk-swimlane {
	display: flex;
	flex-direction: column;
	background: var(--background-secondary-alt);
	border-radius: 8px;
	border: 1px solid var(--background-modifier-border);
	overflow: hidden;
}

.obk-swimlane-header {
	padding: 8px 14px;
	background: var(--background-primary-alt);
	border-bottom: 1px solid var(--background-modifier-border);
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 600;
	font-size: 13px;
	color: var(--text-normal);
	text-transform: capitalize;
	flex-shrink: 0;
}

.obk-swimlane-count {
	font-size: 12px;
	color: var(--text-muted);
	background: var(--background-modifier-border);
	padding: 2px 8px;
	border-radius: 12px;
	font-weight: 500;
}

.obk-swimlane-body {
	display: flex;
	align-items: stretch;
	gap: 12px;
	overflow-x: auto;
	overflow-y: visible;
	padding: 12px;
	min-height: 140px;
}

/* In swimlane mode, each lane grows tall enough to fit the fullest column,
   and shorter column bodies stretch to that height so their Sortable drop
   target spans the whole lane row. */
.obk-board--with-swimlanes .obk-column {
	min-height: 0;
	max-height: none;
	height: auto;
	overflow: visible;
	align-self: stretch;
}

.obk-board--with-swimlanes .obk-column-body {
	flex: 1 1 auto;
	max-height: none;
	overflow-y: visible;
	min-height: 0;
}

/* The outer container caps height in flat mode; release it in swimlane mode
   so the board grows to fit all lanes and the parent scroll-area scrolls. */
.obk-view-container--with-swimlanes {
	overflow: visible;
	height: auto;
}

/* Collapsed lane: cap the column body at about 30% less than the original
   420px height and scroll within the
   column. The lane and column themselves stay flexible — only the card
   container is capped. */
.obk-swimlane--collapsed .obk-column-body {
	max-height: 294px;
	overflow-y: auto;
}

.obk-swimlane-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	padding: 0;
	color: var(--text-muted);
	background: var(--background-modifier-border);
	border: 0;
	border-radius: 4px;
	cursor: pointer;
	user-select: none;
	--icon-size: var(--icon-xs);
	transition:
		background 0.1s ease,
		color 0.1s ease;
}

.obk-swimlane-toggle:hover {
	color: var(--text-normal);
	background: var(--background-modifier-border-hover);
}

.obk-swimlane-toggle:focus-visible {
	outline: 2px solid var(--background-modifier-border-focus);
	outline-offset: 2px;
}

.obk-swimlane-drag-handle {
	cursor: grab;
	padding: 2px 4px;
	opacity: 0.5;
	user-select: none;
	font-size: 14px;
	line-height: 1;
	color: var(--text-muted);
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.obk-swimlane-drag-handle:hover {
	opacity: 1;
	color: var(--text-normal);
}

.obk-swimlane-drag-handle:active {
	cursor: grabbing;
}

.obk-swimlane-dragging {
	opacity: 0.5;
}

.obk-swimlane-ghost {
	opacity: 0.3;
	background: var(--background-modifier-border);
}

.obk-swimlane-body::-webkit-scrollbar {
	height: 8px;
}
.obk-swimlane-body::-webkit-scrollbar-track {
	background: transparent;
}
.obk-swimlane-body::-webkit-scrollbar-thumb {
	background: var(--background-modifier-border);
	border-radius: 4px;
}
.obk-swimlane-body::-webkit-scrollbar-thumb:hover {
	background: var(--background-modifier-border-hover);
}

/* Kanban Column */
.obk-column {
	--obk-column-accent-color: transparent;
	flex: 0 0 clamp(200px, 60cqw, 280px);
	display: flex;
	flex-direction: column;
	background: var(--background-secondary);
	border-radius: 8px;
	border: 1px solid var(--background-modifier-border);
	min-height: 200px;
	max-height: 100%;
	overflow: hidden;
}

.obk-column-header {
	padding: 12px 16px;
	background: color-mix(in srgb, var(--obk-column-accent-color, transparent) 15%, var(--background-primary-alt));
	border-bottom: 1px solid var(--background-modifier-border);
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-shrink: 0;
	gap: 8px;
}

/* Column color picker button */
.obk-column-color-btn {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 2px solid var(--background-modifier-border);
	background: var(--obk-column-accent-color, transparent);
	cursor: pointer;
	flex-shrink: 0;
	transition:
		transform 0.1s ease,
		border-color 0.1s ease;
}

.obk-column-color-btn:hover {
	border-color: var(--text-muted);
	transform: scale(1.15);
}

/* Color picker popover */
.obk-column-color-popover {
	position: fixed;
	background: var(--background-primary);
	border: 1px solid var(--background-modifier-border);
	border-radius: 8px;
	padding: 8px;
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	width: 164px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	z-index: 100;
}

.obk-column-color-swatch {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	cursor: pointer;
	border: 2px solid transparent;
	transition:
		transform 0.1s ease,
		border-color 0.1s ease;
}

.obk-column-color-swatch:hover {
	transform: scale(1.2);
}

.obk-column-color-swatch--active {
	border-color: var(--text-normal);
}

.obk-column-color-none {
	background: var(--background-modifier-border);
	position: relative;
}

.obk-column-color-none::before,
.obk-column-color-none::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 1.5px;
	background: var(--text-muted);
	border-radius: 1px;
	transform-origin: center;
}

.obk-column-color-none::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

.obk-column-color-none::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.obk-column-drag-handle {
	cursor: grab;
	padding: 4px;
	opacity: 0.5;
	user-select: none;
	font-size: 16px;
	line-height: 1;
	color: var(--text-muted);
	display: flex;
	align-items: center;
}

.obk-column-drag-handle:hover {
	opacity: 1;
	color: var(--text-normal);
}

.obk-column-drag-handle:active {
	cursor: grabbing;
}

.obk-column-title {
	flex: 1;
	font-weight: 600;
	font-size: 14px;
	color: var(--text-normal);
	text-transform: capitalize;
}

.obk-column-count {
	font-size: 12px;
	color: var(--text-muted);
	background: color-mix(in srgb, var(--obk-column-accent-color, transparent) 15%, var(--background-modifier-border));
	padding: 2px 8px;
	border-radius: 12px;
}

.obk-column-add-btn,
.obk-column-remove-btn {
	width: 24px;
	height: 24px;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--text-muted);
	cursor: pointer;
	flex-shrink: 0;
	transition:
		background 0.1s ease,
		color 0.1s ease,
		opacity 0.1s ease;
}

.obk-column-add-btn {
	opacity: 0.55;
}

.obk-column:hover .obk-column-add-btn,
.obk-column-add-btn:focus-visible {
	opacity: 1;
}

.obk-column-add-btn:hover,
.obk-column-remove-btn:hover {
	color: var(--text-normal);
	background: var(--background-modifier-hover);
}

.obk-column-add-btn .svg-icon {
	width: 16px;
	height: 16px;
}

.obk-column-remove-btn {
	font-size: 18px;
	line-height: 1;
}

.obk-column-body {
	flex: 1;
	overflow-y: auto;
	padding: 10px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-height: 0;
}

.obk-column-body::-webkit-scrollbar {
	width: 6px;
}

.obk-column-body::-webkit-scrollbar-track {
	background: transparent;
}

.obk-column-body::-webkit-scrollbar-thumb {
	background: var(--background-modifier-border);
	border-radius: 3px;
}

.obk-column-body::-webkit-scrollbar-thumb:hover {
	background: var(--background-modifier-border-hover);
}

/* Kanban Card */
.obk-card {
	background: var(--background-primary);
	border: 1px solid
		color-mix(in srgb, var(--obk-column-accent-color, transparent) 15%, var(--background-modifier-border));
	border-radius: 6px;
	padding: 12px;
	cursor: pointer;
	transition: all 0.2s ease;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* targets touch-first devices (tablets, phones) to make the kanban genuinely usable on
   touch screens — any-pointer: coarse alone would also match hybrid devices (e.g.
   touchscreen laptops) where the primary pointer is still a mouse */
@media (any-pointer: coarse) and (hover: none) {
	.obk-card {
		user-select: none;
		-webkit-user-select: none;
	}
}

.obk-card--hover {
	border-color: var(--interactive-accent);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	transform: translateY(-1px);
}

.obk-card--active {
	border-color: var(--interactive-accent);
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--interactive-accent) 25%, transparent);
}

.obk-card-cover {
	display: block;
	/* Bleed the cover to the card's inner border edge. Card has padding: 12px,
	   so we expand the width by 24px and pull the box out with negative margins.
	   width: 100% alone only fills the content box and leaves a 12px gap on each side. */
	width: calc(100% + 24px);
	margin: -12px -12px 8px -12px;
	/* aspect-ratio is set inline from the imageAspectRatio config */
	overflow: hidden;
	border-top-left-radius: inherit;
	border-top-right-radius: inherit;
}

.obk-card-cover img {
	width: 100%;
	height: 100%;
	display: block;
}

.obk-card-cover--fit-cover img {
	object-fit: cover;
}

.obk-card-cover--fit-contain img {
	object-fit: contain;
	background: var(--background-secondary);
}

.obk-card-title {
	font-weight: 500;
	font-size: 14px;
	color: var(--text-normal);
	line-height: 1.4;
	word-wrap: break-word;
}

.obk-card-preview {
	font-size: 12px;
	color: var(--text-muted);
	line-height: 1.4;
	margin-top: 6px;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
}

.obk-card-property {
	font-size: var(--font-ui-smaller);
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	display: flex;
	gap: 6px;
	margin-top: 4px;
}

.obk-card-property-wrap {
	white-space: normal;
	text-overflow: initial;
}

.obk-card-property-wrap .obk-card-property-value {
	white-space: normal;
	text-overflow: initial;
}

.obk-card-property-label {
	color: var(--text-muted);
	flex-shrink: 0;
}

.obk-card-property-value {
	overflow: hidden;
	text-overflow: ellipsis;
}

.obk-card-property-value p {
	display: inline;
	margin: 0;
}

.obk-quick-add-form {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.obk-quick-add-input {
	width: 100%;
}

.obk-quick-add-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

/* Drag and Drop States */
.obk-card-dragging {
	opacity: 0.5;
	transform: rotate(2deg);
}

.obk-card-ghost {
	opacity: 0.3;
	background: var(--interactive-accent);
	border-color: var(--interactive-accent);
}

.obk-card-chosen {
	cursor: grabbing;
	transform: rotate(2deg);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Column Drag and Drop States */
.obk-column-dragging {
	opacity: 0.5;
}

.obk-column-ghost {
	opacity: 0.3;
	background: var(--background-modifier-border);
}

/* Sortable placeholder */
.obk-sortable-ghost {
	opacity: 0.4;
	background: var(--interactive-accent);
	border: 2px dashed var(--interactive-accent);
	border-radius: 6px;
}
