/* Bookmark app styles. Uses theme CSS vars (--main-bg-color, --fore-color,
   --border-color-primary) set by app.ui.setTheme so it follows the active theme. */

#bookmarks { padding: 12px; }

.bm-shell {
	display: flex;
	gap: 18px;
	align-items: flex-start;
}

.bm-sidebar {
	flex: 0 0 220px;
	max-width: 220px;
	position: sticky;
	top: 70px;
}

.bm-main { flex: 1 1 auto; min-width: 0; }

.bm-add {
	width: 100%;
	margin-bottom: 14px;
	padding: 8px 10px;
	border-radius: 6px;
	cursor: pointer;
}

.bm-folder-head {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	opacity: 0.6;
	margin: 10px 0 6px;
}

.bm-folder {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 5px 10px;
	border-radius: 5px;
	cursor: pointer;
	font-size: 14px;
}
.bm-folder:hover { background: rgba(127, 127, 127, 0.12); }
.bm-folder.active { background: rgba(127, 127, 127, 0.22); font-weight: 600; }
.bm-folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-folder-del { opacity: 0; font-size: 12px; padding-left: 6px; }
.bm-folder:hover .bm-folder-del { opacity: 0.5; }
.bm-folder-del:hover { opacity: 1; color: #c0392b; }

.bm-addfolder { display: inline-block; margin-top: 6px; font-size: 13px; cursor: pointer; opacity: 0.8; }
.bm-newfolder { display: flex; gap: 4px; margin-top: 6px; }
.bm-newfolder input { flex: 1 1 auto; min-width: 0; }

.bm-tagcloud { margin-top: 16px; }
.bm-tag {
	display: inline-block;
	margin: 2px;
	padding: 2px 8px;
	border-radius: 12px;
	background: rgba(127, 127, 127, 0.15);
	font-size: 12px;
	cursor: pointer;
}
.bm-tag:hover { background: rgba(127, 127, 127, 0.3); }
.bm-tag.on { background: #4a7a96; color: #fff; }
.bm-tag em { opacity: 0.6; font-style: normal; }

.bm-toolbar {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
}
.bm-search { flex: 1 1 auto; padding: 8px 12px; border-radius: 6px; }
.bm-favfilter { padding: 7px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.bm-favfilter.on { background: #d8a200; color: #fff; }
.bm-activetag { font-size: 13px; opacity: 0.85; }
.bm-activetag a { cursor: pointer; color: #c0392b; }

.bm-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 16px;
}

.bm-card {
	border: 1px solid var(--border-color-primary, rgba(127,127,127,0.25));
	border-radius: 8px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	background: rgba(127, 127, 127, 0.04);
}
.bm-thumb-link { display: block; }
.bm-thumb {
	width: 100%;
	height: 130px;
	object-fit: cover;
	display: block;
	background: rgba(127, 127, 127, 0.1);
}
.bm-thumb-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 40px;
	font-weight: 700;
	opacity: 0.4;
}
.bm-spin {
	width: 22px; height: 22px;
	border: 3px solid rgba(127,127,127,0.3);
	border-top-color: rgba(127,127,127,0.8);
	border-radius: 50%;
	animation: bm-spin 0.8s linear infinite;
}
@keyframes bm-spin { to { transform: rotate(360deg); } }

.bm-card-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.bm-card-title-row { display: flex; align-items: flex-start; gap: 8px; }
.bm-fav {
	background: none; border: none; cursor: pointer;
	font-size: 18px; line-height: 1; color: rgba(127,127,127,0.45); padding: 0;
}
.bm-fav.on { color: #d8a200; }
.bm-card-title {
	font-weight: 600; font-size: 15px; line-height: 1.25;
	text-decoration: none; color: var(--fore-color, inherit);
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bm-card-host { font-size: 12px; opacity: 0.65; }
.bm-card-desc {
	font-size: 12.5px; opacity: 0.8;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bm-card-tags { display: flex; flex-wrap: wrap; gap: 3px; }
.bm-card-actions { display: flex; gap: 12px; font-size: 12px; margin-top: 4px; }
.bm-card-actions a { cursor: pointer; opacity: 0.75; }
.bm-card-actions a:hover { opacity: 1; }

.bm-vis { font-size: 10px; vertical-align: middle; }
.bm-vis.public { color: #2e9e57; }
.bm-vis.shared { color: #4a7a96; }
.bm-vis.private { color: rgba(127,127,127,0.5); }

.bm-empty, .bm-empty-small { opacity: 0.6; padding: 24px; text-align: center; }
.bm-empty-small { padding: 8px; text-align: left; font-size: 13px; }

/* Modal overlay */
.bm-overlay {
	position: fixed; inset: 0;
	background: rgba(0, 0, 0, 0.45);
	display: flex; align-items: flex-start; justify-content: center;
	z-index: 9000; padding: 40px 16px; overflow-y: auto;
}
.bm-modal {
	background: var(--main-bg-color, #fff);
	color: var(--fore-color, #222);
	border: 1px solid var(--border-color-primary, rgba(127,127,127,0.3));
	border-radius: 10px;
	padding: 20px 22px;
	width: 100%; max-width: 460px;
	box-shadow: 0 10px 40px rgba(0,0,0,0.35);
}
.bm-modal h3 { margin: 0 0 14px; }
.bm-modal label { display: block; font-size: 12px; opacity: 0.75; margin: 12px 0 4px; }
.bm-modal input, .bm-modal textarea, .bm-modal select {
	width: 100%; padding: 8px 10px; border-radius: 6px;
	border: 1px solid var(--border-color-primary, rgba(127,127,127,0.35));
	background: rgba(127,127,127,0.06); color: inherit; box-sizing: border-box;
}
.bm-url-error { color: #c0392b; font-size: 12px; min-height: 14px; margin-top: 4px; }
.bm-modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.bm-modal-actions button { padding: 8px 16px; border-radius: 6px; cursor: pointer; }

.bm-share-results { margin: 6px 0; max-height: 160px; overflow-y: auto; }
.bm-share-result { padding: 6px 8px; border-radius: 5px; cursor: pointer; }
.bm-share-result:hover { background: rgba(127,127,127,0.15); }
.bm-share-current { margin-top: 12px; }
.bm-share-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; }
.bm-share-row a { margin-left: auto; cursor: pointer; color: #c0392b; font-size: 12px; }

@media (max-width: 720px) {
	.bm-shell { flex-direction: column; }
	.bm-sidebar { position: static; max-width: none; flex-basis: auto; width: 100%; }
}
