/*==============================================================================
 * iChess Notes / Comments (.ic-notes)
 * ----------------------------------------------------------------------------
 * Card list of page comments with Bootstrap nav + Font Awesome icons.
 * Compose form uses .ic-form (see README.forms.md / forms.css).
 *============================================================================*/

.ic-notes,
.ic-notes *,
.ic-notes .ic-notes-card,
.ic-notes .ic-notes-body,
.ic-notes .ic-notes-list,
.ic-notes .ic-notes-nav,
.ic-notes .ic-notes-header {
	box-sizing: border-box;
}

#notes_div.ic-notes,
.ic-notes {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	overflow: visible !important;
	direction: rtl;
	text-align: right;
}

.ic-notes-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem 1rem;
	margin: 0 0 1rem;
	padding: 0 0 0.75rem;
	border-bottom: 1px solid var(--ic-border, #e2dfda);
	overflow: visible;
}

.ic-notes-title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--ic-teal-dark, #4b6a71);
	line-height: 1.3;
}

.ic-notes-header .btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	white-space: nowrap;
}

.ic-notes #new_note_div {
	margin: 0 0 1.25rem;
	padding: 1rem;
	background: var(--ic-menu-bg, #eef6f8);
	border: 1px solid var(--ic-border, #e2dfda);
	border-radius: 0.5rem;
	overflow: visible !important;
}

.ic-notes-rte {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	overflow: auto;
}

.ic-notes-rte .mceEditor,
.ic-notes-rte table.mceLayout,
.ic-notes-rte iframe {
	max-width: 100% !important;
}

.ic-notes-list-wrap {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	overflow: visible;
}

.ic-notes-nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 0.75rem;
	margin: 0.5rem 0;
	padding: 0.35rem 0;
	overflow: visible;
}

/* Desktop: prev+count on top, count+next on bottom */
.ic-notes-nav-top {
	justify-content: flex-start;
}

.ic-notes-nav-bottom {
	justify-content: flex-end;
}

.ic-notes-nav-btns {
	display: inline-flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0.35rem;
}

.ic-notes-nav-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.25rem;
	min-height: 2.25rem;
	padding: 0.35rem 0.55rem;
	line-height: 1;
}

.ic-notes-nav-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.ic-notes-results {
	flex: 1 1 auto;
	min-width: 0;
	text-align: center;
	font-size: 0.9rem;
	color: var(--ic-teal-dark, #4b6a71);
	overflow-wrap: anywhere;
}

.ic-notes-list {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	margin: 0.5rem 0;
	padding: 0;
	overflow: visible;
}

.ic-notes-card {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	margin: 0;
	padding: 0.9rem 1rem;
	background: var(--ic-surface, #ffffff);
	border: 1px solid var(--ic-border, #e2dfda);
	border-radius: 0.5rem;
	border-inline-start: 3px solid var(--ic-teal, #2f87a9);
	box-shadow: 0 1px 2px rgba(47, 135, 169, 0.06);
	overflow: visible;
}

.ic-notes-card-header {
	margin: 0 0 0.5rem;
	padding: 0;
	overflow: visible;
}

.ic-notes-card-title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.35;
	color: var(--ic-text, #1a1a1a);
	overflow-wrap: anywhere;
	word-break: break-word;
}

/* Note HTML body — must stay fluid on narrow viewports */
.ic-notes-body {
	position: relative;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	margin: 0 0 0.75rem;
	overflow-x: auto;
	overflow-y: visible;
	overflow-wrap: anywhere;
	word-break: break-word;
	line-height: 1.55;
	color: var(--ic-text, #1a1a1a);
}

.ic-notes-body img,
.ic-notes-body video,
.ic-notes-body iframe,
.ic-notes-body embed,
.ic-notes-body object,
.ic-notes-body svg {
	max-width: 100% !important;
	height: auto !important;
}

.ic-notes-body table {
	max-width: 100%;
	display: block;
	overflow-x: auto;
}

.ic-notes-body pre,
.ic-notes-body code {
	max-width: 100%;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.ic-notes-card-meta {
	margin: 0;
	padding: 0.35rem 0 0;
	border-top: 1px solid var(--ic-border, #e2dfda);
	font-size: 0.9rem;
	color: var(--ic-teal-dark, #4b6a71);
	overflow: visible;
}

.ic-notes-card-meta p {
	margin: 0.4rem 0 0;
	overflow-wrap: anywhere;
}

.ic-notes-card-status {
	margin-top: 0.75rem;
	padding-top: 0.5rem;
	border-top: 1px dashed var(--ic-border, #e2dfda);
	overflow: visible;
}

.ic-notes-status {
	max-width: 16rem;
	width: 100%;
}

@media (max-width: 575.98px) {
	.ic-notes-header {
		flex-direction: column;
		align-items: stretch;
	}

	.ic-notes-header .btn {
		width: 100%;
		justify-content: center;
	}

	/*
	 * Mobile stack:
	 *   top nav  → prev buttons, then results count
	 *   cards
	 *   bottom   → next buttons only
	 */
	.ic-notes-nav-top {
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 0.4rem;
	}

	.ic-notes-nav-top .ic-notes-nav-prev {
		order: 1;
		justify-content: center;
		width: 100%;
	}

	.ic-notes-nav-top .ic-notes-results {
		order: 2;
		width: 100%;
		text-align: center;
		flex: 0 0 auto;
	}

	.ic-notes-nav-bottom {
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.ic-notes-nav-bottom .ic-notes-results {
		display: none;
	}

	.ic-notes-nav-bottom .ic-notes-nav-next {
		justify-content: center;
		width: 100%;
	}

	.ic-notes-card {
		padding: 0.75rem;
		border-radius: 0.4rem;
	}

	.ic-notes-status {
		max-width: 100%;
	}
}
