/* ==========================================================================
 * WC Devis VosFactures — styles front
 * La couleur d'accent (--wcdv-accent) est injectée depuis les réglages.
 * ========================================================================== */
:root {
	--wcdv-accent: #e6492d;
	--wcdv-success: #2e7d32;
	--wcdv-muted: #6b7280;
	--wcdv-border: #e8e8e8;
}

/* --------------------------------------------------------------------------
 * Bouton / lien produit « Ajouter au devis »
 * Le conteneur reçoit .is-in-quote quand le produit est dans le devis.
 * ----------------------------------------------------------------------- */
.wcdv-actions {
	width: 100%;
	margin-top: .6em;
	line-height: 1.4;
}
.wcdv-actions .wcdv-icon {
	width: 1.05em;
	height: 1.05em;
	flex-shrink: 0;
}
.wcdv-actions.is-in-quote .wcdv-add,
.wcdv-actions:not(.is-in-quote) .wcdv-view {
	display: none !important;
}
.wcdv-add.is-loading {
	opacity: .55;
	pointer-events: none;
}
.wcdv-actions a:focus-visible,
.wcdv-actions button:focus-visible {
	outline: 2px solid var(--wcdv-accent);
	outline-offset: 2px;
}

/* 1. Bouton plein (style du thème) — présentation historique */
.wcdv-style-button .wcdv-add {
	display: block;
	width: 100%;
}
.wcdv-style-button .wcdv-view {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .5em;
	width: 100%;
	padding: .7em 1em;
	border-radius: 4px;
	background: var(--wcdv-success);
	color: #fff;
	font-weight: 600;
	text-decoration: none;
	box-sizing: border-box;
}
.wcdv-style-button .wcdv-view:hover {
	color: #fff;
	filter: brightness(.94);
}

/* 2. Bouton contour — même emprise, beaucoup moins de poids visuel */
.wcdv-style-outline .wcdv-add,
.wcdv-style-outline .wcdv-view {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .5em;
	width: 100%;
	padding: .55em 1em;
	border: 1px solid currentColor;
	border-radius: 4px;
	background: transparent;
	font-size: .9em;
	font-weight: 600;
	text-decoration: none;
	box-sizing: border-box;
	transition: background-color .15s ease, color .15s ease;
}
.wcdv-style-outline .wcdv-add {
	color: inherit;
	border-color: #cfd3d8;
}
.wcdv-style-outline .wcdv-add:hover {
	color: var(--wcdv-accent);
	border-color: var(--wcdv-accent);
}
.wcdv-style-outline .wcdv-view {
	color: var(--wcdv-success);
	border-color: #b9d8bb;
}
.wcdv-style-outline .wcdv-view:hover {
	color: var(--wcdv-success);
	background: #f1f8f1;
}

/* 3 & 4. Styles « lien » : état ajouté commun */
.wcdv-style-link .wcdv-view,
.wcdv-style-minimal .wcdv-view {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: .35em .6em;
}
.wcdv-view-status {
	display: inline-flex;
	align-items: center;
	gap: .3em;
	color: var(--wcdv-success);
	font-weight: 600;
}
.wcdv-view-link {
	display: inline-flex;
	align-items: center;
	gap: .2em;
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
}
.wcdv-view-link:hover {
	color: var(--wcdv-accent);
}

/* 3. Lien texte avec icône */
.wcdv-style-link .wcdv-add {
	display: inline-flex;
	align-items: center;
	gap: .4em;
	color: inherit;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
}
.wcdv-style-link .wcdv-add:hover {
	color: var(--wcdv-accent);
}

/* 4. Lien minimal — petit, gris, se fait oublier */
.wcdv-style-minimal {
	font-size: .85em;
}
.wcdv-style-minimal .wcdv-add {
	display: inline-flex;
	align-items: center;
	gap: .35em;
	color: var(--wcdv-muted);
	text-decoration: none;
}
.wcdv-style-minimal .wcdv-add:hover {
	color: var(--wcdv-accent);
	text-decoration: underline;
	text-underline-offset: 3px;
}
.wcdv-style-minimal .wcdv-view-status {
	font-weight: 500;
}
.wcdv-style-minimal .wcdv-view-link {
	color: var(--wcdv-muted);
}

/* --------------------------------------------------------------------------
 * Compteur [wcdv_compteur]
 * ----------------------------------------------------------------------- */
.wcdv-link {
	display: inline-flex;
	align-items: center;
	gap: .5em;
	color: inherit;
	text-decoration: none;
	line-height: 1;
}
.wcdv-icon-wrap {
	position: relative;
	display: inline-flex;
}
.wcdv-link .wcdv-icon {
	width: 26px;
	height: 26px;
	stroke-width: 1.7;
}
.wcdv-count {
	position: absolute;
	top: -8px;
	right: -10px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 9px;
	background: var(--wcdv-badge, var(--wcdv-accent));
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	box-sizing: border-box;
}
.wcdv-count.is-empty {
	display: none;
}
.wcdv-label {
	font-weight: 600;
}

/* --------------------------------------------------------------------------
 * Messages après envoi
 * ----------------------------------------------------------------------- */
.wcdv-notice {
	max-width: 640px;
	margin: 2em auto;
	padding: 2em;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	text-align: center;
	box-sizing: border-box;
}
.wcdv-notice h2,
.wcdv-notice h3 {
	margin: 0 0 .4em;
}
.wcdv-notice p {
	margin: 0;
}
.wcdv-notice--success {
	border-top: 4px solid var(--wcdv-success);
}
.wcdv-notice--success h2 {
	color: #1b5e20;
}
.wcdv-notice--success p {
	color: #555;
}
.wcdv-notice--error {
	border-color: #f3b7b7;
	border-top: 4px solid #c0392b;
	color: #8a1c1c;
}
.wcdv-notice--error h3 {
	color: #8a1c1c;
}
.wcdv-notice-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	margin: 0 auto 1em;
	border-radius: 50%;
	background: #e8f5e9;
	color: var(--wcdv-success);
}
.wcdv-notice-icon .wcdv-icon {
	width: 28px;
	height: 28px;
	stroke-width: 2.5;
}

/* --------------------------------------------------------------------------
 * Page devis [wcdv_page]
 * ----------------------------------------------------------------------- */
.wcdv-wrap {
	max-width: 1000px;
	margin: 0 auto;
}
.wcdv-wrap * {
	box-sizing: border-box;
}
.wcdv-card {
	background: #fff;
	border: 1px solid var(--wcdv-border);
	border-radius: 12px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, .04);
	padding: 1.6em 1.8em;
	margin-bottom: 1.6em;
}
.wcdv-section-title {
	display: flex;
	align-items: center;
	gap: .6em;
	font-size: 1.15em;
	font-weight: 700;
	margin: 0 0 1.2em;
	padding-bottom: .7em;
	border-bottom: 2px solid #f0f0f0;
}
.wcdv-section-title::before {
	content: "";
	width: 5px;
	height: 22px;
	border-radius: 3px;
	background: var(--wcdv-accent);
}

.wcdv-items {
	width: 100%;
	border-collapse: collapse;
}
.wcdv-items th {
	text-align: left;
	font-size: .78em;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: #999;
	padding: 0 .8em .8em;
	border-bottom: 1px solid #eee;
}
.wcdv-items td {
	padding: 1em .8em;
	border-bottom: 1px solid #f2f2f2;
	vertical-align: middle;
}
.wcdv-items .wcdv-col-price {
	white-space: nowrap;
	text-align: right;
	min-width: 92px;
}
.wcdv-items th.wcdv-col-price {
	text-align: right;
}
.wcdv-items .wcdv-col-qty,
.wcdv-items th.wcdv-col-qty {
	text-align: center;
}
.wcdv-items .wcdv-col-qty {
	width: 90px;
}
.wcdv-items .wcdv-col-name {
	width: 100%;
}
.wcdv-items .wcdv-col-thumb {
	width: 72px;
	padding-right: 0;
}
.wcdv-thumb {
	display: block;
	width: 60px !important;
	height: 60px !important;
	max-width: 60px !important;
	border-radius: 8px;
	object-fit: cover;
	border: 1px solid #eee;
	background: #fafafa;
}
.wcdv-pname {
	font-weight: 600;
	color: #222;
	overflow-wrap: anywhere;
}
.wcdv-qty {
	width: 64px;
	padding: .45em;
	border: 1px solid #ddd;
	border-radius: 6px;
	text-align: center;
}
.wcdv-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	color: #bbb;
	font-size: 1.1em;
	text-decoration: none;
	transition: background-color .15s ease, color .15s ease;
}
.wcdv-remove:hover {
	background: #fde8e8;
	color: var(--wcdv-accent);
}
.wcdv-subtotal {
	text-align: right;
	font-size: 1.15em;
	margin: 1.2em .2em 0;
}
.wcdv-subtotal strong {
	color: var(--wcdv-accent);
}
.wcdv-subtotal small {
	color: #999;
	font-size: .7em;
}

/* Formulaire */
.wcdv-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.1em;
}
.wcdv-grid .full {
	grid-column: 1 / 3;
}
.wcdv-field label {
	display: block;
	font-size: .85em;
	font-weight: 600;
	color: #444;
	margin-bottom: .35em;
}
.wcdv-field input,
.wcdv-field select,
.wcdv-field textarea {
	width: 100%;
	padding: .7em .8em;
	border: 1px solid #ddd;
	border-radius: 8px;
	font-size: .95em;
	background: #fff;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.wcdv-field input:focus,
.wcdv-field select:focus,
.wcdv-field textarea:focus {
	outline: none;
	border-color: var(--wcdv-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--wcdv-accent) 14%, transparent);
}
.wcdv-check {
	display: flex;
	align-items: center;
	gap: .5em;
	margin-top: 1.1em;
	cursor: pointer;
	font-weight: 600;
	color: #444;
}
.wcdv-check input {
	margin: 0;
}
.wcdv-ship-address {
	margin-top: 1.2em;
	padding-top: 1.2em;
	border-top: 1px dashed #e0e0e0;
}
.wcdv-ship-address[hidden] {
	display: none !important;
}
.wcdv-ship-box {
	padding: 1.1em;
	background: #f9f9f9;
	border: 1px dashed #d8d8d8;
	border-radius: 8px;
	color: #666;
}
.wcdv-ship-option {
	display: flex;
	align-items: center;
	gap: .6em;
	padding: .7em .9em;
	margin: .4em 0;
	background: #fff;
	border: 1px solid #e2e2e2;
	border-radius: 8px;
	cursor: pointer;
	color: #222;
}
.wcdv-ship-option input {
	margin: 0;
}
.wcdv-ship-option span {
	flex: 1;
}
.wcdv-ship-option:has(input:checked) {
	border-color: var(--wcdv-accent);
}
.wcdv-note {
	color: #888;
	font-size: .9em;
	margin: .8em 0 0;
}

.wcdv-submit-row {
	text-align: center;
	margin: 2em 0;
}
.wcdv-submit,
.wcdv-btn {
	display: inline-flex;
	align-items: center;
	gap: .6em;
	background: var(--wcdv-accent);
	color: #fff;
	border: none;
	border-radius: 8px;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	transition: filter .15s ease, transform .15s ease;
}
.wcdv-submit {
	font-size: 1.05em;
	padding: .95em 2.2em;
	box-shadow: 0 4px 14px color-mix(in srgb, var(--wcdv-accent) 30%, transparent);
}
.wcdv-btn {
	padding: .8em 2em;
	font-weight: 600;
}
.wcdv-submit:hover,
.wcdv-btn:hover {
	color: #fff;
	filter: brightness(.93);
}
.wcdv-submit:hover {
	transform: translateY(-1px);
}
.wcdv-submit .wcdv-icon {
	width: 18px;
	height: 18px;
	stroke-width: 2.4;
}

/* Devis vide */
.wcdv-empty {
	text-align: center;
	padding: 3em 1em;
}
.wcdv-empty h3 {
	margin: 0 0 .5em;
}
.wcdv-empty p {
	color: #777;
	margin: 0 0 1.4em;
}
.wcdv-empty-icon .wcdv-icon {
	width: 56px;
	height: 56px;
	margin-bottom: 1em;
	color: #ccc;
	stroke-width: 1.5;
}

@media (prefers-reduced-motion: reduce) {
	.wcdv-wrap *,
	.wcdv-actions * {
		transition: none !important;
		transform: none !important;
	}
}

/* Mobile : le tableau devient des cartes empilées */
@media (max-width: 600px) {
	.wcdv-grid {
		grid-template-columns: 1fr;
	}
	.wcdv-grid .full {
		grid-column: 1;
	}
	.wcdv-items,
	.wcdv-items tbody,
	.wcdv-items tr,
	.wcdv-items td {
		display: block;
		width: 100%;
	}
	.wcdv-items thead {
		display: none;
	}
	.wcdv-items tr {
		position: relative;
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 8px 12px;
		padding: 12px 14px;
		margin-bottom: 12px;
		border: 1px solid #eee;
		border-radius: 10px;
	}
	.wcdv-items td {
		width: auto;
		padding: 0 !important;
		border: none !important;
	}
	.wcdv-items .wcdv-col-thumb { order: 1; }
	.wcdv-items .wcdv-col-name { order: 2; flex: 1; min-width: 0; }
	.wcdv-items .wcdv-col-price[data-label] { order: 4; }
	.wcdv-items .wcdv-col-qty {
		order: 3;
		display: flex;
		align-items: center;
		gap: 8px;
		width: 100%;
		margin-top: 4px;
		padding-top: 8px !important;
		border-top: 1px solid #f2f2f2 !important;
	}
	.wcdv-items .wcdv-col-price[data-label]::before,
	.wcdv-items .wcdv-col-qty::before {
		content: attr(data-label);
		margin-right: 6px;
		font-size: .72em;
		font-weight: 600;
		letter-spacing: .03em;
		text-transform: uppercase;
		color: #999;
	}
	.wcdv-items .wcdv-col-price {
		min-width: auto;
	}
	.wcdv-items .wcdv-remove {
		position: absolute;
		top: 8px;
		right: 8px;
	}
	.wcdv-thumb {
		width: 52px !important;
		height: 52px !important;
		max-width: 52px !important;
	}
}
