/* ==========================================================================
   DH Dialog — Shared modal dialog system
   Replaces native alert/confirm/prompt with branded, accessible dialogs.
   ========================================================================== */

/* ------------------------------------------------------------------
   Animations
   ------------------------------------------------------------------ */
@keyframes dh-dialog-fadein {
	from { opacity: 0; transform: scale(0.95); }
	to   { opacity: 1; transform: scale(1); }
}

@keyframes dh-dialog-fadeout {
	from { opacity: 1; transform: scale(1); }
	to   { opacity: 0; transform: scale(0.95); }
}

/* ------------------------------------------------------------------
   Backdrop
   ------------------------------------------------------------------ */
.dh-dialog-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 2147483640;
	display: flex;
	align-items: center;
	justify-content: center;
	animation: dh-dialog-fadein 0.15s ease-out both;
}

.dh-dialog-backdrop.dh-dialog-closing {
	animation: dh-dialog-fadeout 0.12s ease-in both;
}

/* ------------------------------------------------------------------
   Dialog box
   ------------------------------------------------------------------ */
.dh-dialog-box {
	background: #fff;
	border-radius: 12px;
	max-width: 480px;
	width: 90%;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	padding: 24px;
	position: relative;
}

/* ------------------------------------------------------------------
   Header
   ------------------------------------------------------------------ */
.dh-dialog-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding-bottom: 16px;
	border-bottom: 2px solid #811DD1;
}

/* ------------------------------------------------------------------
   Dexy mascot
   ------------------------------------------------------------------ */
.dh-dialog-dexy {
	width: 48px;
	height: auto;
	cursor: pointer;
	border-radius: 50%;
	transition: transform 0.2s;
	flex-shrink: 0;
}

.dh-dialog-dexy:hover {
	transform: scale(1.1);
}

/* ------------------------------------------------------------------
   Title
   ------------------------------------------------------------------ */
.dh-dialog-title {
	color: #811DD1;
	font-size: 1.2rem;
	font-weight: 600;
	flex: 1;
	margin: 0;
	line-height: 1.3;
}

/* ------------------------------------------------------------------
   Close button
   ------------------------------------------------------------------ */
.dh-dialog-close {
	position: absolute;
	top: 12px;
	right: 14px;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.4rem;
	background: #f0f0f0;
	border: 1px solid #ccc;
	border-radius: 9px;
	color: #D11D8D;
	cursor: pointer;
	padding: 0;
	line-height: 1;
	transition: background 0.15s, color 0.15s;
}

.dh-dialog-close:hover {
	background: #e0e0e0;
	color: #a0156e;
}

/* ------------------------------------------------------------------
   Body
   ------------------------------------------------------------------ */
.dh-dialog-body {
	padding: 16px 0;
}

/* ------------------------------------------------------------------
   Message
   ------------------------------------------------------------------ */
.dh-dialog-message {
	color: #333;
	font-size: 0.95rem;
	line-height: 1.5;
	margin: 0 0 4px;
	white-space: pre-line;
}

/* ------------------------------------------------------------------
   Input
   ------------------------------------------------------------------ */
.dh-dialog-input {
	width: 100%;
	border: 2px solid #ddd;
	border-radius: 6px;
	padding: 10px 12px;
	font-size: 0.95rem;
	margin-top: 12px;
	box-sizing: border-box;
	font-family: inherit;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.dh-dialog-input:focus {
	border-color: #811DD1;
	outline: none;
	box-shadow: 0 0 0 3px rgba(129, 29, 209, 0.15);
}

/* ------------------------------------------------------------------
   Input hint
   ------------------------------------------------------------------ */
.dh-dialog-input-hint {
	font-size: 0.85rem;
	color: #888;
	margin-top: 6px;
}

/* ------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------ */
.dh-dialog-footer {
	display: flex;
	gap: 12px;
	justify-content: flex-end;
	padding-top: 16px;
}

/* ------------------------------------------------------------------
   Buttons — shared base
   ------------------------------------------------------------------ */
.dh-dialog-btn-primary,
.dh-dialog-btn-danger,
.dh-dialog-btn-cancel {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 22px;
	font-size: 0.9rem;
	font-weight: 600;
	border-radius: 9px;
	cursor: pointer;
	text-transform: lowercase;
	font-family: inherit;
	line-height: 1;
}

/* Primary */
.dh-dialog-btn-primary {
	background: #811DD1;
	color: #fff;
	border: none;
}

.dh-dialog-btn-primary:hover:not(:disabled) {
	background: #D11D8D;
}

.dh-dialog-btn-primary:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* Danger */
.dh-dialog-btn-danger {
	background: #c0392b;
	color: #fff;
	border: none;
}

.dh-dialog-btn-danger:hover:not(:disabled) {
	background: #a93226;
}

.dh-dialog-btn-danger:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* Cancel */
.dh-dialog-btn-cancel {
	background: transparent;
	color: #D11D8D;
	border: 2px solid #D11D8D;
}

.dh-dialog-btn-cancel:hover {
	background: rgba(209, 29, 141, 0.08);
}

/* ------------------------------------------------------------------
   Dexy full-screen modal (click mascot to see full Dexy)
   ------------------------------------------------------------------ */
.dh-dialog-dexy-modal {
	position: fixed;
	inset: 0;
	z-index: 2147483647;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.7);
	cursor: pointer;
	animation: dh-dialog-fadein 0.3s ease-out both;
}

.dh-dialog-dexy-modal img {
	max-height: 60vh;
	max-width: 80vw;
	border-radius: 16px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.dh-dialog-dexy-modal p {
	color: #fff;
	font-size: 1.1rem;
	margin-top: 16px;
	font-weight: 500;
}

/* ------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------ */
@media (max-width: 480px) {
	.dh-dialog-box {
		width: 95%;
		padding: 16px;
	}

	.dh-dialog-dexy {
		width: 36px;
	}
}

@media (max-width: 360px) {
	.dh-dialog-footer {
		flex-direction: column;
	}

	.dh-dialog-btn-primary,
	.dh-dialog-btn-danger,
	.dh-dialog-btn-cancel {
		width: 100%;
	}
}

/* ------------------------------------------------------------------
   Accessibility: reduced motion
   ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
	.dh-dialog-backdrop,
	.dh-dialog-backdrop.dh-dialog-closing,
	.dh-dialog-dexy-modal {
		animation: none;
	}
}

/* ------------------------------------------------------------------
   Permission gate placeholder (behind dialog)
   ------------------------------------------------------------------ */
.dh-permission-gate {
	max-width: 480px;
	margin: 60px auto;
	text-align: center;
	padding: 32px 24px;
}

.dh-permission-gate__feature {
	font-size: 18px;
	font-weight: 600;
	color: #333;
	margin: 0 0 8px;
}

.dh-permission-gate__status {
	font-size: 14px;
	color: #888;
	margin: 0;
}
