/* =====================================================================
   Tracteur Orange — Restauration
   Les pages Restauration utilisent les feuilles de style du thème
   (annonces.css, deposer-annonce.css, base.css, components.css) et les
   mêmes classes que les pages Annonces. Ce fichier ne contient que les
   compléments propres aux pièces, avec les variables du thème (tokens.css).
   ===================================================================== */

/* Photos entières (1.4.0) : le thème recadre (object-fit: cover) ; ici toute la pièce
   reste visible, sur fond blanc (1.4.5). Les cadres sans photo gardent le fond du thème. */
.tor-body-restauration .listing-card .listing-img:has(.listing-img-photo) { background: #fff; border-bottom: 1px solid rgba(0, 0, 0, .08); }
.tor-body-restauration .listing-card .listing-img-photo { object-fit: contain; }
.tor-body-restauration .listing-card.featured .listing-img { min-height: 260px; }
.tor-piece-single .annonce-gallery .gallery-main { background: #fff; border: 1px solid rgba(0, 0, 0, .08); box-sizing: border-box; }
.tor-piece-single .annonce-gallery-slide img,
.tor-piece-single .gallery-thumb img { object-fit: contain; }
.tor-piece-single .annonce-gallery .gallery-thumb { background: #fff; border-color: rgba(0, 0, 0, .1); }
.tor-piece-single .annonce-gallery .gallery-thumb.active { border-color: var(--orange, #e4610f); }

/* Clic sur la photo : agrandissement plein écran. */
.tor-piece-single a.tor-zoom { position: relative; display: block; width: 100%; height: 100%; cursor: zoom-in; }
.tor-piece-single .tor-zoom-hint {
	position: absolute; top: 14px; right: 14px;
	width: 36px; height: 36px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	background: rgba(10, 10, 8, .6); color: #fff; pointer-events: none;
	transition: background .2s;
}
.tor-piece-single .tor-zoom-hint svg { width: 18px; height: 18px; }
.tor-piece-single a.tor-zoom:hover .tor-zoom-hint { background: var(--orange, #e4610f); }
html.tor-lightbox-open, html.tor-lightbox-open body { overflow: hidden; }
.tor-lightbox {
	position: fixed; inset: 0; z-index: 100000;
	display: flex; align-items: center; justify-content: center;
	padding: 56px 64px; box-sizing: border-box;
	background: #fff; cursor: zoom-out;
}
.tor-lightbox[hidden] { display: none; }
.tor-lightbox-img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: default; }
.tor-lightbox button {
	position: absolute; border: 0; cursor: pointer; color: #fff;
	width: 44px; height: 44px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	background: rgba(10, 10, 8, .7); transition: background .2s;
}
.tor-lightbox button:hover, .tor-lightbox button:focus-visible { background: var(--orange, #e4610f); outline: none; }
.tor-lightbox button svg { width: 20px; height: 20px; }
.tor-lightbox-close { top: 12px; right: 12px; }
.tor-lightbox-nav { top: 50%; transform: translateY(-50%); }
.tor-lightbox-nav.prev { left: 12px; }
.tor-lightbox-nav.next { right: 12px; }
.tor-lightbox-count { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; color: rgba(10, 10, 8, .7); font-size: 14px; }
@media (max-width: 640px) {
	.tor-lightbox { padding: 56px 8px; }
	.tor-lightbox-nav { top: auto; bottom: 6px; transform: none; }
}

/* « Acheter la pièce » (1.5.0) : encadré prix de la fiche. */
.tor-piece-single .tor-buy-form { margin: 0; }
.tor-piece-single .tor-buy-qty { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 10px; font-weight: 600; }
.tor-piece-single .tor-buy-qty .form-input { width: 90px; text-align: center; }
.tor-piece-single button.tor-btn-buy { width: 100%; border: 0; cursor: pointer; font: inherit; }
.tor-piece-single .tor-achat-erreur { margin: 12px 0; padding: 10px 12px; border-radius: 4px; background: var(--rouge-badge, #b32d2e); color: var(--blanc, #fff); font-size: .9em; }

/* Panier : pièces de restauration payées par virement au concessionnaire (1.5.0). */
.tor-cart-explain { margin: 0 0 20px; padding: 16px 18px; border: 1px solid var(--orange, #e4610f); border-left-width: 4px; border-radius: 6px; background: #fff8f2; font-size: 14px; line-height: 1.5; }
.tor-cart-explain-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.tor-cart-explain ol { margin: 0; padding-left: 20px; }
.tor-cart-explain li + li { margin-top: 6px; }
.tor-cart-explain--checkout { margin-bottom: 24px; }
.tor-cart-explain a { color: var(--orange, #e4610f); font-weight: 600; }
.tor-cart-pieces { max-width: 1200px; margin: 0 auto 48px; padding: 0 24px; box-sizing: border-box; scroll-margin-top: calc(var(--nav-h, 80px) + 16px); }
.tor-cart-only .tor-cart-pieces { padding: 0; margin-bottom: 24px; }
.tor-cart-pieces-title { font-size: 24px; margin: 24px 0 8px; }
.tor-cart-pieces-title span { font-size: .6em; font-weight: 500; color: var(--gris-mid, #6b6b66); }
.tor-cart-hint { font-size: 13px; color: var(--gris-mid, #6b6b66); margin: 8px 0 16px; }
.tor-cart-hint a { color: var(--orange, #e4610f); }
.tor-cart-ok, .tor-cart-err { margin: 12px 0; padding: 10px 14px; border-radius: 4px; color: #fff; font-size: 14px; }
.tor-cart-ok { background: var(--vert-badge, #1f7a3d); }
.tor-cart-err { background: var(--rouge-badge, #b32d2e); }
.tor-cart-group { margin-bottom: 18px; border: 1px solid rgba(0, 0, 0, .1); border-radius: 6px; overflow: hidden; background: #fff; }
.tor-cart-group-title { padding: 10px 14px; font-weight: 700; background: rgba(0, 0, 0, .04); }
.tor-cart-table { width: 100%; border-collapse: collapse; }
.tor-cart-table td { padding: 12px 14px; border-top: 1px solid rgba(0, 0, 0, .06); vertical-align: middle; }
.tor-cart-table tbody tr:first-child td { border-top: 0; }
.tor-cart-thumb { width: 72px; }
.tor-cart-thumb img { width: 64px; height: 64px; object-fit: contain; background: #fff; border: 1px solid rgba(0, 0, 0, .08); border-radius: 4px; display: block; }
.tor-cart-name a { font-weight: 600; color: inherit; }
.tor-cart-unit { display: block; font-size: 13px; color: var(--gris-mid, #6b6b66); margin-top: 2px; }
.tor-cart-name a.tor-cart-remove { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 500; color: var(--rouge-badge, #b32d2e); }
.tor-cart-qty input { width: 70px; padding: 6px 8px; text-align: center; }
.tor-cart-total { text-align: right; font-weight: 600; white-space: nowrap; }
.tor-cart-table tfoot td { text-align: right; background: rgba(0, 0, 0, .02); }
.tor-cart-buyer { margin-top: 20px; padding: 18px; border: 1px solid rgba(0, 0, 0, .1); border-radius: 6px; background: #fff; }
.tor-cart-buyer-title { font-weight: 700; margin-bottom: 12px; }
.tor-cart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 16px; }
.tor-cart-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.tor-cart-grid label.full { grid-column: 1 / -1; }
.tor-cart-grid input, .tor-cart-grid textarea { padding: 9px 10px; font: inherit; font-weight: 400; border: 1px solid rgba(0, 0, 0, .18); border-radius: 4px; }
.tor-cart-grid .optional { font-weight: 400; color: var(--gris-mid, #6b6b66); }
.tor-cart-grid label.tor-cart-consent { display: block; font-weight: 400; line-height: 1.45; }
.tor-cart-grid label.tor-cart-consent input { margin: 0 6px 0 0; padding: 0; vertical-align: -2px; }
.tor-cart-grid label.tor-cart-consent a { color: var(--orange, #e4610f); }
.tor-virement-card { margin-bottom: 16px; border: 1px solid rgba(0, 0, 0, .1); border-radius: 6px; background: #fff; padding: 14px 16px; }
.tor-virement-head { font-weight: 700; margin-bottom: 6px; }
.tor-virement-pieces { margin: 0 0 10px; padding-left: 18px; font-size: 14px; }
.tor-virement { width: 100%; border-collapse: collapse; }
.tor-virement th, .tor-virement td { padding: 7px 8px; border-top: 1px solid rgba(0, 0, 0, .06); text-align: left; font-size: 14px; }
.tor-virement th { width: 170px; font-weight: 500; color: var(--gris-mid, #6b6b66); }
.tor-virement code { font-size: 1.05em; letter-spacing: .03em; user-select: all; }
.tor-cart-shop-link { font-size: 14px; }
.tor-cart-shop-link a { color: var(--orange, #e4610f); font-weight: 600; }
@media (max-width: 640px) {
	.tor-cart-pieces { padding: 0 16px; }
	.tor-cart-grid { grid-template-columns: 1fr; }
	.tor-cart-table td { padding: 10px 8px; }
	.tor-cart-thumb { width: 56px; }
	.tor-cart-thumb img { width: 48px; height: 48px; }
	.tor-virement th { width: 110px; }
}

/* Cartes : titre cliquable, pièce vendue grisée. */
.listing-card .listing-model a { color: inherit; }
.listing-card .listing-model a:hover { color: var(--orange); }
.listing-card.is-vendue .listing-img-photo { filter: grayscale(1); opacity: .7; }

/* Stock (1.3.0) : cartes, fiche, Mes pièces. */
.listing-card .tor-card-stock { color: var(--vert-badge, #1f7a3d); font-weight: 600; }
.listing-card .tor-card-stock.is-zero { color: var(--rouge-badge, #b32d2e); }
.tor-piece-single .listing-tag.tor-tag-stock { background: var(--vert-badge); border-color: var(--vert-badge); color: var(--blanc); }
.tor-piece-single .tor-stock-line { font-weight: 600; color: var(--vert-badge, #1f7a3d); }
.tor-piece-single .tor-stock-line--zero { color: var(--rouge-badge, #b32d2e); }
.tor-account .tor-stock-form { display: flex; align-items: center; gap: 6px; margin: 0; }
.tor-account .tor-stock-form input[type="number"] { width: 72px; padding: 4px 6px; }
.tor-account .tor-stock-zero { color: var(--rouge-badge, #b32d2e); font-weight: 600; }
.tor-account .tor-stock-sold { display: block; margin-top: 4px; }

.tor-piece-single a.btn-phone { text-decoration: none; }

/* Paiement direct au vendeur par virement (1.4.0). */
.tor-piece-single .tor-livraison-line { font-weight: 600; color: var(--vert-badge, #1f7a3d); }
.tor-piece-single .tor-ttc-line { font-weight: 500; }
.tor-piece-single .tor-buy-note { margin: 8px 0 12px; font-size: .85em; text-align: center; }
.tor-piece-single .price-card .tor-buy-note { color: rgba(255, 255, 255, .78); }
.tor-piece-single .tor-owner-hint { margin: 12px 0; padding: 10px 12px; border-radius: 4px; background: #fff3cd; color: #4a3b00; font-size: .85em; line-height: 1.45; text-align: left; }
.tor-piece-single .tor-owner-hint a { display: inline-block; margin-top: 4px; color: #8a4b00; font-weight: 700; text-decoration: underline; }
.tor-piece-single .tor-buy-note a { color: var(--orange, #e4610f); }
.tor-achat { scroll-margin-top: calc(var(--nav-h) + 24px); margin-bottom: 32px; }
.tor-achat .tor-virement code { font-size: 1.05em; letter-spacing: .03em; user-select: all; }
.tor-account .tor-bank-missing { margin-bottom: 20px; border-color: var(--orange, #e4610f); }
.tor-account .tor-bank-form { max-width: 460px; }
.tor-account .tor-bank-form .form-group { display: flex; flex-direction: column; gap: 4px; }
.tor-account .tor-bank-form .form-input { width: 100%; padding: 8px 10px; }

/* Filtres : espace avant le bouton (le dernier bloc est un champ, pas des cases). */
.tor-restauration-archive .annonces-filters .filter-block:last-of-type { margin-bottom: 18px; }

/* Tri : le menu reste aligné comme sur Annonces. */
.tor-restauration-archive .results-controls form { display: flex; align-items: center; gap: 10px; margin: 0; }

/* Fiche : modèles compatibles cliquables (même rendu que la liste d'équipements). */
.tor-piece-single a.equip-item { color: inherit; text-decoration: none; transition: color .2s; }
.tor-piece-single a.equip-item:hover { color: var(--orange); }
.tor-piece-single .listing-tag.tor-tag-origine { background: var(--vert-badge); border-color: var(--vert-badge); color: var(--blanc); }
.tor-piece-single .listing-tag.tor-tag-adaptable { background: var(--orange); border-color: var(--orange); color: var(--blanc); }
.tor-piece-single .safety-list a { color: var(--orange); }
.tor-piece-single .safety-list a:hover { text-decoration: underline; }
.tor-contact { scroll-margin-top: calc(var(--nav-h) + 24px); }
.tor-contact .success-banner { margin-bottom: 20px; }

/* Formulaire : liste des modèles compatibles (peut être longue). */
.tor-vendre-main .tor-modeles-grid {
	grid-template-columns: repeat(3, 1fr);
	max-height: 320px;
	overflow-y: auto;
	padding: 6px;
	border: 1px solid rgba(0, 0, 0, .08);
	border-radius: var(--radius-sm);
}
@media (max-width: 782px) {
	.tor-vendre-main .tor-modeles-grid { grid-template-columns: 1fr 1fr; }
}
.tor-vendre-main .preview-img { overflow: hidden; }
.tor-vendre-main .form-hint strong { color: var(--noir); }

/* Vente réservée aux pros vérifiés (TOR_Account::gate_html()) : « Vendre une pièce » et Mes pièces. */
.tor-gate { border: 1px solid var(--gris-light, #C8C8C4); border-radius: 6px; padding: 24px 28px; background: var(--blanc, #fff); }
.tor-gate h2 { margin: 0 0 12px; }
.tor-gate p { margin: 0 0 12px; }
.tor-gate p:last-child { margin: 16px 0 0; }

/* Mon compte › Mes pièces : la pastille de type garde ses couleurs dans le tableau. */
.tor-account .badge { white-space: nowrap; }

/* Liste : photo d'atelier en fond de l'en-tête, aux mêmes dimensions que l'en-tête de la page
   Histoire du thème (page-histoire.css) : pleine largeur au ratio 2400/893, texte en bas,
   560 px minimum sur téléphone. Voile sombre en bas pour garder le texte lisible. */
.tor-restauration-archive .annonce-archive-header.tor-header-photo {
	min-height: calc(100vw * 893 / 2400);
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	box-sizing: border-box;
}
.tor-restauration-archive .tor-header-photo > * { width: 100%; box-sizing: border-box; }
.tor-restauration-archive .tor-header-photo > :not(.page-header-bg) { position: relative; z-index: 1; }
.tor-restauration-archive .tor-header-photo .page-header-bg {
	z-index: 0;
	opacity: 1;
	pointer-events: none;
	background:
		linear-gradient(to top, rgba(10, 10, 8, .94) 0%, rgba(10, 10, 8, .55) 45%, rgba(10, 10, 8, .2) 100%),
		var(--tor-header-img) center / cover no-repeat,
		#0a0a08;
}
@media (max-width: 640px) {
	.tor-restauration-archive .annonce-archive-header.tor-header-photo { min-height: 560px; }
	.tor-restauration-archive .tor-header-photo .page-header-bg {
		background:
			linear-gradient(to top, rgba(10, 10, 8, .94) 0%, rgba(10, 10, 8, .55) 45%, rgba(10, 10, 8, .2) 100%),
			var(--tor-header-img-sm, var(--tor-header-img)) 60% center / cover no-repeat,
			#0a0a08;
	}
}
