/* Tiptap Notes Editor */
.tiptap-editor-container {
	border: 1px solid #d8d6de;
	border-radius: 0.357rem;
	min-height: 300px;
	padding: 0.75rem 1rem;
	cursor: text;
	background: #fff;
	font-size: 1rem;
	line-height: 1.6;
}

.tiptap-editor-container:focus-within {
	border-color: #7367f0;
	box-shadow: 0 3px 10px 0 rgba(115, 103, 240, 0.15);
}

.tiptap-editor-container .ProseMirror {
	outline: none;
	min-height: 280px;
}

.tiptap-editor-container .ProseMirror h1,
.tiptap-editor-container .ProseMirror h2,
.tiptap-editor-container .ProseMirror h3 {
	font-weight: 600;
	margin-top: 1rem;
	margin-bottom: 0.5rem;
}

.tiptap-editor-container .ProseMirror ul,
.tiptap-editor-container .ProseMirror ol {
	padding-left: 1.5rem;
}

.tiptap-editor-container .ProseMirror p {
	margin-bottom: 0.5rem;
}

mark {
	background-color: #fef9c3;
	border-radius: 2px;
	padding: 0 1px;
}

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

.tiptap-editor-container .ProseMirror ul[data-type="taskList"] {
	list-style: none;
	padding-left: 0.5rem;
}

.tiptap-editor-container .ProseMirror ul[data-type="taskList"] li {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
}

.tiptap-editor-container .ProseMirror ul[data-type="taskList"] li > label {
	margin-top: 0.2rem;
	cursor: pointer;
}

.tiptap-editor-container .ProseMirror ul[data-type="taskList"] li > div {
	flex: 1;
}

/* Tiptap Static Toolbar */
.tiptap-toolbar {
	position: relative;
	background: #f8f8f8;
	border: 1px solid #d8d6de;
	border-bottom: none;
	border-radius: 0.357rem 0.357rem 0 0;
	position: sticky;
	top: 0;
	z-index: 10;
}

/* Inner scroll wrapper — keeps the outer toolbar overflow-free so
   absolutely-positioned dropdowns are not clipped */
.tiptap-toolbar-inner {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	gap: 2px;
	padding: 6px 8px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.tiptap-toolbar + .tiptap-editor-container {
	border-top-left-radius: 0;
	border-top-right-radius: 0;
}

.tiptap-toolbar-group {
	display: flex;
	align-items: center;
	gap: 1px;
}

.tiptap-toolbar-sep {
	width: 1px;
	height: 20px;
	background: #d8d6de;
	margin: 0 4px;
}

.tiptap-toolbar-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	height: 32px;
	padding: 0 7px;
	background: none;
	border: none;
	border-radius: 4px;
	font-size: 0.95rem;
	font-weight: 600;
	color: #6e6b7b;
	cursor: pointer;
	line-height: 1;
}

.tiptap-toolbar-btn:hover {
	background: #ede9ff;
	color: #7367f0;
}

.tiptap-toolbar-btn.is-active {
	background: #7367f0;
	color: #fff;
}

.tiptap-toolbar-btn i {
	font-size: 1.15rem;
	line-height: 1;
}


/* Highlight color swatches */
.tiptap-highlight-wrap {
	position: relative;
	display: inline-flex;
}

.tiptap-highlight-wrap:hover .tiptap-highlight-swatches {
	display: flex;
}

.tiptap-highlight-swatches {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 100;
	gap: 4px;
	padding: 6px;
	background: #fff;
	border: 1px solid #d8d6de;
	border-radius: 0.357rem;
	box-shadow: 0 4px 12px rgba(0,0,0,0.12);
	margin-top: 2px;
}

.tiptap-swatch {
	width: 20px;
	height: 20px;
	border: 1px solid rgba(0,0,0,0.15);
	border-radius: 3px;
	cursor: pointer;
	padding: 0;
}

.tiptap-swatch-clear {
	background: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 0.75rem;
	color: #6e6b7b;
}

.tiptap-highlight-icon {
	font-weight: 700;
	font-size: 0.9rem;
	line-height: 1;
	border-bottom: 3px solid #fef9c3;
	padding-bottom: 1px;
}

.tiptap-toolbar-btn-highlight.is-active .tiptap-highlight-icon {
	border-bottom-color: #fff;
}

/* Toolbar generic dropdown (e.g. table actions) */
.tiptap-dropdown-wrap {
	display: inline-flex;
}

/* Menu is a direct child of .tiptap-toolbar (not the inner scroll wrapper)
   so overflow clipping from the scroll wrapper doesn't affect it */
.tiptap-dropdown-menu {
	display: none;
	flex-direction: column;
	position: absolute;
	top: 100%;
	z-index: 100;
	min-width: 160px;
	padding: 4px 0;
	background: #fff;
	border: 1px solid #d8d6de;
	border-radius: 0.357rem;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
	margin-top: 1px;
}

.tiptap-dropdown-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 12px;
	background: none;
	border: none;
	font-size: 0.875rem;
	color: #6e6b7b;
	cursor: pointer;
	text-align: left;
	white-space: nowrap;
	width: 100%;
}

.tiptap-dropdown-item:hover {
	background: #ede9ff;
	color: #7367f0;
}

/* Images — constrain in both editor and read-only rendered notes */
.tiptap-editor-container .ProseMirror img,
.note-md-content img {
	max-width: 100%;
	height: auto;
	display: block;
}

.tiptap-image-wrap {
	display: block;
	position: relative;
	max-width: 100%;
	line-height: 0;
	border-radius: 3px;
}

.tiptap-image-wrap img {
	width: 100%;
	height: auto;
	display: block;
	border-radius: 3px;
}

.tiptap-image-wrap.is-selected img {
	outline: 2px solid #7367f0;
	outline-offset: 2px;
}

.tiptap-image-resize-handle {
	position: absolute;
	bottom: -5px;
	right: -5px;
	width: 12px;
	height: 12px;
	background: #7367f0;
	border: 2px solid #fff;
	border-radius: 3px;
	cursor: se-resize;
	opacity: 0;
	transition: opacity 0.15s;
	box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.tiptap-image-wrap:hover .tiptap-image-resize-handle,
.tiptap-image-wrap.is-selected .tiptap-image-resize-handle {
	opacity: 1;
}

/* Tables — editor and read-only view */
.tiptap-editor-container .ProseMirror table,
.note-md-content table {
	border-collapse: collapse;
	width: auto;
	max-width: 100%;
	margin: 0.75rem 0;
	table-layout: fixed;
}

.tiptap-editor-container .ProseMirror th,
.tiptap-editor-container .ProseMirror td,
.note-md-content th,
.note-md-content td {
	border: 1px solid #d8d6de;
	padding: 6px 10px;
	vertical-align: top;
}

.tiptap-editor-container .ProseMirror th,
.note-md-content th {
	background: #f4f3ff;
	font-weight: 600;
}

.tiptap-editor-container .ProseMirror .selectedCell::after {
	background: rgba(115, 103, 240, 0.12);
	content: "";
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	pointer-events: none;
	position: absolute;
	z-index: 2;
}

