/* LOWWSF WPDM File Browser */

.lowwsf-fb {
	--lowwsf-fb-blue: #007cc3;
	--lowwsf-fb-green: #59b147;
	--lowwsf-fb-accent: var(--lowwsf-fb-blue);
	--lowwsf-fb-accent-ink: #ffffff;
	--lowwsf-fb-ink: #1f2430;
	--lowwsf-fb-muted: #6b7280;
	--lowwsf-fb-border: #e6e8ec;
	--lowwsf-fb-surface: #ffffff;
	--lowwsf-fb-surface-hover: #f7f9fc;
	--lowwsf-fb-radius: 14px;
	--lowwsf-fb-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
	--lowwsf-fb-shadow-hover: 0 8px 20px rgba(16, 24, 40, .10), 0 2px 6px rgba(16, 24, 40, .06);

	position: relative;
	color: var(--lowwsf-fb-ink);
	max-width: 100%;
	font-size: 15px;
	line-height: 1.4;
}

.lowwsf-fb * {
	box-sizing: border-box;
}

/* Neutralize the theme's/page-builder's global button & input styles
   (bare `button`/`input` selectors elsewhere on the site were bleeding
   a pink outline + wrong padding into these controls). */
.lowwsf-fb button,
.lowwsf-fb input,
.lowwsf-fb select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-image: none !important;
	box-shadow: none !important;
	text-shadow: none !important;
	font-family: inherit !important;
	font-size: 15px !important;
	line-height: 1.4 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	border-radius: 0;
	margin: 0;
}

/* Reassert native `hidden` behavior - the theme's global button styles
   force `display` with !important, which otherwise defeats it. */
.lowwsf-fb [hidden] {
	display: none !important;
}

.lowwsf-fb input[type="search"]::-webkit-search-decoration,
.lowwsf-fb input[type="search"]::-webkit-search-cancel-button,
.lowwsf-fb input[type="search"]::-webkit-search-results-button,
.lowwsf-fb input[type="search"]::-webkit-search-results-decoration {
	-webkit-appearance: none;
	appearance: none;
}

/* Toolbar */

.lowwsf-fb-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 20px;
	padding: 14px 4px;
	margin-bottom: 18px;
	background: var(--lowwsf-fb-surface);
	border-bottom: 1px solid var(--lowwsf-fb-border);
}

.lowwsf-fb-breadcrumb {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 2px;
	font-weight: 600;
	/* Grows to fill the row, but never shrinks below its own content -
	   forces it to wrap to its own line rather than overlapping the
	   search/sort controls when space is tight. */
	flex: 1 1 240px;
}

.lowwsf-fb-crumb {
	background: none !important;
	border: none !important;
	padding: 4px 2px;
	font-weight: 600;
	color: var(--lowwsf-fb-muted) !important;
	cursor: pointer;
	border-radius: 6px;
	text-decoration: none !important;
	transition: color .15s ease;
}

.lowwsf-fb-crumb:hover {
	color: var(--lowwsf-fb-blue) !important;
	text-decoration: underline !important;
}

.lowwsf-fb-crumb.is-current {
	color: var(--lowwsf-fb-ink) !important;
	cursor: default;
}

.lowwsf-fb-chevron {
	width: 14px;
	height: 14px;
	color: var(--lowwsf-fb-muted);
	opacity: .6;
	flex: none;
}

.lowwsf-fb-controls {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: nowrap;
	/* Fixed to its own content size - it must never stretch to fill a
	   row on its own, which is what made the sort dropdown balloon. */
	flex: 0 0 auto;
}

.lowwsf-fb-search {
	position: relative;
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	width: 220px;
}

.lowwsf-fb-search-icon {
	position: absolute;
	left: 12px;
	width: 16px;
	height: 16px;
	color: var(--lowwsf-fb-muted);
	pointer-events: none;
	z-index: 1;
}

.lowwsf-fb-search-input {
	width: 100%;
	padding: 9px 34px 9px 36px !important;
	border: 1px solid var(--lowwsf-fb-border) !important;
	border-radius: 999px !important;
	background: var(--lowwsf-fb-surface) !important;
	color: var(--lowwsf-fb-ink) !important;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.lowwsf-fb-search-input:focus {
	outline: none;
	border-color: var(--lowwsf-fb-blue) !important;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--lowwsf-fb-blue) 20%, transparent) !important;
}

.lowwsf-fb-search-clear {
	position: absolute;
	right: 6px;
	width: 22px;
	height: 22px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 !important;
	border: none !important;
	border-radius: 50% !important;
	background: var(--lowwsf-fb-border) !important;
	color: var(--lowwsf-fb-muted) !important;
	font-size: 16px !important;
	line-height: 1 !important;
	cursor: pointer;
}

.lowwsf-fb-search-clear:hover {
	background: var(--lowwsf-fb-muted) !important;
	color: #fff !important;
}

.lowwsf-fb-sort {
	flex: 0 0 auto;
	width: auto !important;
	max-width: 200px;
	padding: 9px 30px 9px 14px !important;
	border: 1px solid var(--lowwsf-fb-border) !important;
	border-radius: 999px !important;
	background: var(--lowwsf-fb-surface) !important;
	color: var(--lowwsf-fb-ink) !important;
	cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath d='M5.5 7.5l4.5 4.5 4.5-4.5z'/%3E%3C/svg%3E") !important;
	background-repeat: no-repeat !important;
	background-position: right 10px center !important;
	background-size: 16px !important;
}

.lowwsf-fb-sort:focus {
	outline: none;
	border-color: var(--lowwsf-fb-blue) !important;
}

/* Grid */

.lowwsf-fb-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 14px;
}

.lowwsf-fb.is-loading .lowwsf-fb-grid {
	opacity: .45;
	pointer-events: none;
	filter: saturate(.7);
	transition: opacity .15s ease;
}

.lowwsf-fb-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 14px;
	/* Grid items default to min-width:auto, which lets unbreakable content
	   (like the search-result path chip below) blow out past the card. */
	min-width: 0;
	background: var(--lowwsf-fb-surface);
	border: 1px solid var(--lowwsf-fb-border);
	border-radius: var(--lowwsf-fb-radius);
	box-shadow: var(--lowwsf-fb-shadow);
	animation: lowwsf-fb-in .2s ease both;
}

@keyframes lowwsf-fb-in {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: translateY(0); }
}

.lowwsf-fb-grid .lowwsf-fb-card:nth-child(1) { animation-delay: 0ms; }
.lowwsf-fb-grid .lowwsf-fb-card:nth-child(2) { animation-delay: 25ms; }
.lowwsf-fb-grid .lowwsf-fb-card:nth-child(3) { animation-delay: 50ms; }
.lowwsf-fb-grid .lowwsf-fb-card:nth-child(4) { animation-delay: 75ms; }
.lowwsf-fb-grid .lowwsf-fb-card:nth-child(5) { animation-delay: 100ms; }
.lowwsf-fb-grid .lowwsf-fb-card:nth-child(6) { animation-delay: 125ms; }
.lowwsf-fb-grid .lowwsf-fb-card:nth-child(7) { animation-delay: 150ms; }
.lowwsf-fb-grid .lowwsf-fb-card:nth-child(8) { animation-delay: 175ms; }

.lowwsf-fb-card--folder {
	flex-direction: row;
	align-items: center;
	cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.lowwsf-fb-card--folder:hover,
.lowwsf-fb-card--folder:focus-visible {
	transform: translateY(-2px);
	box-shadow: var(--lowwsf-fb-shadow-hover);
	border-color: color-mix(in srgb, var(--lowwsf-fb-green) 45%, var(--lowwsf-fb-border));
}

.lowwsf-fb-card--folder:focus-visible {
	outline: 2px solid var(--lowwsf-fb-green);
	outline-offset: 2px;
}

.lowwsf-fb-card-main {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	min-width: 0;
}

.lowwsf-fb-card-icon {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 10px;
	background: var(--lowwsf-fb-surface-hover);
}

.lowwsf-fb-card-icon img {
	max-width: 70%;
	max-height: 70%;
	object-fit: contain;
}

.lowwsf-fb-card-icon--folder {
	color: var(--lowwsf-fb-green);
	background: color-mix(in srgb, var(--lowwsf-fb-green) 12%, transparent);
}

.lowwsf-fb-card-icon--folder svg {
	width: 26px;
	height: 26px;
}

.lowwsf-fb-card-body {
	min-width: 0;
	flex: 1;
}

.lowwsf-fb-card-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-weight: 600;
	color: var(--lowwsf-fb-ink);
	word-break: break-word;
}

.lowwsf-fb-card--folder .lowwsf-fb-card-title {
	-webkit-line-clamp: 1;
}

.lowwsf-fb-card-meta {
	margin-top: 3px;
	font-size: 13px;
	color: var(--lowwsf-fb-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lowwsf-fb-card--folder .lowwsf-fb-chevron {
	flex: none;
	width: 18px;
	height: 18px;
	margin-left: auto;
	color: var(--lowwsf-fb-green);
	opacity: 1;
}

/* File cards */

.lowwsf-fb-badge {
	position: absolute;
	top: 10px;
	right: 10px;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 8px;
	font-size: 11px;
	font-weight: 600;
	color: #92400e;
	background: #fef3c7;
	border-radius: 999px;
}

.lowwsf-fb-badge svg {
	width: 11px;
	height: 11px;
}

.lowwsf-fb-download {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 9px 16px;
	border-radius: 999px;
	background: var(--lowwsf-fb-blue);
	color: var(--lowwsf-fb-accent-ink) !important;
	font-weight: 600;
	font-size: 13px;
	text-decoration: none !important;
	white-space: nowrap;
	transition: filter .15s ease, transform .15s ease;
}

.lowwsf-fb-download:hover,
.lowwsf-fb-download:focus-visible {
	filter: brightness(1.1);
	transform: translateY(-1px);
	color: var(--lowwsf-fb-accent-ink) !important;
}

.lowwsf-fb-file-path {
	display: flex;
	align-items: center;
	gap: 5px;
	margin-top: 4px;
	padding: 0 !important;
	border: none !important;
	background: none !important;
	font-size: 12px;
	color: var(--lowwsf-fb-green) !important;
	cursor: pointer;
	width: 100%;
	max-width: 100%;
}

.lowwsf-fb-file-path svg {
	width: 12px;
	height: 12px;
	flex: none;
}

.lowwsf-fb-file-path span {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lowwsf-fb-file-path:hover {
	text-decoration: underline;
}

/* Empty state */

.lowwsf-fb-empty {
	padding: 48px 16px;
	text-align: center;
	color: var(--lowwsf-fb-muted);
}

/* Load more */

.lowwsf-fb-loadmore-wrap {
	display: flex;
	justify-content: center;
	margin-top: 22px;
}

.lowwsf-fb-loadmore {
	padding: 10px 22px !important;
	border: 1px solid var(--lowwsf-fb-border) !important;
	border-radius: 999px !important;
	background: var(--lowwsf-fb-surface) !important;
	color: var(--lowwsf-fb-ink) !important;
	font-weight: 600;
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease;
}

.lowwsf-fb-loadmore:hover {
	border-color: var(--lowwsf-fb-blue) !important;
	background: var(--lowwsf-fb-surface-hover) !important;
}

/* Responsive */

@media (max-width: 560px) {
	.lowwsf-fb-toolbar {
		flex-direction: column;
		align-items: stretch;
	}
	.lowwsf-fb-controls {
		flex: 1 1 auto;
		width: 100%;
	}
	.lowwsf-fb-search {
		width: auto;
		flex: 1 1 auto;
	}
	.lowwsf-fb-sort {
		max-width: 45%;
	}
	.lowwsf-fb-grid {
		grid-template-columns: 1fr;
	}
}
