/*
 * Frontend overlay and modal styling for image/video downloads.
 */
.smd-image-downloads {
	position: absolute;
	right: 8px;
	z-index: 5;
	pointer-events: auto;
	transform: translate(0, calc(-100% - 8px));
}

/* SMD Patch: Video overlays are rendered inside the media frame and should pin to the lower-right corner. */
.smd-image-downloads--media-corner {
	top: auto;
	left: auto;
	bottom: 8px;
	transform: none;
}

/* SMD Patch: Video overlays should live in the top-right to avoid player controls overlap. */
.smd-image-downloads--video-corner {
	top: 8px;
	left: auto;
	right: 8px;
	bottom: auto;
	transform: none;
}

.wp-block-image.has-smd-downloads .hds-media-wrapper,
.hds-cover-wrapper.smd-downloads-frame {
	position: relative;
}

.smd-downloads-frame {
	position: relative;
	/* SMD Patch: Panel should overflow outside media bounds when anchored to wrapper. */
	overflow: visible;
}

.smd-downloads-toggle {
	border: none;
	background: transparent;
	padding: 4px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* SMD Patch: Only show button outline for keyboard focus to avoid sticky mouse focus ring. */
.smd-downloads-toggle:focus {
	outline: none;
}

.smd-downloads-toggle:focus-visible {
	outline: 2px solid #1c67e3;
	outline-offset: 2px;
}

/* SMD Patch: Shared custom-row panel uses class-based layout instead of inline styles. */
.smd-downloads-panel__custom-row-header--inline {
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	gap: 8px;
}

.smd-downloads-modal {
	position: absolute;
	right: 0;
	bottom: 44px;
	background: #fff;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
	min-width: 375px;
	width: auto;
	max-width: calc(100% - 24px);
	padding: 12px;
	border: 1px solid #dfe1e6;
	z-index: 20;
}

/* SMD Patch: For top-right video button placement, open modal downward from the icon. */
.smd-image-downloads--video-corner .smd-downloads-modal {
	top: 44px;
	bottom: auto;
}

.smd-downloads-modal__title {
	font-weight: 600;
	margin-bottom: 8px;
}

.smd-downloads-modal__list {
	list-style-type: none;
	padding-left: 0;
}

.smd-downloads-modal__item {
	display: flex;
	align-items: center;
	gap: 6px;
}

.smd-downloads-modal__item > * {
	flex-grow: 0;
	flex-shrink: 0;
}

.smd-downloads-modal__item:hover {
	border-color: #1c67e3;
}

.smd-downloads-modal__meta {
	font-size: 12px;
	color: #4a4f55;
}

.smd-downloads-modal__meta-ext {
	font-weight: 600;
	font-size: 12px;
	color: #4a4f55;
	margin-left: auto;
}

.smd-downloads-modal__name {
	font-size: 14px;
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	flex-grow: 2;
	flex-shrink: 1;
}

.smd-downloads-close {
	margin-top: 8px;
	background: none;
	border: none;
	color: #4a4f55;
	cursor: pointer;
	font-size: 13px;
	padding: 4px 0;
}

.smd-downloads-modal__heading {
	padding: 4px 0;
}

.smd-downloads-modal__heading .smd-downloads-modal__name {
	font-weight: 600;
	display: block;
}
