/**
 * Elite Kit — Template Library (Elementor editor)
 */

#ek-library-modal .dialog-widget-content {
	width: 92vw;
	max-width: 1200px;
	height: 88vh;
	background: #f1f2f3;
	border-radius: 6px;
	overflow: hidden;
}

/* The lightbox ships an empty header and buttons row that we do not use. */
#ek-library-modal .dialog-header,
#ek-library-modal .dialog-buttons-wrapper {
	display: none;
}

#ek-library-modal .dialog-message {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	padding: 0;
	overflow: hidden;
}

/* Header ------------------------------------------------------------------ */

.ek-library__header {
	display: flex;
	align-items: center;
	gap: 15px;
	flex-shrink: 0;
	padding: 0 15px;
	height: 50px;
	background: #fff;
	border-bottom: 1px solid #e6e8ea;
}

.ek-library__logo {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	color: #495157;
	white-space: nowrap;
}

.ek-library__logo img {
	width: 22px;
	height: 22px;
}

.ek-library__tabs {
	display: flex;
	align-items: center;
	gap: 5px;
	flex: 1;
	height: 100%;
}

.ek-library__tab {
	display: flex;
	align-items: center;
	height: 100%;
	padding: 0 14px;
	font-size: 13px;
	color: #6d7882;
	cursor: pointer;
	border-bottom: 3px solid transparent;
	transition: color 0.2s ease, border-color 0.2s ease;
}

.ek-library__tab:hover {
	color: #495157;
}

.ek-library__tab.ek-active {
	color: #93003c;
	border-bottom-color: #93003c;
}

.ek-library__header-actions {
	display: flex;
	align-items: center;
	gap: 4px;
}

.ek-library__header-actions > div {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	font-size: 16px;
	color: #6d7882;
	border-radius: 4px;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.ek-library__header-actions > div:hover {
	background: #f1f2f3;
	color: #495157;
}

.ek-library__back {
	display: none !important;
}

.ek-library__back.ek-visible {
	display: flex !important;
}

/* Body -------------------------------------------------------------------- */

.ek-library__body {
	position: relative;
	flex: 1;
	overflow: hidden;
}

.ek-library__list-view,
.ek-library__preview-view {
	height: 100%;
	overflow-y: auto;
}

.ek-library__preview-view {
	display: none;
	position: absolute;
	inset: 0;
	background: #f1f2f3;
}

.ek-library__body.ek-previewing .ek-library__list-view {
	display: none;
}

.ek-library__body.ek-previewing .ek-library__preview-view {
	display: flex;
	flex-direction: column;
}

/* Toolbar ----------------------------------------------------------------- */

.ek-library__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	flex-wrap: wrap;
	position: sticky;
	top: 0;
	z-index: 2;
	padding: 15px 20px;
	background: #f1f2f3;
	border-bottom: 1px solid #e6e8ea;
}

.ek-library__filters {
	display: flex;
	align-items: center;
	gap: 8px;
}

.ek-library__category {
	min-width: 190px;
	height: 34px;
	padding: 0 32px 0 12px;
	font-size: 13px;
	color: #495157;
	background-color: #fff;
	/* Chevron drawn inline so the select needs no icon font. */
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%236d7882' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 11px;
	border: 1px solid #e6e8ea;
	border-radius: 4px;
	cursor: pointer;
	outline: none;
	appearance: none;
	-webkit-appearance: none;
}

.ek-library__category:hover {
	border-color: #c5c9cc;
}

.ek-library__category:focus {
	border-color: #93003c;
}

.ek-library__toolbar-right {
	display: flex;
	align-items: center;
	gap: 15px;
}

.ek-library__counter {
	font-size: 12px;
	color: #9da5ae;
	white-space: nowrap;
}

.ek-library__search {
	position: relative;
}

.ek-library__search input {
	width: 220px;
	height: 34px;
	padding: 0 34px 0 12px;
	font-size: 13px;
	color: #495157;
	background: #fff;
	border: 1px solid #e6e8ea;
	border-radius: 4px;
	outline: none;
}

.ek-library__search input:focus {
	border-color: #93003c;
}

.ek-library__search i {
	position: absolute;
	top: 50%;
	right: 12px;
	transform: translateY(-50%);
	font-size: 14px;
	color: #9da5ae;
	pointer-events: none;
}

/* Grid -------------------------------------------------------------------- */

.ek-library__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 20px;
	padding: 20px;
}

.ek-library__template-body {
	background: #fff;
	border-radius: 5px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ek-library__template:hover .ek-library__template-body {
	transform: translateY(-2px);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.ek-library__template-thumb {
	position: relative;
	/* Screenshots are trimmed to their content, so heights vary a lot. Cap the
	   tall ones and pin them to the top: the first screenful is the useful part. */
	max-height: 300px;
	overflow: hidden;
	background: #f1f2f3;
}

.ek-library__template-thumb img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
	object-position: top center;
}

.ek-library__template-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 180px;
	font-size: 34px;
	color: #c5c9cc;
}

.ek-library__template-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.ek-library__template:hover .ek-library__template-overlay {
	opacity: 1;
}

.ek-library__badge {
	position: absolute;
	top: 10px;
	right: 10px;
	padding: 3px 9px;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #fff;
	background: #93003c;
	border-radius: 3px;
}

.ek-library__template-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 15px;
	border-top: 1px solid #f1f2f3;
}

.ek-library__template-title {
	font-size: 13px;
	color: #495157;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ek-library__insert-button,
.ek-library__pro-button,
.ek-library__preview-button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
	font-size: 12px;
	cursor: pointer;
}

.ek-library__insert-button.ek-loading {
	opacity: 0.6;
	pointer-events: none;
}

/* Preview ----------------------------------------------------------------- */

.ek-library__preview-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 15px;
	flex-shrink: 0;
	padding: 10px 20px;
	background: #fff;
	border-bottom: 1px solid #e6e8ea;
}

.ek-library__preview-title {
	font-size: 14px;
	font-weight: 600;
	color: #495157;
}

.ek-library__preview-devices {
	display: flex;
	gap: 4px;
}

.ek-library__device {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	font-size: 15px;
	color: #6d7882;
	border-radius: 4px;
	cursor: pointer;
}

.ek-library__device:hover {
	background: #f1f2f3;
}

.ek-library__device.ek-active {
	color: #fff;
	background: #93003c;
}

.ek-library__preview-frame {
	flex: 1;
	display: flex;
	justify-content: center;
	padding: 20px;
	overflow: auto;
}

.ek-library__preview-frame iframe {
	width: 100%;
	height: 100%;
	background: #fff;
	border: 0;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
	transition: width 0.3s ease;
}

.ek-library__preview-frame.ek-device-tablet iframe {
	width: 768px;
}

.ek-library__preview-frame.ek-device-mobile iframe {
	width: 375px;
}

.ek-library__preview-image img {
	max-width: 100%;
	height: auto;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

/* States ------------------------------------------------------------------ */

.ek-library__loading,
.ek-library__message {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 320px;
	padding: 40px 20px;
	text-align: center;
}

.ek-library__message-title {
	font-size: 18px;
	font-weight: 600;
	color: #495157;
}

.ek-library__message-text {
	max-width: 420px;
	font-size: 13px;
	line-height: 1.6;
	color: #9da5ae;
}

.ek-library__retry {
	margin-top: 10px;
	cursor: pointer;
}

/* Launchers --------------------------------------------------------------- */

.ek-library-panel-button {
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.ek-library-panel-button img {
	display: block;
	width: 18px;
	height: 18px;
}

/* The preview-iframe launcher is styled from the extension's inline preview CSS. */
