/* CKEditor 5 Content Styles - applies wysiwyg styling inside the editor and rendered output */

/* ========================================
   EDITOR HEIGHT AND RESIZING
   ======================================== */

/* Editor height - auto-expand from 300px to 600px */
.ck-editor__main {
	min-height: 300px !important;
	max-height: 600px !important;
	position: relative !important;
	margin: 0 !important;
	padding: 0 !important;
}

.ck-editor__main:after,
.ck-editor__main::after {
	content: none !important;
	display: none !important;
}

.ck-editor__editable,
.ck.ck-editor__editable_inline {
	min-height: 300px !important;
	height: auto !important;
	max-height: 600px !important;
	resize: none !important;
	overflow-y: auto !important;
	overflow-x: hidden !important;
}

/* Source editing mode */
.ck-source-editing-area {
	min-height: 300px !important;
	max-height: 600px !important;
	display: block !important;
	margin: 0 !important;
	padding: 0 !important;
}

.ck-source-editing-area:after,
.ck-source-editing-area::after {
	content: none !important;
	display: none !important;
	padding: 0 !important;
	margin: 0 !important;
}

.ck-source-editing-area textarea {
	min-height: 300px !important;
	height: auto !important;
	max-height: 600px !important;
	width: 100% !important;
	resize: none !important;
	overflow: auto !important;
	box-sizing: border-box !important;
	padding: 10px !important;
	margin: 0 !important;
}

/* Hide CKEditor branding and labels */
.ck.ck-editor__editable>.ck-powered-by,
.ck-powered-by,
.ck-voice-label {
	display: none !important;
}

/* Reduce height of image caption input field */
.ck.ck-labeled-field-view__input-wrapper textarea {
	min-height: 60px !important;
	max-height: 80px !important;
}

/* Override height for figcaption elements inside editor */
.ck-editor__editable figcaption {
	min-height: auto !important;
	height: auto !important;
	max-height: none !important;
}

/* Override height for caption editing within the image widget */
.ck-editor__editable .image figcaption,
.ck-editor__editable .ck-widget figcaption {
	min-height: auto !important;
	height: auto !important;
}

/* ========================================
   IMAGE ALIGNMENT STYLES (for rendered content)
   ======================================== */

.image {
	display: table;
	clear: both;
	text-align: center;
	margin: 1em auto;
}

.image img {
	display: block;
	margin: 0 auto;
	max-width: 100%;
	min-width: 50px;
}

.image-inline {
	display: inline-block;
	margin: 0;
}

.image-style-side {
	float: right;
	margin-left: 1.5em;
	max-width: 50%;
}

.image-style-align-left,
.image_style_align_left {
	float: left !important;
	margin-right: 1.5em !important;
	margin-left: 0 !important;
}

.image-style-align-center,
.image_style_align_center {
	display: block !important;
	margin-left: auto !important;
	margin-right: auto !important;
	float: none !important;
}

.image-style-align-right,
.image_style_align_right {
	float: right !important;
	margin-left: 1.5em !important;
	margin-right: 0 !important;
}

.image > figcaption {
	display: table-caption;
	caption-side: bottom;
	word-break: break-word;
	color: #666;
	background-color: #f7f7f7;
	padding: 0.6em;
	font-size: 0.85em;
	outline-offset: -1px;
}

/* ========================================
   LIST LAYOUT FIXES
   ======================================== */

/* Override the clearfix pseudo-elements from public_manifest.css that break list layout */
.ck-editor__editable li:before,
.ck-editor__editable li:after,
.ck-content li:before,
.ck-content li:after,
.wysiwyg li:before,
.wysiwyg li:after {
    content: none !important;
    display: none !important;
}

/* Unordered lists */
.ck-content > ul,
.ck-content ul,
.wysiwyg > ul,
.wysiwyg ul {
    list-style-type: disc;
    list-style-position: outside;
    padding-left: 2em;
    margin-top: 0;
    margin-bottom: 1em;
}

.ck-content > ul ol,
.ck-content ul ol,
.wysiwyg > ul ol,
.wysiwyg ul ol {
    list-style-type: decimal;
    margin-left: 15px;
    margin-top: 0;
    margin-bottom: 0;
}

.ck-content > ul ul,
.ck-content ul ul,
.wysiwyg > ul ul,
.wysiwyg ul ul {
    list-style-type: circle;
    margin-left: 15px;
    margin-top: 0;
    margin-bottom: 0;
}

.ck-content > ul ul ul,
.ck-content ul ul ul {
    list-style-type: square;
}

.ck-content > ul ul ul ul,
.ck-content ul ul ul ul {
    list-style-type: disc;
}

/* Ordered lists */
.ck-content > ol,
.ck-content ol,
.wysiwyg > ol,
.wysiwyg ol {
    list-style-type: decimal;
    list-style-position: outside;
    padding-left: 2em;
    margin-top: 0;
    margin-bottom: 1em;
}

.ck-content > ol ol,
.ck-content ol ol,
.wysiwyg > ol ol,
.wysiwyg ol ol {
    list-style-type: decimal;
    margin-left: 15px;
    margin-top: 0;
    margin-bottom: 0;
}

.ck-content > ol ul,
.ck-content ol ul,
.wysiwyg > ol ul,
.wysiwyg ol ul {
    list-style-type: circle;
    margin-left: 15px;
    margin-top: 0;
    margin-bottom: 0;
}

/* List items - reduce vertical spacing and fix alignment */
.ck-content li,
.wysiwyg li {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.4 !important;
}

/* Force all block elements inside list items to be inline */
.ck-content li p,
.ck-content li div,
.ck-content li span,
.wysiwyg li p,
.wysiwyg li div,
.wysiwyg li span {
    margin: 0 !important;
    padding: 0 !important;
    display: inline !important;
    line-height: 1.4 !important;
    vertical-align: baseline !important;
}

/* Target CKEditor's bogus paragraph - override CKEditor's display:block with maximum specificity */
.ck-editor__editable.ck-editor__editable .ck-list-bogus-paragraph {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: inherit !important;
    vertical-align: baseline !important;
    border: 0 !important;
    min-height: 0 !important;
    height: auto !important;
}

.ck-editor__editable li .ck-list-bogus-paragraph {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
}

.ck-content .ck-list-bogus-paragraph {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: inherit !important;
    vertical-align: baseline !important;
}

/* Even more specific targeting */
.ck-content li > .ck-list-bogus-paragraph {
    display: inline !important;
}

/* Remove any CKEditor-added spacing */
.ck-content li > * {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Ensure proper spacing between list items */
.ck-content li + li {
    margin-top: 0.3em !important;
}

/* ========================================
   MOBILE TEXT SELECTION IMPROVEMENTS
   ======================================== */

/* Force mobile browsers to recognize text highlighting inside CKEditor */
.ck-editor__editable,
.ck-editor__editable * {
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}
