/**
 * HL Formations Core - Design System & UI Hierarchy
 *
 * Provides a modern, accessible, and structured directory layout for formations.
 */

:root {
	/* Site Color Palette Variables (with Astra global palette fallbacks) */
	--hl-bg-primary: var(--ast-global-color-4, #f7f4ee);
	--hl-bg-secondary: var(--ast-global-color-5, #efe9e0);
	--hl-color-brand: var(--ast-global-color-0, #0c71c3);
	--hl-color-brand-hover: var(--ast-global-color-1, #045cb4);
	--hl-color-featured: var(--ast-global-color-9, #7b471e);
	--hl-color-heading: var(--ast-global-color-2, #1f1d1a);
	--hl-color-text: var(--ast-global-color-3, #1f1d1a);
	--hl-color-text-muted: #6e6459;
	--hl-color-border: #ded7cb;
	--hl-color-border-hover: #cbbead;
	--hl-color-card-bg: #ffffff;
}

/* ==========================================================================
   1. Level Section & Container Hierarchy
   ========================================================================== */
.hl-formations-levels-container {
	display: flex;
	flex-direction: column;
	gap: 40px;
	margin: 32px 0 48px;
	width: 100%;
}

.hl-level-section {
	background: var(--hl-bg-secondary, #efe9e0);
	border: 1px solid var(--hl-color-border, #ded7cb);
	border-radius: 16px;
	padding: 24px 24px 28px;
	box-shadow: 0 1px 4px rgba(31, 29, 26, 0.03);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hl-level-section:hover {
	border-color: var(--hl-color-border-hover, #cbbead);
	box-shadow: 0 4px 14px rgba(31, 29, 26, 0.06);
}

.hl-level-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 20px;
	padding-bottom: 16px;
	border-bottom: 2px solid var(--hl-color-border, #ded7cb);
	flex-wrap: wrap;
}

.hl-level-heading {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--hl-color-heading, #1f1d1a);
	line-height: 1.3;
	flex-wrap: wrap;
}

.hl-level-pill {
	background: var(--hl-color-featured, #7b471e);
	color: #ffffff !important;
	padding: 4px 12px;
	border-radius: 6px;
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	display: inline-block;
}

.hl-level-subtitle {
	color: var(--hl-color-heading, #1f1d1a);
	font-weight: 600;
	font-size: 1.12rem;
}

.hl-level-count {
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--hl-color-text-muted, #6e6459);
	background: #ffffff;
	border: 1px solid var(--hl-color-border, #ded7cb);
	padding: 4px 12px;
	border-radius: 9999px;
	white-space: nowrap;
}

.hl-level-posts {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.hl-level-formation-item {
	width: 100%;
}

.hl-no-formations {
	padding: 32px 24px;
	background: var(--hl-bg-primary, #f7f4ee);
	border: 1px dashed var(--hl-color-border, #ded7cb);
	border-radius: 12px;
	text-align: center;
	color: var(--hl-color-text-muted, #6e6459);
	font-size: 1rem;
	font-style: italic;
}

/* ==========================================================================
   2. Formation Card & Accordion Component
   ========================================================================== */
.hl-formation-toggle-box,
details.wp-block-details {
	border: 1.5px solid var(--hl-color-border, #ded7cb);
	border-radius: 12px;
	background: var(--hl-color-card-bg, #ffffff);
	box-shadow: 0 1px 4px rgba(31, 29, 26, 0.03);
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	overflow: hidden;
	margin: 0 !important;
	padding: 0 !important;
}

.hl-formation-toggle-box:hover,
details.wp-block-details:hover {
	border-color: var(--hl-color-brand, #0c71c3);
	box-shadow: 0 4px 14px rgba(12, 113, 195, 0.12);
}

.hl-formation-toggle-box[open],
details.wp-block-details[open] {
	border-color: var(--hl-color-brand, #0c71c3);
	box-shadow: 0 6px 20px rgba(12, 113, 195, 0.14);
}

/* ==========================================================================
   3. Summary Header Row
   ========================================================================== */
.hl-formation-toggle-box summary,
details.wp-block-details summary {
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 20px !important;
	cursor: pointer;
	user-select: none;
	list-style: none !important;
	background-color: #ffffff;
	transition: background-color 0.2s ease, border-color 0.2s ease;
	border-bottom: 1px solid transparent;
}

.hl-formation-toggle-box summary::-webkit-details-marker,
details.wp-block-details summary::-webkit-details-marker {
	display: none !important;
}

.hl-formation-toggle-box summary::marker,
details.wp-block-details summary::marker {
	display: none !important;
	content: "" !important;
}

.hl-formation-toggle-box summary:hover,
details.wp-block-details summary:hover {
	background-color: var(--hl-bg-primary, #f7f4ee);
}

.hl-formation-toggle-box[open] summary,
details.wp-block-details[open] summary {
	background-color: #f7fbff;
	border-bottom-color: #e1effa;
}

/* Title on the Left */
.hl-summary-title {
	flex: 1;
	font-size: 1.05rem;
	font-weight: 600;
	color: var(--hl-color-heading, #1f1d1a);
	line-height: 1.45;
	padding-right: 8px;
}

.hl-formation-toggle-box[open] .hl-summary-title {
	color: var(--hl-color-brand, #0c71c3);
}

/* Actions (Badge + Toggle Icon) on the Right */
.hl-summary-actions {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

/* ==========================================================================
   4. Status Badges
   ========================================================================== */
.hl-status-badge-wrap {
	display: inline-flex;
	align-items: center;
	margin: 0 !important;
}

.hl-status-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px;
	border-radius: 9999px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.25;
	white-space: nowrap;
}

/* Status: Ouvertes (Green) */
.hl-status-badge.is-open {
	background-color: #ecfdf5;
	color: #065f46;
	border: 1px solid #a7f3d0;
}

.hl-status-pulse {
	width: 7px;
	height: 7px;
	background: #10b981;
	border-radius: 50%;
	box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
	animation: hlBadgePulseGreen 2s infinite;
	flex-shrink: 0;
}

/* Status: Prochainement (Amber) */
.hl-status-badge.is-soon {
	background-color: #fffbeb;
	color: #92400e;
	border: 1px solid #fde68a;
}

.hl-status-pulse-soon {
	width: 7px;
	height: 7px;
	background: #f59e0b;
	border-radius: 50%;
	box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
	animation: hlBadgePulseAmber 2s infinite;
	flex-shrink: 0;
}

/* Status: Pas encore ouvertes (Warm stone neutral) */
.hl-status-badge.is-not-open {
	background-color: var(--hl-bg-primary, #f7f4ee);
	color: var(--hl-color-text-muted, #5c5347);
	border: 1px solid var(--hl-color-border, #ded7cb);
}

.hl-status-dot-slate {
	width: 7px;
	height: 7px;
	background: var(--hl-color-text-muted, #8c7f70);
	border-radius: 50%;
	flex-shrink: 0;
}

/* Status: Closes (Red) */
.hl-status-badge.is-closed {
	background-color: #fef2f2;
	color: #991b1b;
	border: 1px solid #fecaca;
}

.hl-status-dot-closed {
	width: 7px;
	height: 7px;
	background: #ef4444;
	border-radius: 50%;
	flex-shrink: 0;
}

/* Pulse Animations */
@keyframes hlBadgePulseGreen {
	0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
	70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
	100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes hlBadgePulseAmber {
	0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
	70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
	100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* ==========================================================================
   5. Pixel-Perfect Centered + / − Vector Marker
   ========================================================================== */
.hl-formation-toggle-box summary::after,
details.wp-block-details summary::after {
	content: "";
	display: inline-block;
	width: 30px;
	height: 30px;
	min-width: 30px;
	border-radius: 50%;
	background-color: var(--hl-bg-primary, #f7f4ee);
	border: 1px solid var(--hl-color-border, #ded7cb);
	background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 width=%2214%22 height=%2214%22 fill=%22none%22 stroke=%22%237b471e%22 stroke-width=%222.5%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cline x1=%2212%22 y1=%225%22 x2=%2212%22 y2=%2219%22/%3E%3Cline x1=%225%22 y1=%2212%22 x2=%2219%22 y2=%2212%22/%3E%3C/svg%3E");
	background-position: center center;
	background-repeat: no-repeat;
	transform-origin: center center;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	flex-shrink: 0;
	box-sizing: border-box;
}

.hl-formation-toggle-box summary:hover::after,
details.wp-block-details summary:hover::after {
	border-color: var(--hl-color-brand, #0c71c3);
	background-color: #e7f3fd;
	background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 width=%2214%22 height=%2214%22 fill=%22none%22 stroke=%22%230c71c3%22 stroke-width=%222.5%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cline x1=%2212%22 y1=%225%22 x2=%2212%22 y2=%2219%22/%3E%3Cline x1=%225%22 y1=%2212%22 x2=%2219%22 y2=%2212%22/%3E%3C/svg%3E");
}

.hl-formation-toggle-box[open] summary::after,
details.wp-block-details[open] summary::after {
	background-color: var(--hl-color-brand, #0c71c3);
	border-color: var(--hl-color-brand, #0c71c3);
	background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 width=%2214%22 height=%2214%22 fill=%22none%22 stroke=%22%23ffffff%22 stroke-width=%222.5%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cline x1=%225%22 y1=%2212%22 x2=%2219%22 y2=%2212%22/%3E%3C/svg%3E");
	transform: rotate(180deg);
}

/* ==========================================================================
   6. Card Interior Content (Expanded Details)
   ========================================================================== */
.hl-formation-body {
	padding: 24px 26px;
	background: #ffffff;
	border-top: 1px solid var(--hl-bg-secondary, #efe9e0);
}

.hl-formation-body > *:first-child {
	margin-top: 0;
}

.hl-formation-body > *:last-child {
	margin-bottom: 0;
}

.hl-formation-body p {
	margin-bottom: 16px;
	line-height: 1.6;
	color: var(--hl-color-text, #1f1d1a);
}

.hl-formation-body .wp-block-buttons {
	margin-top: 20px;
}

.hl-formation-body .wp-block-button__link {
	background-color: var(--hl-color-brand, #0c71c3);
	color: #ffffff;
	border-radius: 8px;
	transition: background-color 0.2s ease;
}

.hl-formation-body .wp-block-button__link:hover {
	background-color: var(--hl-color-brand-hover, #045cb4);
}

/* ==========================================================================
   7. Responsive Layout (Mobile & Tablet)
   ========================================================================== */
@media (max-width: 680px) {
	.hl-level-section {
		padding: 16px;
		border-radius: 12px;
	}

	.hl-level-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}

	.hl-formation-toggle-box summary,
	details.wp-block-details summary {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
		padding: 14px 16px !important;
	}

	.hl-summary-actions {
		width: 100%;
		justify-content: space-between;
	}

	.hl-formation-body {
		padding: 18px 16px;
	}
}
