/* ZihWeb Classifieds: listado, ficha, formulario y paginador de ext/classifieds.php (prefijo .zcl-)
   El tablón del pueblo: cada anuncio es un aviso pegado, con la tira de contacto perforada abajo
   (las tiras que se arrancan de un volante). Es el único adorno; lo demás hereda tipografía y colores
   de la plantilla. Mide en em (Bootstrap 3 fija html{font-size:10px}) y mezcla sobre currentColor,
   así que funciona en plantillas claras u oscuras. */

.zcl {
	--zcl-line: color-mix(in srgb, currentColor 18%, transparent);
	--zcl-soft: color-mix(in srgb, currentColor 4%, transparent);
	--zcl-muted: color-mix(in srgb, currentColor 68%, transparent);
	--zcl-accent: var(--accent-d, var(--accent-h, var(--accent, #0b6fd6)));
	--zcl-free: color-mix(in srgb, #1a7f37 78%, currentColor);
	--zcl-r: .55em;
	--zcl-notch: .55em;
}
.zcl *, .zcl *::before, .zcl *::after { box-sizing: border-box; }
.zcl :focus-visible { outline: 2px solid var(--zcl-accent); outline-offset: 2px; }
.zcl a { color: inherit; }
.zcl .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.zcl a:hover, .zcl a:focus { color: inherit; text-decoration: none; }
.zcl svg { flex: none; width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Tipo de trato: el color es información (Vendo, Rento, Busco…), no decoración */
.zcl [data-deal] { --deal: #6b7280; }
.zcl [data-deal="1"] { --deal: #2463b5; }  /* vendo */
.zcl [data-deal="2"] { --deal: #7a4fc0; }  /* compro */
.zcl [data-deal="3"] { --deal: #0d8279; }  /* rento */
.zcl [data-deal="4"] { --deal: #a0700a; }  /* cambio */
.zcl [data-deal="5"] { --deal: #c03a75; }  /* ofrezco */
.zcl [data-deal="6"] { --deal: #c27a12; }  /* busco */
.zcl [data-deal="18"] { --deal: #1a7f37; } /* gratis */
.zcl-deal {
	display: inline-flex; align-items: center; gap: .45em;
	margin: 0; font-size: .85em; line-height: 1.3; color: var(--zcl-muted);
}
.zcl-deal b { font-weight: 650; color: color-mix(in srgb, var(--deal) 80%, currentColor); }
.zcl-deal::before {
	content: ""; flex: none; width: .62em; height: .62em; border-radius: 50%;
	background: var(--deal);
}

/* ---------- Botones ---------- */
.zcl-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .45em;
	min-height: 2.75em; padding: .55em 1.1em;
	border: 1px solid var(--zcl-line); border-radius: var(--zcl-r);
	background: transparent; color: inherit;
	font: inherit; font-weight: 600; line-height: 1.2; text-align: center; cursor: pointer;
	transition: background-color .15s, border-color .15s;
}
.zcl a.zcl-btn:hover, .zcl .zcl-btn:hover { background: var(--zcl-soft); border-color: color-mix(in srgb, currentColor 35%, transparent); }
.zcl .zcl-btn--go, .zcl a.zcl-btn--go { border-color: transparent; background: var(--zcl-accent); color: #fff; }
.zcl .zcl-btn--go:hover, .zcl a.zcl-btn--go:hover { background: color-mix(in srgb, var(--zcl-accent) 85%, #000); color: #fff; }

/* ---------- Barra de acciones: publicar + atajos ---------- */
.zcl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6em 1.2em; margin: 0 0 1.4em; }
.zcl-quick { display: flex; flex-wrap: wrap; gap: .4em; margin: 0; padding: 0; list-style: none; }
.zcl-quick a {
	display: inline-flex; align-items: center; gap: .4em; min-height: 2.4em; padding: .35em .8em;
	border: 1px dashed var(--zcl-line); border-radius: 999px; font-size: .9em; line-height: 1.2;
}
.zcl-quick a:hover { border-style: solid; background: var(--zcl-soft); }
.zcl-quick a::before { content: ""; width: .55em; height: .55em; border-radius: 50%; background: var(--deal); }

/* ---------- Listado ---------- */
.zcl-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5em), 1fr));
	gap: 1.4em 1.1em;
	align-items: start; /* cada aviso a su altura: sin huecos junto a uno con foto */
	margin: 0 0 1.6em; padding: 0; list-style: none;
}
.zcl-list > .zcl-ad-slot { grid-column: 1 / -1; }

/* Aviso: cuerpo + tira. Las muescas (máscara) cortan borde y fondo, sin saber el color de la página. */
.zcl-card { display: flex; flex-direction: column; min-width: 0; margin: 0; }
.zcl-card-body {
	position: relative; flex: 1;
	display: flex; flex-direction: column; gap: .45em;
	padding: 1em 1.05em 1.1em;
	border: 1px solid var(--zcl-line); border-bottom: 0;
	border-radius: var(--zcl-r) var(--zcl-r) 0 0;
	background: var(--zcl-soft);
	-webkit-mask: radial-gradient(circle at 0 100%, #0000 var(--zcl-notch), #000 calc(var(--zcl-notch) + .5px)) left / 51% 100% no-repeat,
	              radial-gradient(circle at 100% 100%, #0000 var(--zcl-notch), #000 calc(var(--zcl-notch) + .5px)) right / 51% 100% no-repeat;
	        mask: radial-gradient(circle at 0 100%, #0000 var(--zcl-notch), #000 calc(var(--zcl-notch) + .5px)) left / 51% 100% no-repeat,
	              radial-gradient(circle at 100% 100%, #0000 var(--zcl-notch), #000 calc(var(--zcl-notch) + .5px)) right / 51% 100% no-repeat;
}
.zcl-card:has(.zcl-cover) .zcl-card-body { padding-top: 0; }
.zcl-cover {
	position: relative; display: block;
	margin: 0 -1.05em .35em; aspect-ratio: 4 / 3; overflow: hidden;
	border-radius: var(--zcl-r) var(--zcl-r) 0 0; background: var(--zcl-line);
}
.zcl-cover img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.zcl-cover-n {
	position: absolute; right: .5em; bottom: .5em; display: inline-flex; align-items: center; gap: .3em;
	padding: .15em .5em; border-radius: .35em;
	background: rgba(0, 0, 0, .68); color: #fff; font-size: .8em; line-height: 1.4;
}
.zcl-cover-n svg { width: 1em; height: 1em; }

.zcl-price {
	margin: 0; font-size: 1.65em; font-weight: 800; line-height: 1.05; letter-spacing: -.01em;
	font-variant-numeric: tabular-nums lining-nums;
}
.zcl-price small { margin-left: .2em; font-size: .5em; font-weight: 650; letter-spacing: .02em; color: var(--zcl-muted); }
.zcl-price .zcl-per { display: block; margin: .25em 0 0; font-size: .45em; font-weight: 500; letter-spacing: 0; }
.zcl-price--free { color: var(--zcl-free); }

.zcl-title { max-width: none; font-stretch: normal; text-wrap: pretty; margin: .1em 0 0; font-size: 1.15em; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.zcl-title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* todo el aviso abre la ficha */
.zcl-card-body:hover .zcl-title a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
.zcl-title .zw-short { position: relative; z-index: 1; margin-left: .25em; font-size: .8em; vertical-align: .05em; }
.zcl-desc {
	margin: 0; font-size: .92em; line-height: 1.5; color: var(--zcl-muted); overflow-wrap: anywhere;
	display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.zcl-meta { display: flex; flex-wrap: wrap; gap: .25em 1em; margin: auto 0 0; padding-top: .35em; font-size: .82em; color: var(--zcl-muted); }
.zcl-meta span { display: inline-flex; align-items: center; gap: .3em; }
.zcl-meta svg { width: 1.05em; height: 1.05em; }

/* Tira perforada: cada contacto es una tira que se arranca */
.zcl-tear {
	display: grid; grid-auto-columns: 1fr; grid-auto-flow: column;
	border: 1px solid var(--zcl-line); border-top: 2px dashed var(--zcl-line);
	border-radius: 0 0 var(--zcl-r) var(--zcl-r);
	-webkit-mask: radial-gradient(circle at 0 0, #0000 var(--zcl-notch), #000 calc(var(--zcl-notch) + .5px)) left / 51% 100% no-repeat,
	              radial-gradient(circle at 100% 0, #0000 var(--zcl-notch), #000 calc(var(--zcl-notch) + .5px)) right / 51% 100% no-repeat;
	        mask: radial-gradient(circle at 0 0, #0000 var(--zcl-notch), #000 calc(var(--zcl-notch) + .5px)) left / 51% 100% no-repeat,
	              radial-gradient(circle at 100% 0, #0000 var(--zcl-notch), #000 calc(var(--zcl-notch) + .5px)) right / 51% 100% no-repeat;
}
.zcl-tear > * {
	display: flex; align-items: center; justify-content: center; gap: .45em;
	min-width: 0; min-height: 2.9em; padding: .5em .7em;
	font-size: .9em; font-weight: 600; line-height: 1.2; white-space: nowrap;
	transition: background-color .15s;
}
.zcl-tear > * + * { border-left: 1px dashed var(--zcl-line); }
.zcl-tear > a:hover { background: var(--zcl-soft); }
.zcl-tear > a:focus-visible { outline-offset: -3px; } /* la máscara de las muescas recorta lo que sale de la tira */
.zcl-tear span.zcl-tear-num { overflow: hidden; text-overflow: ellipsis; }
.zcl-tear .zcl-wa svg { color: #1a9e4b; }
.zcl-tear .zcl-tg svg { color: #229ed9; }
.zcl-tear .zcl-tel svg { color: var(--zcl-accent); }
@media (prefers-reduced-motion: no-preference) {
	.zcl-tear > a:active { transform: translateY(1px); }
}

/* Admin bajo cada aviso */
.zcl-admin { display: flex; flex-wrap: wrap; align-items: center; gap: .3em .9em; padding: .45em .2em 0; font-size: .78em; color: var(--zcl-muted); }
.zcl-admin a { display: inline-flex; align-items: center; gap: .3em; font-weight: 600; color: var(--zcl-accent); }
.zcl-admin form { display: inline; margin: 0; }
.zcl-admin .zcl-del { display: inline-flex; align-items: center; gap: .3em; padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: #c0392b; cursor: pointer; }

/* Vacío */
.zcl-empty {
	display: grid; justify-items: start; gap: .8em; margin: 0 0 1.6em; padding: 1.6em 1.4em;
	border: 2px dashed var(--zcl-line); border-radius: var(--zcl-r);
}
.zcl-empty p { margin: 0; font-size: 1.15em; max-width: 34em; }

/* ---------- Paginador ---------- */
.zcl-pager { display: flex; flex-wrap: wrap; align-items: center; gap: .35em; margin: 0 0 1.6em; }
.zcl-pager a, .zcl-pager span[aria-current], .zcl-pager .zcl-gap {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 2.6em; min-height: 2.6em; padding: 0 .6em; border-radius: var(--zcl-r);
	font-variant-numeric: tabular-nums;
}
.zcl-pager a { border: 1px solid var(--zcl-line); }
.zcl-pager a:hover { background: var(--zcl-soft); }
.zcl-pager span[aria-current] { background: var(--zcl-accent); color: #fff; font-weight: 700; }
.zcl-pager .zcl-gap { min-width: 1.4em; padding: 0; color: var(--zcl-muted); }
.zcl-pager .zcl-total { margin-left: auto; font-size: .85em; color: var(--zcl-muted); }

/* ---------- Ficha ---------- */
.zcl-crumbs { display: flex; flex-wrap: wrap; gap: .3em .5em; margin: 0 0 .9em; padding: 0; list-style: none; font-size: .9em; color: var(--zcl-muted); }
.zcl-crumbs li + li::before { content: "/"; margin-right: .5em; opacity: .5; }
.zcl-crumbs a { color: var(--zcl-accent); font-weight: 600; }
.zcl-view h1 { margin: 0 0 .35em; font-size: 2em; line-height: 1.15; overflow-wrap: anywhere; }
.zcl-view h1 .zw-short { font-size: .55em; vertical-align: .2em; }
.zcl-view .zcl-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .6em 1.5em; margin: 0 0 1.4em; }
.zcl-view .zcl-price { font-size: 2.3em; }
.zcl-edit { display: inline-flex; align-items: center; gap: .35em; font-size: .9em; font-weight: 600; color: var(--zcl-accent); }
.zcl a.zcl-edit { color: var(--zcl-accent); }
.zcl-body { max-width: 40em; margin: 0 0 1.6em; font-size: 1.05em; line-height: 1.65; overflow-wrap: anywhere; }
.zcl-body img { max-width: 100%; height: auto; border-radius: var(--zcl-r); }
.zcl-body > :first-child { margin-top: 0; }
.zcl-fotos { margin: 0 0 1.8em; }
.zcl-fotos h2, .zcl-contact h2 { margin: 0 0 .7em; font-size: 1.15em; font-weight: 650; }

/* Contacto de la ficha: el mismo aviso con su tira, más grande */
.zcl-contact { max-width: 34em; margin: 0 0 1.8em; }
.zcl-contact .zcl-card-body { gap: .55em; padding: 1.2em 1.3em 1.3em; }
.zcl-contact dl { display: grid; grid-template-columns: auto 1fr; gap: .45em 1em; margin: 0; }
.zcl-contact dt { font-weight: 500; color: var(--zcl-muted); }
.zcl-contact dd { margin: 0; overflow-wrap: anywhere; }
.zcl-contact dd a { color: var(--zcl-accent); }
.zcl-contact .zcl-tear > * { min-height: 3.2em; font-size: 1em; }
.zcl-dates { display: flex; flex-wrap: wrap; gap: .2em 1.2em; margin: 0 0 1.6em; font-size: .85em; color: var(--zcl-muted); }
.zcl-share { display: flex; flex-wrap: wrap; align-items: center; gap: 1.2em; margin: 0 0 1.6em; }
.zcl-share #qrcode img { display: block; border-radius: .3em; }

/* ---------- Formulario ---------- */
.zcl-form { max-width: 44em; }
.zcl-form h1 { margin: 0 0 .6em; }
.zcl-form fieldset { min-width: 0; margin: 0 0 1.6em; padding: 0; border: 0; }
.zcl-form legend {
	display: block; width: 100%; margin: 0 0 .8em; padding: 0 0 .45em;
	border-bottom: 1px dashed var(--zcl-line);
	font-size: 1.2em; font-weight: 650; line-height: 1.3; color: inherit;
}
.zcl-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12em), 1fr)); gap: .9em 1em; margin: 0 0 .9em; }
.zcl-row--price { grid-template-columns: minmax(7em, 1.2fr) minmax(6em, .8fr) minmax(9em, 1.2fr); }
.zcl-field { display: grid; align-content: start; gap: .35em; min-width: 0; margin: 0 0 .9em; }
.zcl-row .zcl-field { margin: 0; }
.zcl-field > label, .zcl-field > .zcl-label { margin: 0; font-weight: 600; font-size: .95em; }
.zcl-field > label i { font-style: normal; font-weight: 400; color: var(--zcl-muted); }
.zcl-form fieldset > .zcl-hint { margin-bottom: 1em; }
.zcl-hint { margin: 0; font-size: .85em; line-height: 1.45; color: var(--zcl-muted); }
.zcl-form input[type=text], .zcl-form input[type=tel], .zcl-form input[type=email],
.zcl-form input[type=date], .zcl-form input[type=time], .zcl-form input[inputmode], .zcl-form select, .zcl-form textarea {
	display: block; width: 100%; max-width: none; height: auto; min-height: 2.75em; margin: 0; padding: .55em .75em;
	border: 1px solid color-mix(in srgb, currentColor 30%, transparent); border-radius: var(--zcl-r);
	background: transparent; color: inherit; font: inherit; line-height: 1.35; box-shadow: none;
}
.zcl-form select option { color: initial; }
.zcl-form textarea { min-height: 12em; resize: vertical; }
.zcl-form input:focus, .zcl-form select:focus, .zcl-form textarea:focus {
	outline: none; border-color: var(--zcl-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--zcl-accent) 22%, transparent);
}
.zcl-form .zcl-title-in { font-size: 1.15em; }
.zcl-fixed { display: flex; align-items: center; gap: .6em; margin: 0 0 .9em; font-size: 1.1em; font-weight: 650; }
.zcl-fixed.zcl-deal { font-size: 1.05em; }
.zcl-submit { display: flex; flex-wrap: wrap; align-items: center; gap: 1em; margin: 1.2em 0 0; }
.zcl-submit .zcl-btn--go { min-width: 12em; font-size: 1.05em; }
.zcl-note { display: grid; gap: .3em; margin: 0 0 1.4em; padding: .9em 1.1em; border-left: 4px solid var(--zcl-tone, #c0392b); border-radius: 0 var(--zcl-r) var(--zcl-r) 0; background: var(--zcl-soft); }
.zcl-note--warn { --zcl-tone: #c27a12; }
.zcl-note--ok { --zcl-tone: #1a7f37; }
.zcl-note p, .zcl-note ul { margin: 0; }
.zcl-done h1 { margin: 0 0 .4em; }

/* Fotos: rejilla .zwg compartida (lib/g.css) */
.zcl-form .zwg { margin-top: .6em; }
.zcl-form input[type=file] { max-width: 100%; padding: .6em; border: 1px dashed var(--zcl-line); border-radius: var(--zcl-r); width: 100%; }

@media (max-width: 30em) {
	.zcl-row--price { grid-template-columns: 1fr 1fr; }
	.zcl-row--price > :first-child { grid-column: 1 / -1; }
	.zcl-view h1 { font-size: 1.6em; }
	.zcl-view .zcl-price { font-size: 1.9em; }
	.zcl-pager .zcl-total { flex-basis: 100%; margin-left: 0; }
}

/* Panel de categorías (admin) */
.zcl-adm { margin: 2em 0 0; padding: 1.2em 0 0; border-top: 1px dashed var(--zcl-line); }
.zcl-adm form { display: flex; flex-wrap: wrap; align-items: end; gap: .6em; margin: 0 0 1em; }
.zcl-adm form > * { width: auto; flex: 1 1 10em; }
.zcl-adm form .zcl-field { margin: 0; }
.zcl-adm fieldset { min-width: 0; margin: 0 0 1.4em; padding: 0; border: 0; }
.zcl-adm .zcl-btn { flex: none; }

/* Aviso legal al pie */
.zcl-disclaim { margin: 0 0 1.6em; font-size: .82em; line-height: 1.5; color: var(--zcl-muted); }
