/**
 * EP Helpdesk — Frontend Styles
 *
 * Clean, minimal form styling following epemail.elmspark.com
 * design language: centred container, sans-serif, generous spacing.
 */

/* ─── Form ─────────────────────────────────────────── */

.ep-helpdesk-form-wrapper {
	max-width: 640px;
	margin: 0 auto;
}

.ep-helpdesk-form {
	position: relative;
}

.ep-helpdesk-field {
	margin-bottom: 20px;
}

.ep-helpdesk-field label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 6px;
	color: #374151;
}

.ep-helpdesk-field input[type="text"],
.ep-helpdesk-field input[type="email"],
.ep-helpdesk-field textarea {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 15px;
	font-family: inherit;
	color: #1f2937;
	background: #fff;
	transition: border-color 0.15s ease;
	box-sizing: border-box;
}

.ep-helpdesk-field input:focus,
.ep-helpdesk-field textarea:focus {
	outline: none;
	border-color: var(--ep-brand, #2563eb);
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ep-helpdesk-field textarea {
	resize: vertical;
	min-height: 120px;
}

.ep-required {
	color: #ef4444;
}

.ep-helpdesk-submit {
	display: inline-block;
	padding: 12px 28px;
	background: var(--ep-brand, #2563eb);
	color: var(--ep-brand-ink, #fff);
	border: none;
	border-radius: 6px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease;
}

.ep-helpdesk-submit:hover {
	background: var(--ep-brand-hover, #1d4ed8);
}

.ep-helpdesk-submit:disabled {
	background: #9ca3af;
	cursor: not-allowed;
}

/* ─── Response Messages ────────────────────────────── */

.ep-helpdesk-response {
	margin-top: 16px;
	padding: 0;
	font-size: 14px;
	line-height: 1.5;
}

.ep-helpdesk-response--success {
	padding: 14px 18px;
	background: #d1fae5;
	color: #065f46;
	border-radius: 6px;
}

.ep-helpdesk-response--error {
	padding: 14px 18px;
	background: #fee2e2;
	color: #991b1b;
	border-radius: 6px;
}

.ep-helpdesk-ref-display {
	margin-top: 12px;
	padding: 12px 18px;
	background: #f0f9ff;
	border: 1px solid #bae6fd;
	border-radius: 6px;
	font-size: 14px;
	color: #0c4a6e;
}

/* ─── Ticket Status Page ───────────────────────────── */

.ep-helpdesk-status {
	max-width: 640px;
	margin: 0 auto;
}

.ep-helpdesk-status-header {
	margin-bottom: 24px;
	padding-bottom: 16px;
	border-bottom: 1px solid #e5e7eb;
}

.ep-helpdesk-ref {
	font-size: 13px;
	color: #6b7280;
	margin-bottom: 4px;
}

.ep-helpdesk-status-label {
	font-size: 16px;
	font-weight: 600;
	color: #1f2937;
}

.ep-helpdesk-ticket-detail h3 {
	font-size: 20px;
	margin-bottom: 12px;
	color: #111827;
}

.ep-helpdesk-question {
	padding: 16px;
	background: #f9fafb;
	border-radius: 6px;
	font-size: 15px;
	line-height: 1.6;
	color: #374151;
	margin-bottom: 24px;
}

.ep-helpdesk-reply {
	margin-top: 24px;
}

.ep-helpdesk-reply h4 {
	font-size: 16px;
	font-weight: 600;
	margin-bottom: 8px;
	color: #1f2937;
}

.ep-helpdesk-reply-body {
	padding: 16px;
	background: #f0f9ff;
	border-left: 3px solid #3b82f6;
	border-radius: 0 6px 6px 0;
	font-size: 15px;
	line-height: 1.6;
	color: #1e3a5f;
}

.ep-helpdesk-error {
	padding: 14px 18px;
	background: #fee2e2;
	color: #991b1b;
	border-radius: 6px;
}

/* ─── Lookup Form ──────────────────────────────────── */

.ep-helpdesk-lookup {
	max-width: 480px;
	margin: 32px auto 0;
	padding-top: 24px;
	border-top: 1px solid #e5e7eb;
}

.ep-helpdesk-lookup p {
	font-size: 14px;
	color: #6b7280;
	margin-bottom: 16px;
}

.ep-helpdesk-lookup-form .ep-helpdesk-field {
	margin-bottom: 14px;
}

/* ─── Honeypot ─────────────────────────────────────── */

.ep-hp {
	position: absolute;
	left: -9999px;
	opacity: 0;
	height: 0;
	width: 0;
	overflow: hidden;
}

/* ─── v1.2 structured intake ──────────────────────── */

.ep-helpdesk-form-v12 fieldset.ep-helpdesk-step {
	border: none;
	padding: 0;
	margin: 0 0 28px;
}

.ep-helpdesk-form-v12 fieldset.ep-helpdesk-step[hidden] {
	display: none;
}

.ep-helpdesk-form-v12 fieldset.ep-helpdesk-step > legend {
	padding: 0;
	font-size: 15px;
	font-weight: 600;
	color: #1f2937;
	margin-bottom: 12px;
	line-height: 1.35;
}

.ep-helpdesk-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 4px;
}

.ep-helpdesk-chip {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 12px;
	padding: 18px 20px;
	min-height: 88px;
	min-width: 140px;
	border: 1.5px solid #d1d5db;
	border-radius: 14px;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
	font-size: 15px;
	line-height: 1.25;
	color: #1f2937;
	user-select: none;
}

.ep-helpdesk-chip:hover,
.ep-helpdesk-chip:focus-within {
	border-color: #3b82f6;
	background: #eff6ff;
}

.ep-helpdesk-chip.is-active {
	border-color: #2563eb;
	background: #2563eb;
	color: #fff;
}

.ep-helpdesk-chip.is-active .ep-helpdesk-chip-label,
.ep-helpdesk-chip.is-active .ep-helpdesk-chip-icon {
	color: #fff;
}

.ep-helpdesk-chip input[type="radio"] {
	position: absolute;
	left: -9999px;
	opacity: 0;
	pointer-events: none;
}

.ep-helpdesk-chip-icon {
	font-size: 28px;
	line-height: 1;
	display: block;
}

.ep-helpdesk-chip-label {
	font-weight: 500;
	display: block;
}

/* Small variant for sub-chips / hosting (label only, no icon — keep compact row layout) */
.ep-helpdesk-chips--sm .ep-helpdesk-chip,
.ep-helpdesk-chip--sm {
	flex-direction: row;
	padding: 6px 16px;
	min-height: 36px;
	min-width: 0;
	border-radius: 8px;
	font-size: 14px;
	gap: 6px;
}

/* Conditional context fields — hidden until category selected */
.ep-helpdesk-form-v12 [data-context][hidden] {
	display: none;
}

/* Submit button — thumb-reach zone on mobile */
.ep-helpdesk-form-v12 .ep-helpdesk-field--submit .ep-helpdesk-submit {
	width: 100%;
	padding: 14px 20px;
	font-size: 16px;
	font-weight: 600;
	min-height: 48px;
}

/* Mobile-first refinements */
@media (max-width: 520px) {
	.ep-helpdesk-chip {
		width: 100%;
		min-height: 92px;
	}
	.ep-helpdesk-chips--sm .ep-helpdesk-chip,
	.ep-helpdesk-chip--sm {
		width: auto;
		min-height: 36px;
	}
	.ep-helpdesk-form-v12 input[type="text"],
	.ep-helpdesk-form-v12 input[type="email"],
	.ep-helpdesk-form-v12 input[type="url"],
	.ep-helpdesk-form-v12 textarea {
		font-size: 16px; /* prevent iOS zoom on focus */
	}
}

/* Accessibility: keyboard focus on chips */
.ep-helpdesk-chip input[type="radio"]:focus + .ep-helpdesk-chip-icon,
.ep-helpdesk-chip input[type="radio"]:focus ~ .ep-helpdesk-chip-label {
	outline: 2px solid #2563eb;
	outline-offset: 3px;
	border-radius: 4px;
}

.ep-helpdesk-chip:focus-within {
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* ────────────── Dark mode (v1.3) ────────────── */
/* Token overrides kick in when <html data-theme="dark"> is set.        */
/* Inline bootstrap script in pm_content applies the attribute before   */
/* first paint; ep-helpdesk.js handles the topbar toggle + persistence. */

html[data-theme="dark"] {
	--ep-charcoal: #f5eee0;
	--ep-warm-black: #f2ece0;
	--ep-cream: #17140f;
	--ep-warm-white: #1e1a14;
	--ep-gold: #d4b968;
	--ep-gold-light: #e8ce82;
	--ep-gold-bg: #2a2414;
	--ep-blue: #6b9cc4;
	--ep-blue-light: #1a2a36;
	--ep-green: #7abc8e;
	--ep-green-light: #1a2818;
	--ep-red: #e08080;
	--ep-red-light: #2a1818;
	--ep-text: #e8e0d0;
	--ep-text-light: #a89f92;
	--ep-text-faint: #6e665c;
	--ep-border: #362e24;
	--ep-border-light: #2c251c;
	--ep-card: #221d16;
	--ep-shadow-s: 0 1px 4px rgba(0, 0, 0, 0.3);
	--ep-shadow-m: 0 4px 16px rgba(0, 0, 0, 0.4);
	color-scheme: dark;
}

/* Topbar + callouts had hardcoded light fills and borders that did not
   flip with the token swap. Re-bind them to dark values here. */
html[data-theme="dark"] .topbar {
	background: rgba(30, 26, 20, 0.92);
}
html[data-theme="dark"] .callout-tip {
	border-color: rgba(122, 188, 142, 0.35);
}
html[data-theme="dark"] .callout-warn {
	border-color: rgba(212, 185, 104, 0.35);
}
html[data-theme="dark"] .callout-info {
	border-color: rgba(107, 156, 196, 0.35);
}

/* Plugin form tokens — chip border, input bg, etc. follow card tokens. */
html[data-theme="dark"] .ep-helpdesk-chip {
	background: var(--ep-card);
	border-color: var(--ep-border);
	color: var(--ep-text);
}
html[data-theme="dark"] .ep-helpdesk-chip:hover,
html[data-theme="dark"] .ep-helpdesk-chip:focus-within {
	border-color: var(--ep-gold);
	background: var(--ep-warm-white);
}
html[data-theme="dark"] .ep-helpdesk-chip.is-active {
	border-color: var(--ep-gold);
	background: var(--ep-gold);
	color: var(--ep-warm-black);
}
html[data-theme="dark"] .ep-helpdesk-chip.is-active .ep-helpdesk-chip-icon,
html[data-theme="dark"] .ep-helpdesk-chip.is-active .ep-helpdesk-chip-label {
	color: var(--ep-warm-black);
}

/* ────────────── Docs-link hint (v1.3) ────────────── */
.ep-helpdesk-docs-hint {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-top: 10px;
	padding: 12px 14px;
	background: var(--ep-gold-bg, #fdf8ed);
	border: 1px solid var(--ep-gold-light, #d4b968);
	border-left: 4px solid var(--ep-gold, #b8963e);
	border-radius: 8px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--ep-warm-black, #2a2725);
}
.ep-helpdesk-docs-hint[hidden] { display: none; }
.ep-helpdesk-docs-hint-icon {
	font-size: 18px;
	line-height: 1.4;
	flex-shrink: 0;
}
.ep-helpdesk-docs-hint-body {
	flex: 1;
}
.ep-helpdesk-docs-hint-link {
	color: var(--ep-gold, #b8963e);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}
.ep-helpdesk-docs-hint-link:hover,
.ep-helpdesk-docs-hint-link:focus {
	color: var(--ep-gold-light, #d4b968);
	text-decoration: underline;
}

/* ────────────── Topbar theme-toggle button (v1.3) ────────────── */
.topbar-theme-toggle {
	display: inline-grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 1px solid var(--ep-border, #e8e2d8);
	background: var(--ep-card, #fff);
	color: var(--ep-text-light, #7a736c);
	cursor: pointer;
	margin-left: 8px;
	padding: 0;
	transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.topbar-theme-toggle:hover {
	color: var(--ep-gold, #b8963e);
	border-color: var(--ep-gold, #b8963e);
}
.topbar-theme-toggle .theme-icon {
	width: 18px;
	height: 18px;
}
.topbar-theme-toggle .theme-icon-sun { display: block; }
.topbar-theme-toggle .theme-icon-moon { display: none; }
html[data-theme="dark"] .topbar-theme-toggle .theme-icon-sun { display: none; }
html[data-theme="dark"] .topbar-theme-toggle .theme-icon-moon { display: block; }
