/**
 * Problem Collection Styles v2 — Compact Table Layout
 */

/* Container — centered */
.collections-container {
	margin: 24px auto 0;
	max-width: 870px;
}

.collections-hardmode-wrap {
	margin-bottom: 24px;
}

/* Guest notice */
.collections-guest-notice {
	font-size: 14px;
	margin-bottom: 16px;
	text-align: center;
}
.collections-guest-notice a {
	font-weight: 500;
}

/* Table */
.collections-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
}

.collections-table tr {
	cursor: pointer;
	transition: background 0.15s;
}

.collections-table tr:hover {
    /* background: rgb(241 166 5 / 5%); */
		background: rgb(0 0 0 / 2%);
}

.collections-table tr.locked:hover {
	background: none;
}

.bb-dark-theme .collections-table tr:hover {
	background: rgba(255, 255, 255, 0.04);
}

.bb-dark-theme .collections-table tr.locked:hover {
	background: none;
}

.collections-table td {
	padding: 8px 16px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
	vertical-align: middle;
}

.bb-dark-theme .collections-table td {
	border-bottom-color: rgba(255, 255, 255, 0.08);
}

.collections-table tr:last-child td {
	border-bottom: none;
}

/* Column: Title */

.collections-table td.col-title {
	line-height: 1.45;
}

.col-title-name {
	font-size: 16px;
	font-weight: 500;
	line-height: 1.2;
}

.col-title-author {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 13px;
	color: var(--gm-text-secondary, #888);
	margin-top: 5px;
	flex-wrap: wrap;
}

/* Level badge (mobile-only, color by difficulty 1–4) */
.col-title-level {
	display: none;
	font-size: 11px;
	font-weight: 500;
	padding: 3px 7px;
	border-radius: 1rem;
	line-height: 1;
	white-space: nowrap;
}
.col-title-level.level-1 {
	background: rgba(254, 173, 1, 0.1);
	color: rgb(225 158 17);
}
.col-title-level.level-2 {
	background: rgba(17, 188, 168, 0.1);
	color: rgb(17, 188, 168);
}
.col-title-level.level-3 {
	background: rgba(145, 156, 255, 0.1);
	color: rgb(145 156 255);
}
.col-title-level.level-4 {
	background: rgba(255, 105, 159, 0.1);
	color: rgb(255 105 159);
}
/* Author row that only has the level badge — hidden on desktop */
.col-title-author.level-only {
	display: none;
}

/* Tier badge */
.col-tier-badge {
	display: inline-block;
	font-size: 12px;
	font-weight: 500;
	padding: 3px 7px;
	border-radius: 1rem;
	line-height: 1;
	text-transform: uppercase;
	white-space: nowrap;
}
.col-tier-badge.tier-silver {
    background: #1b93b424;
    color: #1B93B4;
}
.col-tier-badge.tier-gold {
    background: #ffaf0024;
    color: #d59100;
}
.col-tier-badge.tier-magic {
    background: #007cff26;
    color: #007cff;
}
.col-tier-badge.tier-trial {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
		text-transform: none;
}

a.col-tier-badge {
	text-decoration: none;
	cursor: pointer;
}
a.col-tier-badge:hover {
	filter: brightness(1.1);
}

.col-tier-lock {
	font-size: 11px;
	margin-right: 5px;
	vertical-align: middle;
}

/* Column: Description */
.col-desc {
	font-size: 13px;
	min-width: 150px;
	max-width: 260px;
	vertical-align: middle;
}

.col-desc-inner {
	line-height: 1.3;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
}

/* Column: Progress Ring */
.col-progress-ring {
	text-align: center;
	line-height: 0;
	min-width: 50px;
}
.progress-ring-wrap {
	--ring-size: 58px;
	position: relative;
	display: inline-block;
	width: var(--ring-size);
	height: var(--ring-size);
}
.progress-ring-bg {
	stroke: rgba(0, 0, 0, 0.08);
}
.progress-ring-fill {
	stroke: var(--gm-blue, #007cff);
	transition: stroke-dashoffset 0.4s ease;
}
.progress-ring-text {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	line-height: 1.15;
	pointer-events: none;
	color: var(--gm-text-secondary, #888);
}
.progress-ring-text b {
	font-size: 13px;
	font-weight: 700;
	color: var(--gm-text-primary, #333);
}
.bb-dark-theme .progress-ring-text b {
	color: var(--gm-text-primary, #eee);
}

/* Column: Level */
.col-level {
	white-space: nowrap;
	text-align: center;
}

.col-level .col-title-level {
	display: inline-block;
	font-size: 13px;
}

/* Column: Shuffle */
.col-shuffle {
	width: 32px;
	text-align: center;
}

.shuffle-btn {
	cursor: pointer;
	padding: 4px;
	line-height: 1;
	opacity: 0.75;
	transition: opacity 0.2s;
}

.shuffle-btn i {
	font-size: 17px;
}

.shuffle-btn:hover {
	opacity: 1;
}

.shuffle-btn.active {
	opacity: 1;
	color: var(--gm-blue, #007cff);
}

.shuffle-btn.active:focus {
	color: var(--gm-blue, #007cff);
}

.shuffle-btn.disabled {
	opacity: 0.3;
	cursor: default;
}
.shuffle-btn.disabled:hover {
	opacity: 0.3;
}

/* Column: Actions (kebab) */
.col-actions {
	width: 40px;
	text-align: center;
	position: relative;
}

.kebab-btn {
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px 10px;
	border-radius: 6px;
	font-size: 18px;
	line-height: 1;
	transition: background 0.15s;
	letter-spacing: 1px;
}

.kebab-btn:focus-visible {
	outline: 2px solid var(--gm-blue, #007cff);
}

.kebab-btn:hover {
	background: rgba(0, 0, 0, 0.03);
}

.bb-dark-theme .kebab-btn:hover {
	background: rgba(255, 255, 255, 0.1);
}

.kebab-dropdown {
	display: none;
	position: absolute;
	right: 8px;
	top: 75%;
	background: var(--gm-block-bg, #fff);
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
	z-index: 10000;
	min-width: 200px;
	padding: 4px 0;
}

.bb-dark-theme .kebab-dropdown {
	border-color: rgba(255, 255, 255, 0.15);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.kebab-dropdown.open {
	display: block;
}

.kebab-dropdown-item {
	display: block;
	width: 100%;
	padding: 8px 16px;
	border: none;
	background: none;
	cursor: pointer;
	font-size: 14px;
	text-align: left;
	color: inherit;
	white-space: nowrap;
	transition: background 0.15s;
}

.kebab-dropdown-item:hover {
	background: rgba(0, 0, 0, 0.04);
}

.bb-dark-theme .kebab-dropdown-item:hover {
	background: rgba(255, 255, 255, 0.06);
}

.kebab-dropdown-item.disabled {
	opacity: 0.4;
	cursor: default;
	pointer-events: none;
}

.kebab-dropdown-item.danger {
	color: var(--gm-red, #e3051e);
}

.kebab-dropdown-item.danger:hover {
	background: rgba(227, 5, 30, 0.06);
}

/* Kebab: shuffle item */
.collection-shuffle-kebab {
	display: flex;
	align-items: center;
}
.collection-shuffle-kebab i {
	font-size: 16px;
	margin-left: auto;
	padding-left: 12px;
	transition: color 0.15s;
}
.collection-shuffle-kebab.active i {
	color: var(--gm-blue, #007cff);
}

/* Details Modal */
#collection-details-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 100000;
	background: rgba(0, 0, 0, 0.5);
	align-items: center;
	justify-content: center;
}

#collection-details-modal.open {
	display: flex;
}

.collection-info-content {
	background: var(--gm-block-bg, #fff);
	border-radius: 16px;
	padding: 28px 32px;
	max-width: 480px;
	width: 90%;
	max-height: 80vh;
	overflow-y: auto;
	position: relative;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.collection-info-close {
	position: absolute;
	top: 12px;
	right: 16px;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 24px;
	color: var(--gm-text-secondary, #888);
	line-height: 1;
	padding: 12px;
}

.collection-info-close:hover {
	color: inherit;
}

.collection-info-title {
	font-size: 20px;
	font-weight: 500;
	margin-bottom: 4px;
	padding-right: 32px;
}

.collection-info-author {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 14px;
	color: var(--gm-text-secondary, #888);
	margin-bottom: 16px;
}

.collection-info-desc {
	font-size: 15px;
	line-height: 1.5;
	margin-bottom: 16px;
}
.collection-info-desc p {
	margin: 0 0 0.5em;
}
.collection-info-desc p:last-child {
	margin-bottom: 0;
}

.collection-info-meta {
	display: flex;
	flex-direction: column;
	gap: 8px;
	font-size: 14px;
}

.collection-info-meta-row {
	display: flex;
	gap: 8px;
}

.collection-info-meta-label {
	font-weight: 500;
	min-width: 90px;
	color: inherit;
}

/* Chapter list in details modal */
.collection-info-chapters {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.bb-dark-theme .collection-info-chapters {
	border-top-color: rgba(255, 255, 255, 0.08);
}
.collection-info-chapter-name {
	min-width: 90px;
}

/* GMBoard Modal Window */
#collection_window {
	position: fixed;
	top: 0;
	bottom: 0;
	left: 0;
	right: 0;
	width: 100vw;
	height: 100vh;
	height: 100dvh;
	background: var(--bg-light);
	display: none;
	z-index: 99999;
	overflow-y: overlay !important;
	overflow-y: scroll;
	overflow-x: hidden;
	scrollbar-gutter: stable;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	touch-action: pan-y;
}

.bb-dark-theme #collection_window {
	background: var(--bg-dark);
}

#collection_window.loading_animation .loading_elem {
	display: block;
}

#collection_close {
	top: 19px;
	right: 24px;
	color: black;
	position: fixed;
	background: rgb(0 0 0 / 8%);
	z-index: 9999;
	border: none;
	cursor: pointer;
	padding: 10px;
	line-height: 1;
}

#collection_close i {
	font-size: 42px;
}

.bb-dark-theme #collection_close {
	color: white;
	background: rgb(255 255 255 / 10%);
}

/* Collection title above board */
#collection-board-title {
	text-align: center;
	padding: 20px 60px 4px;
}
#collection-board-title h3 {
	font-size: 20px;
	font-weight: 900;
	margin: 0;
}

/* Ghost mode indicator */
/*
.collections-container.ghost-active .collection-row:not([data-disable-hardmode="1"]) .col-title-name::after {
	content: '\1F47B';
	margin-left: 6px;
}
 */

/* Ghost mode — ring color (matches skill tree #f66f6f) */
.collections-container.ghost-active .collection-row:not([data-disable-hardmode="1"]) .progress-ring-fill {
	stroke: #f66f6f;
}
.collections-container.ghost-active .collection-row.completed:not([data-disable-hardmode="1"]) .progress-ring-fill {
	stroke: #f66f6f;
}
.collections-container.ghost-active .collection-row.completed:not([data-disable-hardmode="1"]) .progress-ring-text,
.collections-container.ghost-active .collection-row.completed:not([data-disable-hardmode="1"]) .progress-ring-text b {
	color: #f66f6f;
}
.collections-container.ghost-active .collection-row:not([data-disable-hardmode="1"]) .progress-ring-bg {
	stroke: rgba(246, 111, 111, 0.12);
}

/* Row Status — In-progress */
.collections-table tr.in-progress .progress-ring-bg {
	stroke: rgba(0, 124, 255, 0.12);
}
/* .collections-table tr.collection-row.in-progress {
	background-color: rgb(0 124 255 / 4%);
}
.collections-table tr.collection-row.in-progress:hover {
	background-color: rgb(0 124 255 / 8%);
} */

/* Row Status — Completed */
.collections-table tr.completed .progress-ring-fill {
	stroke: var(--gm-green, #3c6);
}
.collections-table tr.completed .progress-ring-text,
.collections-table tr.completed .progress-ring-text b {
	color: var(--gm-green, #3c6);
}
/* .collections-table tr.collection-row.completed {
	background-color: rgb(51 204 102 / 5%);
}
.collections-table tr.collection-row.completed:hover {
	background-color: rgb(51 204 102 / 9%);
} */

/* Dark theme ring overrides */
.bb-dark-theme .progress-ring-bg {
	stroke: rgba(255, 255, 255, 0.1);
}
.bb-dark-theme .collections-table tr.in-progress .progress-ring-bg {
	stroke: rgba(0, 124, 255, 0.2);
}
.bb-dark-theme .collections-table tr.completed .progress-ring-bg {
	stroke: rgba(52, 168, 83, 0.2);
}
/* Ghost mode ring — dark theme track */
.bb-dark-theme .collections-container.ghost-active .collection-row:not([data-disable-hardmode="1"]) .progress-ring-bg {
	stroke: rgba(246, 111, 111, 0.2);
}
@media (max-width: 860px) {
	.col-desc {
		display: none;
	}
}
@media (max-width: 768px) {
	#collection-board-title {
		display: none !important;
	}
	#collection_close {
		display: none;
	}
}
@media (max-width: 680px) {
	.col-shuffle {
		display: none;
	}
}


/* Mobile */
@media (max-width: 600px) {
	.col-level {
		display: none;
	}
	
	.col-title-level {
		display: inline-block;
	}
	.col-title-author.level-only {
		display: flex;
		margin-top: 3px;
	}

	.progress-ring-wrap {
		--ring-size: 56px;
	}

	.collections-table td {
		padding: 8px 10px;
	}

	.col-title-name {
		font-size: 15px;
	}

	.collection-info-content {
		padding: 24px 20px;
	}
}

/* ── Toolbar: search, filter, sort ── */

/* Toolbar sits inside table-wrap for unified background */
.collections-table-wrap {
	background: var(--gm-block-bg);
	border-radius: 12px;
}

.collections-toolbar {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 16px;
	flex-wrap: wrap;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.bb-dark-theme .collections-toolbar {
	border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* Search */
.col-toolbar-search {
	position: relative;
	flex: 1;
	min-width: 130px;
	max-width: 240px;
}
.col-toolbar-search i {
	position: absolute;
	left: 10px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 16px;
	color: var(--gm-text-secondary, #999);
	pointer-events: none;
}
.col-search-input {
	width: 100%;
	height: 32px;
	padding: 0 12px 0 32px;
	border: 1px solid #e5e5e5;
	border-radius: 1rem;
	font-size: 14px;
	background: transparent;
	color: inherit;
	outline: none;
	transition: border-color 0.2s;
}
.col-search-input:focus {
	border-color: var(--gm-blue, #007cff);
}
.col-search-input::placeholder {
	color: var(--gm-text-secondary, #999);
}
.bb-dark-theme .col-search-input {
	border-color: #555;
}

.col-toolbar-controls {
	display: flex;
	align-items: center;
	gap: 8px;
}

/* Dropdown */
.col-dropdown {
	position: relative;
	height: 32px;
}

.col-dropdown-toggle {
	display: inline-block;
	width: 98px;
	height: 32px;
	line-height: 32px;
	padding: 0 8px;
	border: 1px solid #e5e5e5;
	border-radius: 1rem;
	font-size: 14px;
	cursor: pointer;
	background: transparent;
	color: #4C5D6C;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	text-align: center;
	transition: border-color 0.15s, background 0.15s, color 0.15s;
	user-select: none;
}

/* Hover: border + text color. Active: filled. */
.col-dropdown-toggle:hover {
	border-color: var(--gm-blue, #007cff);
	color: var(--gm-blue, #007cff);
}
.col-dropdown-toggle.active {
	background: var(--gm-blue, #007cff);
	border-color: var(--gm-blue, #007cff);
	color: #fff;
}

.bb-dark-theme .col-dropdown-toggle {
	color: #ccc;
	border-color: #555;
}
.bb-dark-theme .col-dropdown-toggle:hover {
	border-color: var(--gm-blue, #007cff);
	color: var(--gm-blue, #007cff);
}
.bb-dark-theme .col-dropdown-toggle.active {
	background: var(--gm-blue, #007cff);
	border-color: var(--gm-blue, #007cff);
	color: #fff;
}

/* Reset button — hidden by default, shown via .visible class */
.col-reset-btn {
	display: none;
	width: 32px;
	height: 32px;
	line-height: 32px;
	text-align: center;
	border-radius: 50%;
	cursor: pointer;
	color: var(--gm-text-secondary, #888);
	transition: background 0.15s, color 0.15s;
	margin-left: auto;
}
.col-reset-btn.visible {
	display: inline-block;
}
.col-reset-btn:hover {
	background: rgba(0, 0, 0, 0.05);
	color: var(--gm-blue, #007cff);
}
.col-reset-btn i {
	font-size: 16px;
}
.bb-dark-theme .col-reset-btn:hover {
	background: rgba(255, 255, 255, 0.08);
}

/* Dropdown menu */
.col-dropdown-menu {
	display: none;
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	min-width: 180px;
	background: var(--gm-block-bg, #f9f9f9);
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
	z-index: 100;
	padding: 6px 0;
}
.col-dropdown-menu.open {
	display: block;
}
.bb-dark-theme .col-dropdown-menu {
	background: var(--gm-block-bg, #2a2a2a);
	border-color: rgba(255, 255, 255, 0.12);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Sort dropdown: right-aligned */
.sort-dropdown .col-dropdown-menu {
	left: auto;
	right: 0;
}

.col-dropdown-item {
	display: block;
	padding: 8px 14px;
	font-size: 14px;
	cursor: pointer;
	color: inherit;
	white-space: nowrap;
	transition: background 0.15s;
}
.col-dropdown-item:hover {
	background: rgba(0, 0, 0, 0.04);
}
.bb-dark-theme .col-dropdown-item:hover {
	background: rgba(255, 255, 255, 0.06);
}
.col-dropdown-item.active {
	font-weight: 500;
	color: var(--gm-blue, #007cff);
}

/* Level slider (adapted from gotests) */
.level-dropdown .col-dropdown-menu {
	min-width: 200px;
}
.col-slider-wrap {
	padding: 4px 16px;
}
.col-level-slider {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 6px;
	padding: 0;
	margin: 0;
	background: linear-gradient(to right, var(--gm-blue, #007cff) var(--progress, 0%), var(--gm-progress-bg, #d5d5d5) var(--progress, 0%));
	border: none;
	border-radius: 0;
	outline: none;
	cursor: pointer;
}
.col-level-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 8px;
	height: 20px;
	background: var(--gm-blue, #007cff);
	border: none;
	border-radius: 0;
	cursor: pointer;
}
.col-level-slider::-moz-range-thumb {
	width: 8px;
	height: 20px;
	background: var(--gm-blue, #007cff);
	border: none;
	border-radius: 0;
	cursor: pointer;
}
.col-level-slider::-moz-range-track {
	height: 6px;
	background: var(--gm-progress-bg, #d5d5d5);
	border-radius: 0;
}
.col-level-slider::-moz-range-progress {
	height: 6px;
	background: var(--gm-blue, #007cff);
	border-radius: 0;
}

/* No results */
.col-no-results {
	text-align: center;
	padding: 32px 16px;
	color: var(--gm-text-secondary, #888);
	font-size: 15px;
}

/* Responsive */
@media (max-width: 600px) {
	.col-toolbar-search {
		flex: 1;
		min-width: 0;
		max-width: none;
	}
	.col-toolbar-controls {
		margin-left: 0;
		width: 100%;
		gap: 6px;
	}
	.col-dropdown {
		flex: 1;
		height: 28px;
	}
	.col-dropdown-toggle {
		font-size: 13px;
		height: 28px;
		width: 100%;
		line-height: 28px;
		padding: 0 8px;
	}
	.collections-toolbar {
		gap: 8px;
		padding: 16px 10px;
	}	
	.col-search-input {
		font-size: 13px;
		height: 30px;
		padding-left: 28px;
	}
	.col-toolbar-search i {
		font-size: 14px;
		left: 8px;
	}
	.col-reset-btn {
		width: 28px;
		height: 28px;
	}
}
