/*
 * Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */


:root {
	--ck-link-panel-width: 340px;
	/* The height of the text inside the link providers list button. */
	--ck-link-provider-list-item-text-height: calc(var(--ck-line-height-base) * var(--ck-font-size-base));
	/* The height of the link providers list item contained paddings. */
	--ck-link-provider-list-item-height: calc(var(--ck-link-provider-list-item-text-height) + var(--ck-spacing-small) + var(--ck-spacing-small));
}

@media screen and (max-width: 600px) {
	:root {
		--ck-link-panel-width: 300px;
	}
}

/* Generic class that wraps each link balloon view. */

.ck.ck-form.ck-link-form {
	width: var(--ck-link-panel-width);
	padding-bottom: 0;

	&.ck-responsive-form {
		& .ck-labeled-field-view {
			@media screen and (max-width: 600px) {
				margin: 0;
			}
		}
	}

	& .ck-link-form__providers-list {
		display: flex;
		flex-direction: column;
		border-top: 1px solid var(--ck-color-base-border);

		/* The list should be scrollable when there are more than 4 items. */
		&:has(.ck-list__item:nth-child(n + 5)) {
			overflow: auto;
			/* Scroll should appear when there are more than 5 item on the list.
			* var(--ck-spacing-large) - is a form padding.
			* 1px - is a border width. */
			max-height: calc(var(--ck-link-provider-list-item-height) * 4 + var(--ck-spacing-large) + 1px);
		}

		& .ck-link__button {
			padding: var(--ck-spacing-small) var(--ck-spacing-large);
			border-radius: 0;

			& > .ck-button__label {
				flex-grow: 1;
				overflow: hidden;
				text-overflow: ellipsis;
			}
		}
	}
}

.ck.ck-link-form {
	& .ck-link__items:empty {
		display: none;
	}
}
