/* Kumbukum — App Styles */

:root {
	--kk-font-body: "Noto Sans Variable", system-ui, -apple-system, "Segoe UI", sans-serif;
	--kk-font-mono: "Noto Sans Mono Variable", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	--bs-body-font-family: var(--kk-font-body);
	--bs-body-font-size: 0.93rem;
	--bs-badge-font-weight: 400;
	--sidebar-bg: #f8f9fa;
	--chat-bg: #f8f9fa;
	--tag-color: #495057;
	--bs-border-color: #2a386d;
	--bs-nav-tabs-link-hover-border-color: #2a386d;
}

body {
	height: 100vh;
	font-family: var(--kk-font-body);
}

.kk-icon.material-symbols-outlined {
	display: inline-block;
	width: 1em;
	overflow: hidden;
	font-family: "Material Symbols Outlined Variable", "Material Symbols Outlined";
	font-size: 1.18em;
	font-weight: normal;
	font-style: normal;
	line-height: 1;
	text-transform: none;
	letter-spacing: normal;
	white-space: nowrap;
	word-wrap: normal;
	direction: ltr;
	vertical-align: -0.155em;
	font-feature-settings: "liga";
	font-variation-settings:
		"FILL" 0,
		"wght" 400,
		"GRAD" 0,
		"opsz" 24;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.kk-icon,
.btn .kk-icon,
.nav-link .kk-icon,
.dropdown-item .kk-icon,
.list-group-item .kk-icon,
.batch-floating-bar .kk-icon {
	font-size: 1.22em;
}

.kk-icon-xl,
.kk-icon.kk-icon-xl,
.kk-icon-xl .kk-icon {
	font-size: 2em !important;
	vertical-align: -0.255em;
}

.batch-floating-bar .btn .kk-icon {
	font-size: 1.24em;
	vertical-align: -0.25em;
}

.slash-menu-icon {
	width: 18px;
	text-align: center;
}

.rm-shared-tag-icon {
	font-size: 0.55rem;
}

code,
kbd,
pre,
samp,
.font-monospace {
	font-family: var(--kk-font-mono);
}

body.kk-no-chat-sidebar #chat-sidebar,
body.kk-no-chat-sidebar #chat-results-panel {
	display: none !important;
}

@media (min-width: 768px) {
	body.kk-no-chat-sidebar #page-content > .row > .col-md-3:first-child {
		flex: 0 0 200px;
		width: 200px;
		max-width: 200px;
	}

	body.kk-no-chat-sidebar #page-content > .row > .col-md-9:last-child {
		flex: 1 1 0;
		width: auto;
		max-width: none;
	}
}

.swal2-icon.swal2-kk-icon {
	border: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 4.25rem;
	height: 4.25rem;
	margin: 1.5rem auto 0.75rem;
	font-size: 1rem;
}

.swal2-icon.swal2-kk-icon .kk-icon {
	width: auto;
	font-size: 4.25rem;
	line-height: 1;
	vertical-align: 0;
}

.swal2-icon.swal2-success.swal2-kk-icon {
	color: #a5dc86;
}

.swal2-icon.swal2-error.swal2-kk-icon {
	color: #f27474;
}

.swal2-icon.swal2-warning.swal2-kk-icon {
	color: #f8bb86;
}

.swal2-icon.swal2-info.swal2-kk-icon,
.swal2-icon.swal2-question.swal2-kk-icon {
	color: #3fc3ee;
}

body:has(.sidebar) {
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

b,
strong {
	font-weight: 500;
}

small,
.small {
	font-size: 0.8rem;
}

.list-group-item-action {
	color: initial !important;
}

.fs-7 {
	font-size: 0.7rem;
}

.fs-9 {
	font-size: 0.9rem;
}

.card {
	border-radius: 0.5rem;
}

.bg-hover-light:hover {
	background-color: var(--bs-light) !important;
	cursor: pointer;
}

.login-header {
	font-size: 1.2rem;
	font-weight: 900;
	padding-left: 0;
	background-color: initial;
	border: initial;
}

.sidebar {
	overflow-y: auto;
	height: 100%;
}

#main-content {
	overflow-y: auto;
	height: 100%;
}

#chat-sidebar {
	overflow-y: hidden;
	height: 100%;
}

.chat-sidebar {
	display: flex;
	flex-direction: column;
	height: 100%;
}

/* Chat messages */
.chat-message {
	margin-bottom: 0.75rem;
	padding: 0.5rem 0.75rem;
	border-radius: 0.5rem;
	max-width: 90%;
}

.chat-message.user {
	background: #0d6efd;
	color: white;
	margin-left: auto;
}

.chat-message.assistant {
	background: #e9ecef;
	color: #212529;
}

/* Chat thinking indicator */
.chat-thinking span {
	display: inline-block;
	animation: chatBlink 1.4s infinite;
	font-size: 1.25rem;
	line-height: 1;
}
.chat-thinking span:nth-child(2) {
	animation-delay: 0.2s;
}
.chat-thinking span:nth-child(3) {
	animation-delay: 0.4s;
}
@keyframes chatBlink {
	0%,
	20% {
		opacity: 0.2;
	}
	50% {
		opacity: 1;
	}
	80%,
	100% {
		opacity: 0.2;
	}
}

/* Chat history items */
.chat-history-item {
	background: #f8f9fa;
	border: 1px solid #dee2e6;
	transition: background 0.15s;
}

.chat-history-item:hover {
	background: #e9ecef;
}

/* Chat results panel */
#chat-results-panel {
	border: 1px solid #dee2e6;
	border-radius: 0.5rem;
	padding: 1rem;
	background: #fafbfc;
}

#chat-results-list .card {
	border-left: 3px solid #0d6efd;
	transition: box-shadow 0.15s;
}

#chat-results-list .card:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Note list items */
.note-item {
	cursor: pointer;
	transition: background 0.15s;
}

.note-item:hover {
	background: #f0f0f0;
}

.memory-item {
	cursor: pointer;
	transition: background 0.15s;
}

.memory-item:hover {
	background: #f0f0f0;
}

.email-item {
	cursor: pointer;
	transition: background 0.15s;
}

.email-item:hover {
	background: #f0f0f0;
}

/* Project list */
.project-item {
	padding: 0;
}

.project-item-name {
	font-weight: 600;
	margin-left: 0.5rem;
}

/* Project card drop overlay (sidebar) */
.project-item .project-drop-overlay {
	position: absolute;
	inset: 0;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(253, 126, 20, 0.12);
	border: 2px dashed #fd7e14;
	border-radius: 0.5rem;
	pointer-events: none;
}

.project-drop-overlay-inner {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.8rem;
	font-weight: 600;
	color: #fd7e14;
}

.project-drop-overlay-inner i {
	font-size: 1rem;
}

/* Project overview drop overlay (reuses .drop-overlay-card from notes) */
#project-overview > .project-drop-overlay {
	position: absolute;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(108, 117, 125, 0.35);
	border-radius: 0.5rem;
}

.project-color {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	display: inline-block;
}

/* Section links in sidebar */
.section-link {
	display: flex;
	font-size: 0.85rem;
	color: var(--text);
	text-decoration: none;
}

.section-count {
	margin-left: auto;
	font-size: 0.75rem;
	color: #6c757d;
	font-weight: 500;
}

/* URL cards */
.url-card .og-image,
.url-item .og-image {
	max-height: 120px;
	object-fit: cover;
}

.og-image-thumb {
	width: 80px;
	height: 80px;
	object-fit: cover;
}

/* Memory tags */
.tag-badge {
	font-size: 0.65rem;
}
.text-bg-secondary {
	color: var(--tag-color) !important;
	background-color: #dfdfdf !important;
}
.btn-close-white {
	--bs-btn-close-filter: var(--tag-color) !important;
}

.kk-settings-tabs {
	gap: 0.5rem;
	border-bottom: 0;
	margin-bottom: 0.25rem;
}

.kk-settings-tabs .nav-link {
	border: 1px solid var(--bs-border-color);
	border-radius: 0.6rem;
	padding: 0.45rem 0.9rem;
	font-weight: 500;
	color: #495057;
	background: #fff;
	transition: all 0.15s ease-in-out;
}

.kk-settings-tabs .nav-link:hover,
.kk-settings-tabs .nav-link:focus {
	color: #212529;
	background: #f8f9fa;
	border-color: var(--bs-border-color);
	box-shadow: none;
}

.kk-settings-tabs .nav-link.active,
.kk-settings-tabs .show > .nav-link {
	color: #fff;
	background: #0d6efd;
	border-color: #0d6efd;
	box-shadow: 0 4px 14px rgba(13, 110, 253, 0.18);
}

/* Editor container */
#editor-container .ProseMirror {
	min-height: 400px;
	padding: 1rem;
	border: 1px solid #dee2e6;
	border-radius: 0.375rem;
	outline: none;
}

#editor-container .ProseMirror:focus {
	border-color: #86b7fe;
	box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

#editor-container .ProseMirror p.is-editor-empty:first-child::before,
#memory-editor-container .ProseMirror p.is-editor-empty:first-child::before,
#rm-note-editor .ProseMirror p.is-editor-empty:first-child::before,
#rm-memory-editor .ProseMirror p.is-editor-empty:first-child::before {
	content: attr(data-placeholder);
	color: #adb5bd;
	float: left;
	height: 0;
	pointer-events: none;
}

#memory-editor-container .ProseMirror {
	min-height: 400px;
	padding: 1rem;
	border: 1px solid #dee2e6;
	border-radius: 0.375rem;
	outline: none;
}

#memory-editor-container .ProseMirror:focus {
	border-color: #86b7fe;
	box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

#rm-note-editor .ProseMirror,
#rm-memory-editor .ProseMirror {
	min-height: 300px;
	padding: 1rem;
	border: 1px solid #dee2e6;
	border-radius: 0.375rem;
	outline: none;
}

#rm-note-editor .ProseMirror:focus,
#rm-memory-editor .ProseMirror:focus {
	border-color: #86b7fe;
	box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.logo-form img {
	max-height: 80px;
}

.navbar-brand img {
	max-height: 20px;
	margin-left: 0.3rem;
}

/* Ghost-style source search field */
.source-search-wrap {
	position: relative;
}

.source-search-wrap .source-search-icon {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: #adb5bd;
	font-size: 14px;
	pointer-events: none;
}

.source-search-wrap input {
	padding-left: 36px;
	border: 1px solid #e1e5e9;
	border-radius: 6px;
	background: #f9fafb;
	transition:
		border-color 0.15s,
		box-shadow 0.15s;
}

.source-search-wrap input:focus {
	background: #fff;
	border-color: #15171a;
	box-shadow: none;
}

.source-dropdown {
	border: 1px solid #e1e5e9;
	border-radius: 6px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	background: #fff;
}

.source-dropdown .list-group-item.active {
	background-color: var(--bs-list-group-action-hover-bg, rgba(0, 0, 0, 0.075));
	color: inherit;
	border-color: var(--bs-list-group-border-color);
}

#chat-result-modal .modal-body {
	overflow: visible;
}

#chat-result-modal .nav-tabs {
	--bs-nav-tabs-border-color: var(--bs-border-color);
	--bs-nav-tabs-link-hover-border-color: var(--bs-border-color);
	--bs-nav-tabs-link-active-bg: #0f1730;
	--bs-nav-tabs-link-active-border-color: var(--bs-border-color) var(--bs-border-color) #0f1730;
	border-bottom-color: var(--bs-border-color);
}

#chat-result-modal .nav-tabs .nav-link {
	outline: none;
	box-shadow: none;
	border-color: transparent;
}

#chat-result-modal .nav-tabs .nav-link:hover,
#chat-result-modal .nav-tabs .nav-link:focus,
#chat-result-modal .nav-tabs .nav-link:focus-visible {
	outline: none;
	box-shadow: none;
	border-color: var(--bs-border-color);
}

#chat-result-modal .nav-tabs .nav-link.active,
#chat-result-modal .nav-tabs .nav-item.show .nav-link {
	border-color: var(--bs-border-color) var(--bs-border-color) #0f1730;
	background: #0f1730;
}

#chat-result-modal .border,
#chat-result-modal .preview-container,
#chat-result-modal .source-dropdown,
#chat-result-modal #rm-note-editor .ProseMirror,
#chat-result-modal #rm-memory-editor .ProseMirror,
#chat-result-modal #rm-email-content {
	border-color: var(--bs-border-color) !important;
}

#chat-result-modal .preview-container {
	background: #0f1730;
}

#chat-result-modal .preview-container pre {
	border: 1px solid var(--bs-border-color);
	background: #121a34;
}

#chat-result-modal .preview-container blockquote {
	border-left-color: var(--bs-border-color);
}

#rm-url-tab-pages-count {
	background: rgba(124, 137, 188, 0.25);
	color: #dce5ff;
	font-weight: 500;
}

#rm-url-pane-pages .rm-crawl-item {
	background: rgba(23, 33, 63, 0.55) !important;
	border-color: rgba(151, 166, 206, 0.28) !important;
	color: #e8edff !important;
}

#rm-url-pane-pages .rm-crawl-item:hover {
	background: rgba(34, 47, 89, 0.85) !important;
}

#rm-url-pane-pages .rm-crawl-title {
	color: #eef2ff;
}

#rm-url-pane-pages .rm-crawl-url {
	color: #9fb0da;
}

#rm-email-thread {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.rm-email-thread-item {
	width: 100%;
	padding: 0.7rem 0.8rem;
	border: 1px solid var(--bs-border-color);
	border-radius: 0.75rem;
	background: #f7f9fc;
	color: inherit;
	text-align: left;
	transition:
		background 0.15s ease,
		border-color 0.15s ease,
		box-shadow 0.15s ease;
}

.rm-email-thread-item:hover {
	background: #eef2f7;
	border-color: var(--bs-border-color);
}

.rm-email-thread-item.is-active {
	background: #eef3ff;
	border-color: var(--bs-border-color);
	box-shadow: inset 0 0 0 1px rgba(42, 56, 109, 0.14);
}

.rm-email-thread-subject {
	color: #212529;
}

.rm-email-thread-date {
	color: #6c757d;
}

/* Batch action toolbar */
#batch-toolbar {
	padding: 0.25rem 0;
}

#batch-toolbar .btn {
	font-weight: 800 !important;
}

.batch-actions {
	padding: 0;
}

.batch-cb-wrap {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.batch-cb {
	cursor: pointer;
}

/* ---- Drop overlay for file import ---- */

#notes-drop-zone {
	min-height: 200px;
}

.drop-overlay {
	position: absolute;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(108, 117, 125, 0.35);
	border-radius: 0.5rem;
}

.drop-overlay-card {
	background: #fff;
	border-radius: 0.75rem;
	padding: 2.5rem 4rem;
	text-align: center;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.drop-overlay-icon {
	width: 64px;
	height: 64px;
	margin: 0 auto 1rem;
	border-radius: 50%;
	background: rgba(253, 126, 20, 0.1);
	display: flex;
	align-items: center;
	justify-content: center;
}

.drop-overlay-icon i {
	font-size: 1.75rem;
	color: #fd7e14;
}

/* FilePond — hidden by default, slides in during uploads */
#notes-drop-zone .filepond--root {
	height: 0;
	overflow: hidden;
	opacity: 0;
	transition:
		opacity 0.3s ease,
		height 0.3s ease,
		margin 0.3s ease;
	margin-bottom: 0;
}

#notes-drop-zone .filepond--root.filepond--active {
	height: auto;
	overflow: visible;
	opacity: 1;
	margin-bottom: 1rem;
}

/* Preview / Edit tab containers */
.preview-container {
	overflow-y: auto;
	background: #fff;
	word-wrap: break-word;
}

.preview-container img {
	max-width: 100%;
	height: auto;
}

.preview-container pre {
	background: #f8f9fa;
	padding: 0.75rem;
	border-radius: 0.375rem;
	overflow-x: auto;
}

.preview-container code {
	font-size: 0.875em;
}

.preview-container blockquote {
	border-left: 3px solid #dee2e6;
	padding-left: 1rem;
	color: #6c757d;
}

/* ---- Initials avatar ---- */
.avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	font-weight: 600;
	text-transform: uppercase;
	color: #fff;
	flex-shrink: 0;
	line-height: 1;
	user-select: none;
}

.avatar-xs {
	width: 24px;
	height: 24px;
	font-size: 0.625rem;
}

.avatar-sm {
	width: 32px;
	height: 32px;
	font-size: 0.75rem;
}

.avatar-md {
	width: 40px;
	height: 40px;
	font-size: 0.875rem;
}

.avatar-lg {
	width: 64px;
	height: 64px;
	font-size: 1.25rem;
}

.avatar-xl {
	width: 96px;
	height: 96px;
	font-size: 1.75rem;
}

/* Chat message with avatar */
.chat-msg-row {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	margin-bottom: 0.75rem;
}

.chat-msg-row.user {
	flex-direction: row-reverse;
}

.chat-msg-row .chat-message {
	margin-bottom: 0;
}

/* SweetAlert2 — prevent body height override from collapsing flex layout.
   Double-class selector raises specificity above SweetAlert2's injected <style>,
   which otherwise wins when both use !important at equal specificity. */
body.swal2-height-auto.swal2-height-auto {
	height: 100vh !important;
}

/* SweetAlert2 — keep the overlay from breaking body flex layout */
body:has(.sidebar) > .swal2-container {
	position: fixed !important;
}

/* SweetAlert2 — navbar must stay above the overlay so the dropdown still works */
body.swal2-shown .navbar {
	z-index: 1070;
}

/* SweetAlert2 — after dialog closes the leftover container must not block clicks */
body:not(.swal2-shown) > .swal2-container {
	pointer-events: none !important;
}

/* SweetAlert2 — confirm button always on the right */
.swal2-actions {
	flex-direction: row-reverse;
}

/* SweetAlert2 — form styling */
.swal2-input {
	height: auto !important;
	padding: 0.375rem 0.75rem !important;
	font-size: 0.875rem !important;
	margin: 0.15em 1em !important;
	width: calc(100% - 2em) !important;
}
.swal2-html-container label.swal-label {
	display: block;
	text-align: left;
	font-size: 0.8rem;
	font-weight: 600;
	color: #495057;
	margin: 0.6rem 1em 0.1rem;
}
.swal2-html-container .swal-hint {
	display: block;
	text-align: left;
	font-size: 0.75rem;
	color: #868e96;
	margin: 0.05rem 1em 0;
}
.swal2-html-container .input-group {
	margin: 0.15em 1em;
	width: calc(100% - 2em);
}
.swal2-html-container .input-group .form-control {
	font-size: 0.875rem;
}
