/**
 * kennti drm-preflight.css — Phase 2
 *
 * Styles for:
 *   - .kdrm-wrap        — container injected around each VdoCipher iframe
 *   - .kdrm-rescue      — full rescue panel (replaces iframe on DRM failure)
 *   - .kdrm-overlay     — overlay rendered on top of a loaded iframe on player error
 *
 * Design system: Kennti v5.0
 *   --kennti-primary:  #2563EB  (blue)
 *   --kennti-primary-dark: #1D4ED8
 *   --kennti-surface:  #F8FAFC
 *   --kennti-border:   #E2E8F0
 *   --kennti-text:     #1E293B
 *   --kennti-muted:    #64748B
 *   Font: Poppins (loaded by theme — do not re-import here)
 */

/* ---------------------------------------------------------------------------
 * CSS custom properties (scoped to the component root to avoid leaking)
 * --------------------------------------------------------------------------- */
.kdrm-wrap,
.kdrm-rescue,
.kdrm-overlay {
	--kdrm-primary:       #2563EB;
	--kdrm-primary-dark:  #1D4ED8;
	--kdrm-wa-green:      #25D366;
	--kdrm-wa-dark:       #128C7E;
	--kdrm-surface:       #F8FAFC;
	--kdrm-border:        #E2E8F0;
	--kdrm-text:          #1E293B;
	--kdrm-muted:         #64748B;
	--kdrm-radius:        12px;
	--kdrm-shadow:        0 4px 24px rgba(0, 0, 0, 0.10);
	font-family: 'Poppins', sans-serif;
}

/* ---------------------------------------------------------------------------
 * Wrapper — maintains aspect ratio and relative positioning for overlay
 * --------------------------------------------------------------------------- */
.kdrm-wrap {
	position: relative;
	display: block;
	width: 100%;
	background: #000;
	border-radius: var(--kdrm-radius);
	overflow: hidden;
}

/* State: rescue panel is active — allow overflow for the panel */
.kdrm-wrap.kdrm-rescue-active {
	background: var(--kdrm-surface);
}

/* ---------------------------------------------------------------------------
 * Rescue panel — shown instead of the iframe
 * --------------------------------------------------------------------------- */
.kdrm-rescue {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 40px 32px;
	background: var(--kdrm-surface);
	border: 1px solid var(--kdrm-border);
	border-radius: var(--kdrm-radius);
	box-shadow: var(--kdrm-shadow);
	max-width: 640px;
	margin: 0 auto;
	animation: kdrm-fadein 0.3s ease;
}

@keyframes kdrm-fadein {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0);   }
}

.kdrm-rescue__icon {
	font-size: 48px;
	line-height: 1;
	margin-bottom: 16px;
}

.kdrm-rescue__title {
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--kdrm-text);
	margin: 0 0 12px;
	line-height: 1.35;
}

.kdrm-rescue__body {
	font-size: 0.9375rem;
	color: var(--kdrm-muted);
	margin: 0 0 16px;
	max-width: 480px;
}

.kdrm-rescue__list {
	list-style: none;
	padding: 0;
	margin: 0 0 20px;
	text-align: left;
	width: 100%;
	max-width: 380px;
}

.kdrm-rescue__list li {
	font-size: 0.9rem;
	color: var(--kdrm-text);
	padding: 6px 0;
	border-bottom: 1px solid var(--kdrm-border);
	display: flex;
	align-items: flex-start;
	gap: 6px;
}

.kdrm-rescue__list li::before {
	content: '✓';
	color: var(--kdrm-primary);
	font-weight: 700;
	flex-shrink: 0;
}

.kdrm-rescue__list li:last-child {
	border-bottom: none;
}

.kdrm-error-code {
	font-size: 0.8rem;
	color: var(--kdrm-muted);
	margin: 0 0 16px;
}

.kdrm-error-code code {
	background: var(--kdrm-border);
	padding: 2px 6px;
	border-radius: 4px;
	font-family: 'Courier New', monospace;
}

/* ---------------------------------------------------------------------------
 * Action buttons
 * --------------------------------------------------------------------------- */
.kdrm-rescue__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	justify-content: center;
	margin-top: 8px;
}

.kdrm-rescue__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 24px;
	border-radius: 8px;
	font-family: 'Poppins', sans-serif;
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none;
	transition: background 0.15s ease, transform 0.1s ease;
	cursor: pointer;
}

.kdrm-rescue__btn:focus-visible {
	outline: 3px solid var(--kdrm-primary);
	outline-offset: 2px;
}

.kdrm-rescue__btn--primary {
	background: var(--kdrm-primary);
	color: #ffffff;
}

.kdrm-rescue__btn--primary:hover {
	background: var(--kdrm-primary-dark);
	color: #ffffff;
	transform: translateY(-1px);
}

.kdrm-rescue__btn--wa {
	background: var(--kdrm-wa-green);
	color: #ffffff;
}

.kdrm-rescue__btn--wa:hover {
	background: var(--kdrm-wa-dark);
	color: #ffffff;
	transform: translateY(-1px);
}

/* ---------------------------------------------------------------------------
 * Error overlay — shown on top of a loaded iframe when player emits error
 * --------------------------------------------------------------------------- */
.kdrm-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.75);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	border-radius: var(--kdrm-radius);
	z-index: 10;
	animation: kdrm-fadein 0.25s ease;
}

.kdrm-overlay__body {
	background: var(--kdrm-surface);
	border-radius: var(--kdrm-radius);
	padding: 32px 28px;
	text-align: center;
	max-width: 400px;
	box-shadow: var(--kdrm-shadow);
}

.kdrm-overlay__icon {
	font-size: 40px;
	margin: 0 0 12px;
}

.kdrm-overlay__msg {
	font-size: 1rem;
	font-weight: 600;
	color: var(--kdrm-text);
	margin: 0 0 8px;
}

.kdrm-overlay__code {
	font-size: 0.8rem;
	color: var(--kdrm-muted);
	margin: 0 0 16px;
}

.kdrm-overlay__code code {
	background: var(--kdrm-border);
	padding: 2px 6px;
	border-radius: 4px;
	font-family: 'Courier New', monospace;
}

/* ---------------------------------------------------------------------------
 * Responsive adjustments
 * --------------------------------------------------------------------------- */
@media (max-width: 480px) {
	.kdrm-rescue {
		padding: 28px 20px;
	}

	.kdrm-rescue__title {
		font-size: 1.1rem;
	}

	.kdrm-rescue__actions {
		flex-direction: column;
		width: 100%;
	}

	.kdrm-rescue__btn {
		width: 100%;
		text-align: center;
	}
}

/* ---------------------------------------------------------------------------
 * RTL support (for Arabic site variants)
 * --------------------------------------------------------------------------- */
[dir="rtl"] .kdrm-rescue__list {
	text-align: right;
}

[dir="rtl"] .kdrm-rescue__list li {
	flex-direction: row-reverse;
}
