/*
Theme Name: CMS-WP
Theme URI: https://github.com/your-repo/cms-wp
Author: CMS-WP
Author URI: https://github.com/your-repo/cms-wp
Description: Thème WordPress clé en main — formulaire de contact avec routage, espace membre, slider, actualités, carte OpenStreetMap, sauvegardes, statistiques. Déployable sur un WordPress vierge en quelques minutes.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 8.0
License: GPL-2.0-or-later
Text Domain: cms-wp
*/

/**
 * TABLE DES MATIÈRES
 * ==================
 *
 *  1. CSS VARIABLES .................. :18
 *  2. RESET & BASE ................... :50
 *  3. HEADER & NAVIGATION ............ :83
 *  4. HERO / SLIDER .................. :121
 *  5. SECTIONS ....................... :175
 *  6. CARDS .......................... :203
 *  7. BUTTONS ........................ :237
 *  8. FORMULAIRE DE CONTACT .......... :289
 *  9. CARTE OPENSTREETMAP ............ :329
 * 10. ESPACE MEMBRES ................. :340
 * 11. FOOTER ......................... :372
 * 12. BACK TO TOP .................... :405
 * 13. ACTUALITÉS ..................... :440
 * 14. PARTENAIRES .................... :469
 * 15. RESPONSIVE ..................... :494
 * 16. UTILITAIRES .................... :526
 * 17. BREADCRUMBS .................... :572
 * 18. ACCESSIBILITÉ .................. :601
 * 19. TOP BAR ........................ :622
 * 20. BOUTON CONTACT FLOTTANT ........ :654
 * 21. CITATION DU DIRIGEANT .......... :694
 * 22. CHIFFRES CLÉS .................. :744
 * 23. VIDÉO YOUTUBE .................. :773
 * 24. CARD HOVER ..................... :821
 * 25. DARK MODE ...................... :831
 */

/* ==========================================================================
   CSS VARIABLES — Configurable via admin (Réglages → Identité du site)
   ========================================================================== */

:root {
	/* Couleurs principales — écrasées dynamiquement par cmswp_inline_css() */
	--cmswp-primary: #2563eb;
	--cmswp-primary-dark: #1d4ed8;
	--cmswp-primary-light: #3b82f6;
	--cmswp-secondary: #10b981;
	--cmswp-secondary-dark: #059669;
	--cmswp-accent: #f59e0b;
	--cmswp-text: #1e293b;
	--cmswp-text-light: #64748b;
	--cmswp-bg: #ffffff;
	--cmswp-bg-alt: #f8fafc;
	--cmswp-border: #e2e8f0;
	--cmswp-danger: #ef4444;
	--cmswp-success: #22c55e;
	--cmswp-warning: #f59e0b;

	/* Typographie */
	--cmswp-font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--cmswp-font-heading: var(--cmswp-font-body);

	/* Espacements */
	--cmswp-radius: 0.5rem;
	--cmswp-radius-lg: 1rem;
	--cmswp-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	--cmswp-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);

	/* Transitions */
	--cmswp-transition: 0.3s ease;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */

body {
	font-family: var(--cmswp-font-body);
	color: var(--cmswp-text);
	background-color: var(--cmswp-bg);
	line-height: 1.6;
}

a {
	color: var(--cmswp-primary);
	text-decoration: none;
	transition: color var(--cmswp-transition);
}

a:hover {
	color: var(--cmswp-primary-dark);
}

h1, h2, h3, h4, h5, h6 {
	font-family: var(--cmswp-font-heading);
	font-weight: 700;
	line-height: 1.3;
	color: var(--cmswp-text);
}

img {
	max-width: 100%;
	height: auto;
}

/* ==========================================================================
   HEADER & NAVIGATION
   ========================================================================== */

.cmswp-navbar {
	background: var(--cmswp-bg);
	box-shadow: var(--cmswp-shadow);
	transition: box-shadow var(--cmswp-transition);
	z-index: 1030;
}

.cmswp-navbar.scrolled {
	box-shadow: var(--cmswp-shadow-lg);
}

.cmswp-navbar .navbar-brand img {
	max-height: 50px;
	width: auto;
}

.cmswp-navbar .nav-link {
	color: var(--cmswp-text) !important;
	font-weight: 500;
	padding: 0.5rem 1rem !important;
	transition: color var(--cmswp-transition);
}

.cmswp-navbar .nav-link:hover,
.cmswp-navbar .nav-link.active {
	color: var(--cmswp-primary) !important;
}

.cmswp-navbar .dropdown-menu {
	border: 1px solid var(--cmswp-border);
	border-radius: var(--cmswp-radius);
	box-shadow: var(--cmswp-shadow-lg);
}

/* ==========================================================================
   HERO / SLIDER
   ========================================================================== */

.cmswp-hero {
	position: relative;
	min-height: 70vh;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	color: #fff;
	overflow: hidden;
}

.cmswp-hero::before {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgba(0,0,0,0.5), rgba(0,0,0,0.3));
	z-index: 1;
}

.cmswp-hero .hero-content {
	position: relative;
	z-index: 2;
	max-width: 800px;
	padding: 2rem;
}

.cmswp-hero h1 {
	color: #fff;
	font-size: clamp(2rem, 5vw, 3.5rem);
	margin-bottom: 1rem;
}

.cmswp-hero p {
	font-size: clamp(1rem, 2vw, 1.25rem);
	margin-bottom: 2rem;
	opacity: 0.9;
}

/* Carousel slides */
.cmswp-slider .carousel-item {
	min-height: 70vh;
	background-size: cover;
	background-position: center;
}

.cmswp-slider .carousel-caption {
	bottom: 50%;
	transform: translateY(50%);
}

/* ==========================================================================
   SECTIONS
   ========================================================================== */

.cmswp-section {
	padding: 5rem 0;
}

.cmswp-section-alt {
	background-color: var(--cmswp-bg-alt);
}

.cmswp-section-title {
	text-align: center;
	margin-bottom: 3rem;
}

.cmswp-section-title h2 {
	font-size: clamp(1.5rem, 3vw, 2.25rem);
	margin-bottom: 0.75rem;
}

.cmswp-section-title p {
	color: var(--cmswp-text-light);
	max-width: 600px;
	margin: 0 auto;
}

/* ==========================================================================
   CARDS
   ========================================================================== */

.cmswp-card {
	background: var(--cmswp-bg);
	border: 1px solid var(--cmswp-border);
	border-radius: var(--cmswp-radius);
	box-shadow: var(--cmswp-shadow);
	transition: transform var(--cmswp-transition), box-shadow var(--cmswp-transition);
	overflow: hidden;
}

.cmswp-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--cmswp-shadow-lg);
}

.cmswp-card-img {
	width: 100%;
	height: 200px;
	object-fit: cover;
}

.cmswp-card-body {
	padding: 1.5rem;
}

.cmswp-card-meta {
	font-size: 0.85rem;
	color: var(--cmswp-text-light);
	margin-bottom: 0.5rem;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn-cmswp {
	background-color: var(--cmswp-primary);
	border-color: var(--cmswp-primary);
	color: #fff;
	border-radius: var(--cmswp-radius);
	padding: 0.625rem 1.5rem;
	font-weight: 500;
	transition: all var(--cmswp-transition);
}

.btn-cmswp:hover {
	background-color: var(--cmswp-primary-dark);
	border-color: var(--cmswp-primary-dark);
	color: #fff;
	transform: translateY(-1px);
}

.btn-cmswp-outline {
	background: transparent;
	border: 2px solid var(--cmswp-primary);
	color: var(--cmswp-primary);
	border-radius: var(--cmswp-radius);
	padding: 0.5rem 1.5rem;
	font-weight: 500;
	transition: all var(--cmswp-transition);
}

.btn-cmswp-outline:hover {
	background-color: var(--cmswp-primary);
	color: #fff;
}

.btn-cmswp-secondary {
	background-color: var(--cmswp-secondary);
	border-color: var(--cmswp-secondary);
	color: #fff;
	border-radius: var(--cmswp-radius);
	padding: 0.625rem 1.5rem;
	font-weight: 500;
	transition: all var(--cmswp-transition);
}

.btn-cmswp-secondary:hover {
	background-color: var(--cmswp-secondary-dark);
	border-color: var(--cmswp-secondary-dark);
	color: #fff;
}

/* ==========================================================================
   FORMULAIRE DE CONTACT
   ========================================================================== */

.cmswp-form .form-control,
.cmswp-form .form-select {
	border: 1px solid var(--cmswp-border);
	border-radius: var(--cmswp-radius);
	padding: 0.75rem 1rem;
	transition: border-color var(--cmswp-transition), box-shadow var(--cmswp-transition);
}

.cmswp-form .form-control:focus,
.cmswp-form .form-select:focus {
	border-color: var(--cmswp-primary);
	box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

.cmswp-form label {
	font-weight: 500;
	margin-bottom: 0.375rem;
	color: var(--cmswp-text);
}

.cmswp-alert-success {
	background-color: #f0fdf4;
	border: 1px solid var(--cmswp-success);
	color: #166534;
	border-radius: var(--cmswp-radius);
	padding: 1rem 1.5rem;
}

.cmswp-alert-error {
	background-color: #fef2f2;
	border: 1px solid var(--cmswp-danger);
	color: #991b1b;
	border-radius: var(--cmswp-radius);
	padding: 1rem 1.5rem;
}

/* ==========================================================================
   CARTE OPENSTREETMAP
   ========================================================================== */

.cmswp-map {
	width: 100%;
	height: 400px;
	border-radius: var(--cmswp-radius);
	border: 1px solid var(--cmswp-border);
}

/* ==========================================================================
   ESPACE MEMBRES
   ========================================================================== */

.cmswp-login-box {
	max-width: 400px;
	margin: 3rem auto;
	padding: 2rem;
	background: var(--cmswp-bg);
	border: 1px solid var(--cmswp-border);
	border-radius: var(--cmswp-radius-lg);
	box-shadow: var(--cmswp-shadow-lg);
	text-align: center;
}

.cmswp-login-box h3 {
	margin-bottom: 1.5rem;
}

.cmswp-member-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	background: #f0fdf4;
	color: #166534;
	border: 1px solid #bbf7d0;
	padding: 0.25rem 0.75rem;
	border-radius: 2rem;
	font-size: 0.85rem;
	font-weight: 500;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.cmswp-footer {
	background-color: var(--cmswp-text);
	color: #cbd5e1;
	padding: 3rem 0 1.5rem;
}

.cmswp-footer h5 {
	color: #fff;
	font-size: 1.1rem;
	margin-bottom: 1rem;
}

.cmswp-footer a {
	color: #94a3b8;
	transition: color var(--cmswp-transition);
}

.cmswp-footer a:hover {
	color: #fff;
}

.cmswp-footer-bottom {
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	padding-top: 1.5rem;
	margin-top: 2rem;
	font-size: 0.85rem;
	color: #64748b;
}

/* ==========================================================================
   BACK TO TOP
   ========================================================================== */

.cmswp-back-to-top {
	position: fixed;
	bottom: 2rem;
	right: 2rem;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--cmswp-primary);
	color: #fff;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: all var(--cmswp-transition);
	z-index: 1000;
	cursor: pointer;
	box-shadow: var(--cmswp-shadow-lg);
}

.cmswp-back-to-top.visible {
	opacity: 1;
	visibility: visible;
}

.cmswp-back-to-top:hover {
	background: var(--cmswp-primary-dark);
	transform: translateY(-2px);
}

/* ==========================================================================
   ACTUALITÉS
   ========================================================================== */

.cmswp-post-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 2rem;
}

.cmswp-post-date {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	font-size: 0.85rem;
	color: var(--cmswp-text-light);
}

.cmswp-post-category {
	display: inline-block;
	background-color: var(--cmswp-primary);
	color: #fff;
	padding: 0.15rem 0.625rem;
	border-radius: 2rem;
	font-size: 0.75rem;
	font-weight: 500;
	text-transform: uppercase;
}

/* ==========================================================================
   PARTENAIRES
   ========================================================================== */

.cmswp-partners {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 2rem;
}

.cmswp-partners img {
	max-height: 60px;
	width: auto;
	filter: grayscale(100%);
	opacity: 0.6;
	transition: all var(--cmswp-transition);
}

.cmswp-partners img:hover {
	filter: grayscale(0%);
	opacity: 1;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 991.98px) {
	.cmswp-hero {
		min-height: 50vh;
	}

	.cmswp-section {
		padding: 3rem 0;
	}

	.cmswp-post-grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 575.98px) {
	.cmswp-hero h1 {
		font-size: 1.75rem;
	}

	.cmswp-section-title h2 {
		font-size: 1.5rem;
	}

	.cmswp-card-img {
		height: 160px;
	}
}

/* ==========================================================================
   UTILITAIRES
   ========================================================================== */

.cmswp-content-private {
	border: 2px dashed var(--cmswp-warning);
	padding: 2rem;
	border-radius: var(--cmswp-radius);
	text-align: center;
	background: #fffbeb;
}

.cmswp-badge-private {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	background: #fef3c7;
	color: #92400e;
	padding: 0.15rem 0.5rem;
	border-radius: 2rem;
	font-size: 0.75rem;
	font-weight: 500;
}

.cmswp-pagination .page-link {
	color: var(--cmswp-primary);
	border-radius: var(--cmswp-radius);
}

.cmswp-pagination .page-item.active .page-link {
	background-color: var(--cmswp-primary);
	border-color: var(--cmswp-primary);
}

/* Animation fade-in */
.cmswp-fade-in {
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 0.6s ease, transform 0.6s ease;
}

.cmswp-fade-in.visible {
	opacity: 1;
	transform: translateY(0);
}

/* ==========================================================================
   BREADCRUMBS
   ========================================================================== */

.cmswp-breadcrumbs .breadcrumb {
	background: none;
	padding: 0;
	margin-bottom: 1.5rem;
	font-size: 0.85rem;
}

.cmswp-breadcrumbs .breadcrumb-item + .breadcrumb-item::before {
	content: "›";
	color: var(--cmswp-text-light);
}

.cmswp-breadcrumbs .breadcrumb-item a {
	color: var(--cmswp-text-light);
	text-decoration: none;
}

.cmswp-breadcrumbs .breadcrumb-item a:hover {
	color: var(--cmswp-primary);
}

.cmswp-breadcrumbs .breadcrumb-item.active {
	color: var(--cmswp-text);
}

/* ==========================================================================
   ACCESSIBILITÉ — Skip link
   ========================================================================== */

.cmswp-skip-link {
	position: absolute;
	top: -100%;
	left: 1rem;
	z-index: 9999;
	background: var(--cmswp-primary);
	color: #fff;
	padding: 0.5rem 1rem;
	border-radius: var(--cmswp-radius);
	text-decoration: none;
	font-weight: 500;
}

.cmswp-skip-link:focus {
	top: 0.5rem;
}

/* ==========================================================================
   TOP BAR
   ========================================================================== */

.cmswp-topbar {
	background: var(--cmswp-primary);
	color: rgba(255, 255, 255, 0.9);
	font-size: 0.8rem;
	padding: 0.375rem 0;
	transition: transform var(--cmswp-transition);
}

.cmswp-topbar a {
	color: #fff;
	text-decoration: none;
	font-weight: 500;
}

.cmswp-topbar a:hover {
	color: rgba(255, 255, 255, 0.8);
}

.cmswp-topbar-right {
	display: flex;
	gap: 1.5rem;
	align-items: center;
}

@media (max-width: 575.98px) {
	.cmswp-topbar-left { display: none; }
}

/* ==========================================================================
   BOUTON CONTACT FLOTTANT
   ========================================================================== */

.cmswp-floating-contact {
	position: fixed;
	bottom: 2rem;
	left: 2rem;
	background: var(--cmswp-primary);
	color: #fff;
	border-radius: 2rem;
	padding: 0.625rem 1.25rem;
	font-size: 0.9rem;
	font-weight: 500;
	text-decoration: none;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	z-index: 1000;
	box-shadow: var(--cmswp-shadow-lg);
	transition: all var(--cmswp-transition);
}

.cmswp-floating-contact:hover {
	background: var(--cmswp-primary-dark);
	color: #fff;
	transform: translateY(-2px);
}

@media (max-width: 575.98px) {
	.cmswp-floating-contact span { display: none; }
	.cmswp-floating-contact {
		width: 44px;
		height: 44px;
		border-radius: 50%;
		padding: 0;
		justify-content: center;
	}
}

/* ==========================================================================
   CITATION DU DIRIGEANT
   ========================================================================== */

.cmswp-quote {
	display: flex;
	gap: 2rem;
	align-items: center;
	max-width: 800px;
	margin: 0 auto;
}

.cmswp-quote-photo {
	flex-shrink: 0;
	width: 100px;
	height: 100px;
	border-radius: 50%;
	object-fit: cover;
	border: 3px solid var(--cmswp-primary);
}

.cmswp-quote blockquote {
	font-size: 1.1rem;
	font-style: italic;
	color: var(--cmswp-text);
	border-left: 4px solid var(--cmswp-primary);
	padding-left: 1.5rem;
	margin: 0;
	line-height: 1.7;
}

.cmswp-quote cite {
	display: block;
	margin-top: 0.75rem;
	font-style: normal;
	font-weight: 600;
	font-size: 0.95rem;
	color: var(--cmswp-primary);
}

.cmswp-quote cite span {
	font-weight: 400;
	color: var(--cmswp-text-light);
}

@media (max-width: 575.98px) {
	.cmswp-quote { flex-direction: column; text-align: center; }
	.cmswp-quote blockquote { border-left: none; padding-left: 0; }
}

/* ==========================================================================
   CHIFFRES CLÉS
   ========================================================================== */

.cmswp-figures {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 2rem;
}

.cmswp-figure-item {
	text-align: center;
	min-width: 150px;
}

.cmswp-figure-number {
	font-size: clamp(2rem, 4vw, 3rem);
	font-weight: 800;
	color: var(--cmswp-primary);
	line-height: 1.2;
}

.cmswp-figure-label {
	font-size: 0.9rem;
	color: var(--cmswp-text-light);
	margin-top: 0.25rem;
}

/* ==========================================================================
   VIDÉO YOUTUBE (Facade)
   ========================================================================== */

.cmswp-video-facade {
	position: relative;
	width: 100%;
	padding-bottom: 56.25%;
	background: #000;
	border-radius: var(--cmswp-radius);
	overflow: hidden;
	cursor: pointer;
}

.cmswp-video-facade img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cmswp-video-facade::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 68px;
	height: 48px;
	background: rgba(255, 0, 0, 0.85);
	border-radius: 12px;
	pointer-events: none;
}

.cmswp-video-facade::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-46%, -50%);
	border-style: solid;
	border-width: 10px 0 10px 18px;
	border-color: transparent transparent transparent #fff;
	z-index: 1;
	pointer-events: none;
}

/* ==========================================================================
   CARD HOVER ENRICHI
   ========================================================================== */

.cmswp-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--cmswp-shadow-lg);
	border-color: var(--cmswp-primary-light);
}

/* ==========================================================================
   DARK MODE (préférence système)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
	:root {
		--cmswp-text: #e2e8f0;
		--cmswp-text-light: #94a3b8;
		--cmswp-bg: #0f172a;
		--cmswp-bg-alt: #1e293b;
		--cmswp-border: #334155;
		--cmswp-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
		--cmswp-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.3);
	}

	body { color-scheme: dark; }

	.cmswp-navbar { background: var(--cmswp-bg); }
	.cmswp-card { background: var(--cmswp-bg); }
	.cmswp-footer { background: #020617; }

	.cmswp-login-box {
		background: var(--cmswp-bg);
		border-color: var(--cmswp-border);
	}

	.cmswp-alert-success { background: #052e16; color: #86efac; }
	.cmswp-alert-error { background: #450a0a; color: #fca5a5; }
	.cmswp-content-private { background: #422006; }
	.cmswp-badge-private { background: #422006; color: #fbbf24; }

	.cmswp-partners img { filter: grayscale(100%) invert(1); opacity: 0.5; }
	.cmswp-partners img:hover { filter: grayscale(0%) invert(0); opacity: 1; }

	img { opacity: 0.9; }
}
