/* CKEditor Toolbar Customization */

/* Compact toolbar - hide less frequently used items by default */
.ck.ck-toolbar {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
}

/* Option 1: Limit toolbar to essential items only - hide extras */
.ck.ck-toolbar .ck-toolbar__items {
    flex-wrap: nowrap !important;
}

/* Hide specific toolbar buttons to keep only essentials visible */
/* Source button */
.ck-toolbar .ck-source-editing-button { display: none !important; }

/* Paragraph dropdown */
.ck-toolbar .ck-heading-dropdown { display: none !important; }

/* Styles dropdown */
.ck-toolbar .ck-style-dropdown { display: none !important;}

/* Hide word count and character count status bar */
.ck.ck-word-count { display: none !important; }

/* Hide "Powered by CKEditor" branding label */
.ck.ck-powered-by { display: none !important; }
.ck-powered-by-balloon { display: none !important; }

/* More aggressive approach - hide unwanted buttons by position and icon */
/* Hide subscript (x?) */
.ck-toolbar .ck-button:has(.ck-icon use[href*="subscript"]) { display: none !important; }
.ck-toolbar button[data-cke-tooltip-text*="Subscript"] { display: none !important; }

/* Hide superscript (x²) */
.ck-toolbar .ck-button:has(.ck-icon use[href*="superscript"]) { display: none !important; }
.ck-toolbar button[data-cke-tooltip-text*="Superscript"] { display: none !important; }

/* Hide code (<>) */
.ck-toolbar .ck-button:has(.ck-icon use[href*="code"]) { display: none !important; }
.ck-toolbar button[data-cke-tooltip-text*="Code"] { display: none !important; }

/* Hide special characters (?) */
.ck-toolbar button[data-cke-tooltip-text*="Special"] { display: none !important; }
.ck-toolbar button[data-cke-tooltip-text*="character"] { display: none !important; }

/* Hide horizontal line (—) */
.ck-toolbar button[data-cke-tooltip-text*="Horizontal"] { display: none !important; }
.ck-toolbar button[data-cke-tooltip-text*="line"] { display: none !important; }

/* Hide table */
.ck-toolbar button[data-cke-tooltip-text*="Table"] { display: none !important; }
.ck-toolbar button[data-cke-tooltip-text*="table"] { display: none !important; }

/* Hide link */
.ck-toolbar button[data-cke-tooltip-text*="Link"] { display: none !important; }
.ck-toolbar button[data-cke-tooltip-text*="link"] { display: none !important; }

/* Hide media */
.ck-toolbar button[data-cke-tooltip-text*="Media"] { display: none !important; }

/* Hide block quote */
.ck-toolbar button[data-cke-tooltip-text*="Block"] { display: none !important; }

/* Alternative - Hide by aria-label */
.ck-toolbar button[aria-label*="Subscript"] { display: none !important; }
.ck-toolbar button[aria-label*="Superscript"] { display: none !important; }
.ck-toolbar button[aria-label*="Code"] { display: none !important; }
.ck-toolbar button[aria-label*="Special"] { display: none !important; }
.ck-toolbar button[aria-label*="Horizontal"] { display: none !important; }
.ck-toolbar button[aria-label*="Table"] { display: none !important; }
.ck-toolbar button[aria-label*="Link"] { display: none !important; }
.ck-toolbar button[aria-label*="Media"] { display: none !important; }
.ck-toolbar button[aria-label*="Block"] { display: none !important; }

/* Hide by class names - more specific */
.ck-toolbar .ck-button.ck-subscript-button { display: none !important; }
.ck-toolbar .ck-button.ck-superscript-button { display: none !important; }
.ck-toolbar .ck-button.ck-code-button { display: none !important; }
.ck-toolbar .ck-button.ck-special-characters-button { display: none !important; }
.ck-toolbar .ck-button.ck-horizontal-line-button { display: none !important; }
.ck-toolbar .ck-button.ck-insert-table-button { display: none !important; }
.ck-toolbar .ck-button.ck-link-button { display: none !important; }
.ck-toolbar .ck-button.ck-media-embed-button { display: none !important; }
.ck-toolbar .ck-button.ck-block-quote-button { display: none !important; }

/* DO NOT hide image button */
/* .ck-toolbar .ck-button.ck-insert-image-button { display: none !important; } */

/* Hide any toolbar items that come after strikethrough, except image */
.ck-toolbar .ck-toolbar__items > *:not(.ck-button):not(.ck-dropdown):nth-last-child(-n+15) {
    display: none !important;
}

/* Show essential buttons explicitly */
.ck-toolbar .ck-button.ck-bold-button,
.ck-toolbar .ck-button.ck-italic-button,
.ck-toolbar .ck-button.ck-underline-button,
.ck-toolbar .ck-button.ck-strikethrough-button,
.ck-toolbar .ck-button.ck-insert-image-button,
.ck-toolbar .ck-button[aria-label*="Bold"],
.ck-toolbar .ck-button[aria-label*="Italic"],
.ck-toolbar .ck-button[aria-label*="Underline"],
.ck-toolbar .ck-button[aria-label*="Strikethrough"],
.ck-toolbar .ck-button[aria-label*="Image"] {
    display: inline-block !important;
}



/* Option 2: Enable toolbar dropdown for overflow items */
.ck.ck-toolbar.ck-toolbar_grouping {
    min-height: auto !important;
}

/* Make toolbar scrollable horizontally if items overflow */
.ck.ck-toolbar:not(.ck-toolbar_grouping) {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

.ck.ck-toolbar:not(.ck-toolbar_grouping) .ck-toolbar__items {
    flex-wrap: nowrap !important;
}

/* Custom scrollbar for toolbar */
.ck.ck-toolbar::-webkit-scrollbar {
    height: 6px;
}

.ck.ck-toolbar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ck.ck-toolbar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.ck.ck-toolbar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Compact mode - smaller toolbar items */
.ck-editor-compact .ck.ck-toolbar {
    padding: 4px !important;
}

.ck-editor-compact .ck.ck-button {
    padding: 4px !important;
    min-width: auto !important;
}

.ck-editor-compact .ck.ck-toolbar__separator {
    margin: 0 4px !important;
}
