.list-container {
	display: flex;
	flex-direction: column;
	min-height: 200px;
}

/* Fixed height scrollable container */
.list-scroll-container {
	max-height: 60svh;
	overflow-y: auto;
	overflow-x: hidden;
	scrollbar-color: color-mix(in srgb, var(--text) 20%) transparent;
	flex: 1;
	min-height: 0;
	width: 100%;
}

.list-selector-row {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
	gap: 12px;
	flex-wrap: wrap;
}

.list-selector-row h2 {
	font-size: 17px;
	color: var(--text);
	margin: 0;
	white-space: nowrap;
	flex-shrink: 0;
}

.list-heading-link {
	color: var(--text);
	cursor: pointer;
}

.list-heading-link:hover {
	opacity: 0.7;
}

/* Selector and controls wrapper */
.list-selector-controls {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 1;
	min-width: 0;
	justify-content: flex-end;
}

/* List actions buttons */
.list-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
}

.list-input-row {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 10px;
	margin: 8px 0 16px 0;
}

#add-btn,
.share-list-btn {
	width: 72px;
}

.list-input-row input[type="text"] {
	flex: 1;
	padding: 10px 4px;
	border: none;
	border-bottom: 1px solid var(--border-color);
	border-radius: 0;
	background: transparent;
	color: var(--text);
	font-size: 15px;
	outline: none;
	transition: border-color 0.2s;
}

.list-input-row input[type="text"]:focus {
	border-bottom-color: var(--accent);
}

.list-input-row input[type="text"]::placeholder {
	color: var(--text-muted);
	opacity: 0.5;
}

/* New list row styling */
/* List selector button (replaces select dropdown) */
.list-selector-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border: none;
	border-bottom: 1px solid var(--border-color);
	border-radius: 0;
	background: transparent;
	color: var(--text);
	font-size: 14px;
	cursor: pointer;
	outline: none;
	flex: 1;
	min-width: 120px;
	max-width: 200px;
}

.list-selector-btn:hover {
	border-bottom-color: var(--accent);
}

.list-selector-name {
	flex: 1;
	text-align: left;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.list-selector-arrow {
	font-size: 11px;
	opacity: 0.7;
	flex-shrink: 0;
}

.list-selector-list {
	overflow-y: auto;
	padding: 0;
	flex: 1;
	position: relative;
}

.list-selector-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 0;
	border-bottom: 1px solid var(--border-color);
	cursor: pointer;
}

.list-selector-item:last-child {
	border-bottom: none;
}

.list-selector-item:hover {
	background-color: color-mix(in srgb, var(--text) 5%, transparent);
}

.list-selector-item.selected {
	background-color: color-mix(in srgb, var(--text) 8%, transparent);
}

.list-selector-item-info {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	overflow: hidden;
}

.list-selector-item-name {
	font-weight: 500;
	font-size: 14px;
	color: var(--text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	cursor: text;
	padding: 4px 8px;
	margin: -4px -8px;
	border-radius: 4px;
}

.list-selector-item-name:hover {
	background-color: color-mix(in srgb, var(--text) 10%, transparent);
}

.list-selector-item-name:focus {
	background-color: color-mix(in srgb, var(--text) 15%, transparent);
	outline: none;
}

.list-selector-item-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	opacity: 0;
}

.list-selector-item:hover .list-selector-item-actions {
	opacity: 1;
}

.list-selector-item-actions button {
	width: 32px;
	height: 32px;
	border: none;
	background: transparent;
	color: var(--text);
	opacity: 0.5;
	font-size: 14px;
	cursor: pointer;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.list-selector-item-actions button:hover:not(:disabled) {
	opacity: 1;
	background-color: color-mix(in srgb, var(--text) 15%, transparent);
}

.list-selector-item-actions button:disabled {
	opacity: 0.15;
	cursor: default;
}

.list-selector-more {
	width: 32px;
	height: 32px;
	font-size: 14px;
}

.list-selector-create-btn {
	font-size: 14px;
	width: 100%;
}

/* Always show actions on touch devices */
@media (hover: none) {
	.list-selector-item-actions {
		opacity: 1;
	}
}

/* Todo list container */
#lists-container {
	width: 100%;
}

#lists-container ul {
	list-style: none;
	padding: 0;
	margin: 0;
	width: 100%;
}

.list-ul {
	list-style: none;
	padding: 0;
	margin: 0;
	width: 100%;
	position: relative;
}

.item-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 12px;
	border-bottom: 1px solid var(--border-color);
	width: 100%;
	box-sizing: border-box;
}

.item-row:last-child {
	border-bottom: none;
}

.item-row:hover {
	background-color: color-mix(in srgb, var(--text) 5%, transparent);
}

.list-item {
	height: 48px;
	padding: 0 12px;
	flex-shrink: 0;
}

.list-item .item-text {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.list-item.is-overflowing .item-text {
	cursor: pointer;
}

.item-row.completed .item-text {
	text-decoration: line-through;
	opacity: 0.6;
}

.item-checkbox {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	cursor: pointer;
}

.item-text {
	flex: 1;
	font-size: 15px;
	color: var(--text);
	outline: none;
	cursor: text;
	word-break: break-word;
}

.item-more {
	width: 28px;
	height: 28px;
	flex-shrink: 0;
}

/* Drag handle */
.drag-handle {
	cursor: grab;
	background: transparent;
	border: none;
	color: var(--text-muted);
	padding: 4px;
	margin: -4px;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	opacity: 0.5;
	transition: opacity 0.2s, background-color 0.2s;
	-webkit-touch-callout: none;
	user-select: none;
	-webkit-user-select: none;
}

.drag-handle:hover {
	opacity: 0.8;
	background-color: color-mix(in srgb, var(--text) 10%, transparent);
}

.drag-handle:active {
	cursor: grabbing;
	opacity: 1;
}

/* Visual-only drag hint (non-interactive) */
.drag-hint {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	color: var(--text);
	opacity: 0.3;
	user-select: none;
	-webkit-user-select: none;
	cursor: grab;
}

.drag-hint:active {
	cursor: grabbing;
}

.item-drag-hint {
	width: 20px;
	height: 20px;
}

.list-index-drag-hint {
	width: 24px;
	height: 24px;
}

.list-selector-drag-hint {
	width: 20px;
	height: 20px;
}

/* Dragging state */
.dragging {
	position: relative;
	z-index: 100;
	opacity: 0.95;
}

.drag-pop {
	transform: scale(1.03);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
	transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

/* Drop indicator */
.drop-indicator {
	position: absolute;
	left: 0;
	right: 0;
	height: 3px;
	background: var(--accent);
	border-radius: 2px;
	z-index: 101;
	display: none;
	pointer-events: none;
	box-shadow: 0 0 6px var(--accent);
}

.list-empty {
	padding: 2rem 1rem;
	text-align: center;
	color: var(--text-muted);
	font-size: 15px;
}

.list-footer {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 8px;
	padding: 8px 0;
	font-size: 14px;
	color: var(--text-muted);
	text-align: center;
}

/* Footer actions container for Sort and Clear Completed buttons */
.list-footer-actions {
	display: flex;
	gap: 8px;
	align-items: center;
}

.list-footer-actions .btn {
	padding: 6px 12px;
	font-size: 12px;
	width: 120px;
	max-width: none;
}

.btn.hidden {
	opacity: 0;
	pointer-events: none;
	max-width: 0;
	padding-left: 0;
	padding-right: 0;
	border-left-width: 0;
	border-right-width: 0;
	overflow: hidden;
}

/* ============================================================================
   TODO LIST WIDGET (homepage paginated version)
   ============================================================================ */

.list-widget {
	min-height: auto;
	padding: 0;
    padding-top: 14px;
}

.list-widget .list-selector-row {
	margin-bottom: 8px;
}

.list-widget .list-input-row {
	margin: 6px 0 12px 0;
	gap: 8px;
}

.list-widget .list-input-row input[type="text"] {
	padding: 8px 4px;
	font-size: 14px;
}

.list-widget .item-row {
	padding: 10px 8px;
}

.list-widget .list-item {
	padding: 0 8px;
}

.list-widget .list-empty {
	padding: 1.25rem 0.75rem;
	font-size: 14px;
}

.list-shortcut-btn {
	color: var(--text-muted);
}

.list-widget-slots {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	max-height: 384px;
	position: relative;
}

.list-widget-slots .list-empty {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Nav button row */
.list-widget-nav-container {
	display: flex;
	align-items: center;
	padding: 8px 0;
	border-top: 1px solid var(--border-color);
	gap: 12px;
	width: 100%;
}

.list-widget-nav-container:empty {
	display: none;
}

.list-widget-nav-btn {
	flex: 1;
	font-size: 13px;
}

.list-widget-nav-btn:disabled {
	opacity: 0.3;
	cursor: default;
}

/* ============================================================================
   LISTS INDEX PAGE
   ============================================================================ */

.lists-index-container {
	width: 100%;
	display: flex;
	flex-direction: column;
	height: calc(100svh - 64px);
}

.lists-index-grid {
	flex: 1;
	min-height: 0;
}

.lists-index-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0;
	padding: 16px 0;
	border-bottom: 1px solid var(--border-color);
	gap: 12px;
	flex-wrap: wrap;
}

.lists-index-header h1 {
	position: static;
	display: block;
	margin: 0;
	font-size: 20px;
}

.lists-index-grid {
	display: flex;
	flex-direction: column;
	position: relative;
}

.list-index-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 12px;
	border-bottom: 1px solid var(--border-color);
	cursor: pointer;
}

.list-index-card:last-child {
	border-bottom: none;
}

.list-index-card:hover {
	background-color: color-mix(in srgb, var(--text) 5%, transparent);
}

.list-index-card-content {
	flex: 1;
	min-width: 0;
}

.list-index-card-name {
	font-size: 17px;
	font-weight: 600;
	color: var(--text);
	word-break: break-word;
}

.list-index-card-meta {
	font-size: 13px;
	color: var(--text-muted);
	margin-top: 4px;
}

.list-index-card-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
}

.list-index-card-actions button {
	width: 32px;
	height: 32px;
	border: 1px solid var(--border-color);
	background: transparent;
	color: var(--text-muted);
	font-size: 14px;
	cursor: pointer;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: all 0.2s;
}

.list-index-card:hover .list-index-card-actions button {
	opacity: 0.8;
}

.list-index-card-actions button:hover {
	opacity: 1;
	background: var(--bg-2);
	color: var(--text);
	border-color: var(--border-color);
}

.list-index-delete:hover {
	color: var(--error);
	border-color: var(--error);
}

.list-index-more {
	width: 32px;
	height: 32px;
	font-size: 14px;
}

/* Disabled move buttons */
.list-index-move-top:disabled,
.list-index-move-bottom:disabled {
	opacity: 0.25;
	cursor: default;
}

.lists-index-empty {
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 3rem 1rem;
	gap: 1rem;
	text-align: center;
	color: var(--text-muted);
	font-size: 15px;
}

.lists-index-empty p {
	margin: 0;
}

/* ============================================================================
   LIST DETAIL PAGE
   ============================================================================ */

.list-detail-container {
	width: 100%;
	display: flex;
	flex-direction: column;
	height: calc(100svh - 64px);
}

.list-detail-container pockist-list {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
}

.list-detail-container .list-container {
	flex: 1;
	min-height: 0;
}

.list-detail-container .list-scroll-container {
	max-height: none;
	flex: 1;
	min-height: 0;
}

.list-detail-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
	padding: 16px 0;
	border-bottom: 1px solid var(--border-color);
	flex-wrap: wrap;
}

.list-detail-heading {
	margin: 0;
	font-size: 20px;
	color: var(--text);
	word-break: break-word;
	padding: 4px 8px;
	margin: -4px -8px;
	border-radius: 4px;
	cursor: text;
	border-bottom: 1px dashed var(--border-color);
}

.list-detail-heading:hover {
	background-color: color-mix(in srgb, var(--text) 8%, transparent);
}

.list-detail-heading:focus {
	background-color: color-mix(in srgb, var(--text) 15%, transparent);
	outline: none;
	border-bottom-color: transparent;
}

.list-detail-share-btn {
	margin-left: auto;
}

/* Always show card actions on touch devices */
@media (hover: none) {
	.list-index-card-actions button {
		opacity: 0.8;
	}
}

/* Responsive */
@media (max-width: 640px) {
	.list-input-row {
		gap: 8px;
	}

	.list-input-row input[type="text"] {
		font-size: 14px;
	}
}
