/*!
 * TemplateHive Core — front-end styles.
 *
 * Deliberately small. Every component the plugin renders into the theme
 * (.thc-rating, .thc-suggest, .thc-toast, .thc-skeleton, .thc-page) is already
 * styled by the theme's own stylesheet, so duplicating it here would only
 * create two sources of truth. What is left is the live preview screen, which
 * is a standalone page the theme has no reason to know about, plus a couple of
 * fallbacks for running without the TemplateHive theme.
 */

/* ------------------------------------------------------- live preview */

.thc-preview-body {
	margin: 0;
	background: #0b1120;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.thc-preview {
	display: flex;
	flex-direction: column;
	height: 100vh;
	height: 100dvh;
}

.thc-preview__bar {
	display: flex;
	align-items: center;
	gap: 18px;
	flex-wrap: wrap;
	padding: 12px clamp(14px, 3vw, 24px);
	background: #0b1120;
	border-bottom: 1px solid rgba(255, 255, 255, .1);
	color: #cbd5e1;
	font-size: .9rem;
}

.thc-preview__bar a { text-decoration: none; }

.thc-preview__back,
.thc-preview__open {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 13px;
	border-radius: 9px;
	color: #cbd5e1;
	background: rgba(255, 255, 255, .07);
	transition: background .18s ease, color .18s ease;
}

.thc-preview__back:hover,
.thc-preview__open:hover { background: rgba(255, 255, 255, .14); color: #fff; }

.thc-preview__title {
	display: flex;
	align-items: baseline;
	gap: 10px;
	min-width: 0;
}

.thc-preview__title strong {
	color: #fff;
	font-size: 1rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.thc-preview__price { color: #a5b4fc; font-weight: 600; }
.thc-preview__price del { opacity: .6; font-weight: 400; }
.thc-preview__price ins { text-decoration: none; }

.thc-preview__devices {
	display: flex;
	gap: 4px;
	margin-left: auto;
	padding: 4px;
	border-radius: 11px;
	background: rgba(255, 255, 255, .07);
}

.thc-preview__device {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 7px 13px;
	border: 0;
	border-radius: 8px;
	background: none;
	color: #94a3b8;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: background .18s ease, color .18s ease;
}

.thc-preview__device:hover { color: #e2e8f0; }

.thc-preview__device[aria-pressed="true"] {
	background: linear-gradient(135deg, #4f46e5, #8b5cf6);
	color: #fff;
}

.thc-preview__actions { display: flex; align-items: center; gap: 10px; }

.thc-preview__buy {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	padding: 9px 18px;
	border-radius: 9px;
	background: linear-gradient(135deg, #4f46e5, #8b5cf6);
	color: #fff;
	font-weight: 700;
	box-shadow: 0 12px 26px -14px rgba(79, 70, 229, .9);
	transition: transform .18s ease;
}

.thc-preview__buy:hover { transform: translateY(-1px); color: #fff; }

.thc-preview__stage {
	flex: 1;
	min-height: 0;
	padding: clamp(10px, 2vw, 22px);
	background:
		radial-gradient(circle at 20% 0%, rgba(79, 70, 229, .28), transparent 55%),
		radial-gradient(circle at 85% 100%, rgba(139, 92, 246, .22), transparent 55%),
		#0b1120;
	display: flex;
	justify-content: center;
}

.thc-preview__frame {
	position: relative;
	width: 100%;
	max-width: 100%;
	height: 100%;
	border-radius: 14px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .75);
	transition: max-width .32s cubic-bezier(.4, 0, .2, 1);
}

.thc-preview__frame iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Must come before the rule below: an author `display: grid` outranks the
   user-agent `[hidden] { display: none }`, so without this the "will not load
   in a frame" panel covers the iframe on every preview, working or not. */
.thc-preview__blocked[hidden] { display: none; }

.thc-preview__blocked {
	position: absolute;
	inset: 0;
	display: grid;
	place-content: center;
	justify-items: center;
	gap: 12px;
	padding: 32px;
	text-align: center;
	background: #fff;
	color: #475569;
}

.thc-preview__blocked h2 { margin: 0; color: #0f172a; font-size: 1.25rem; }
.thc-preview__blocked p { margin: 0; max-width: 42ch; line-height: 1.6; }
.thc-preview__blocked svg { color: #94a3b8; }

@media (max-width: 860px) {
	.thc-preview__devices { order: 3; margin-left: 0; width: 100%; justify-content: center; }
	.thc-preview__actions { margin-left: auto; }
	.thc-preview__title { flex: 1; }
}

@media (max-width: 560px) {
	.thc-preview__back span,
	.thc-preview__open span,
	.thc-preview__device span { display: none; }
	.thc-preview__actions { gap: 7px; }
}

/* --------------------------------------- fallbacks outside the theme */

/* The theme styles all of these. These declarations only matter if the plugin
   is active alongside a different theme, so they are minimal on purpose and
   every one is guarded to lose to the theme's own rules on source order. */

.thc-rating { display: inline-flex; align-items: center; gap: 6px; }
.thc-rating__track { position: relative; display: block; }
.thc-rating__fill { position: absolute; inset: 0 auto 0 0; }
.thc-suggest:not([hidden]) { display: block; }
.thc-toasts:empty { display: none; }
.thc-empty { padding: 40px 0; text-align: center; }
