/* TSC Buscador Instantaneo v1.2.0 */

:root { --tscb-main: #c8102e; --tscb-accent: #f2b705; }

/* ── Bola flotante (posicion y tamaño se inyectan desde ajustes) ── */
#tscb-fab {
	position: fixed;
	left: 20px; bottom: 24px;
	z-index: 99990;
	width: 48px; height: 48px;
	border: none; border-radius: 50%;
	background: var(--tscb-main); /* el degradado con opacidad se inyecta desde ajustes */
	color: #fff;
	display: flex; align-items: center; justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0,0,0,.28), 0 2px 4px rgba(0,0,0,.14);
	transition: transform .18s ease, box-shadow .18s ease, left .25s ease, right .25s ease;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}
#tscb-fab:hover { transform: scale(1.08); }
#tscb-fab:active { transform: scale(.96); }
#tscb-fab.tscb-hidden { left: -38px; opacity: .55; }
#tscb-fab.tscb-hidden:hover { left: -30px; opacity: .9; }

#tscb-fab-hide {
	position: fixed;
	left: 56px; bottom: 60px;
	z-index: 99991;
	width: 22px; height: 22px;
	border: none; border-radius: 50%;
	background: #2b2b2b; color: #fff; /* se sobreescribe desde ajustes */
	display: flex; align-items: center; justify-content: center;
	padding: 0; cursor: pointer;
	opacity: 0; pointer-events: none;
	transition: opacity .18s ease, left .25s ease, right .25s ease;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}
#tscb-fab-hide span { font-size: 14px; line-height: 1; display: block; transform: translateY(-.5px); }
#tscb-fab:hover ~ #tscb-fab-hide, #tscb-fab-hide:hover, #tscb-fab.tscb-hidden ~ #tscb-fab-hide { opacity: .85; pointer-events: auto; }
#tscb-fab.tscb-hidden ~ #tscb-fab-hide { left: 6px; }

/* ── Barra incrustada [tsc_buscador] ── */
.tscb-inline {
	display: flex; align-items: center; gap: 10px;
	width: 100%; max-width: 560px;
	margin: 0 auto;
	padding: 13px 18px;
	border: 1.5px solid #e4e4e4; border-radius: 12px;
	background: #fff; color: #9a9a9a;
	font-size: 15px; text-align: left;
	cursor: pointer;
	transition: border-color .15s ease, box-shadow .15s ease;
	touch-action: manipulation;
}
.tscb-inline svg { color: var(--tscb-main); flex: none; }
.tscb-inline:hover { border-color: var(--tscb-main); box-shadow: 0 2px 12px rgba(0,0,0,.06); }

/* ── Overlay ── */
#tscb-overlay[hidden] { display: none !important; }
#tscb-overlay {
	position: fixed; inset: 0;
	z-index: 99999;
	background: rgba(12,12,16,.58);
	backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
	display: flex; align-items: flex-start; justify-content: center;
	padding: 9vh 16px 16px;
	opacity: 0; transition: opacity .16s ease;
}
#tscb-overlay.tscb-open { opacity: 1; }

#tscb-box {
	width: 100%; max-width: 640px;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 24px 64px rgba(0,0,0,.35);
	overflow: hidden;
	transform: translateY(-12px) scale(.98);
	transition: transform .16s ease;
}
#tscb-overlay.tscb-open #tscb-box { transform: translateY(0) scale(1); }

#tscb-inputwrap {
	display: flex; align-items: center; gap: 12px;
	padding: 15px 18px;
	border-bottom: 1px solid #ececec;
	color: var(--tscb-main);
}
#tscb-input { flex: 1; border: none; outline: none; font-size: 17px; color: #1c1c1c; background: transparent; min-width: 0; }
#tscb-input::placeholder { color: #9a9a9a; }
#tscb-input::-webkit-search-cancel-button { display: none; }
#tscb-count { flex: none; font-size: 12px; color: #a0a0a0; white-space: nowrap; }

#tscb-close {
	border: none; background: #f2f2f2; color: #555;
	width: 30px; height: 30px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	padding: 0; cursor: pointer; flex: none;
	transition: background .15s ease;
	touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
#tscb-close span { font-size: 19px; line-height: 1; display: block; transform: translateY(-1px); }
#tscb-close:hover { background: #e4e4e4; }

/* ── Resultados ── */
#tscb-results { max-height: 56vh; overflow-y: auto; overscroll-behavior: contain; }
.tscb-item {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: 13px 18px;
	text-decoration: none;
	border-bottom: 1px solid #f4f4f4;
	transition: background .12s ease;
}
.tscb-item:hover, .tscb-item.tscb-active { background: color-mix(in srgb, var(--tscb-main) 6%, #fff); }
@supports not (background: color-mix(in srgb, red 50%, black)) {
	.tscb-item:hover, .tscb-item.tscb-active { background: #fdf1f3; }
}
.tscb-title { color: #1c1c1c; font-size: 15px; line-height: 1.35; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tscb-title mark { background: none; color: var(--tscb-main); font-weight: 700; }
.tscb-cat {
	flex: none; font-size: 11px; font-weight: 600;
	color: var(--tscb-main); background: color-mix(in srgb, var(--tscb-main) 10%, #fff);
	padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.tscb-new {
	flex: none; font-size: 10px; font-weight: 800; letter-spacing: .03em;
	color: #3a2c00; background: var(--tscb-accent);
	padding: 2px 7px; border-radius: 999px; text-transform: uppercase;
}
.tscb-group {
	padding: 12px 18px 5px;
	font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
	color: #b0b0b0; background: #fbfbfb;
	border-bottom: 1px solid #f4f4f4;
}
.tscb-empty, .tscb-hint { padding: 22px 18px; text-align: center; color: #8a8a8a; font-size: 14px; line-height: 2; }
.tscb-suggest {
	border: none; background: none; padding: 0 2px;
	color: var(--tscb-main); font-size: 14px; font-weight: 700;
	text-decoration: underline; cursor: pointer;
	touch-action: manipulation;
}
.tscb-suggest:hover { opacity: .8; }

#tscb-more {
	display: block; width: 100%;
	border: none; background: #faf5f6; color: var(--tscb-main);
	font-size: 13.5px; font-weight: 600;
	padding: 12px; cursor: pointer;
	transition: background .15s ease;
	touch-action: manipulation;
}
#tscb-more:hover { background: #f5e8ea; }

/* Recientes / populares */
.tscb-label {
	display: flex; align-items: center; justify-content: space-between;
	padding: 14px 18px 6px;
	font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #b0b0b0;
}
.tscb-clear {
	border: none; background: none; color: #b0b0b0;
	font-size: 11px; cursor: pointer; padding: 2px 4px;
	text-decoration: underline; text-transform: none; letter-spacing: 0; font-weight: 500;
}
.tscb-clear:hover { color: var(--tscb-main); }
.tscb-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 18px 14px; }
.tscb-chip {
	border: 1px solid #eddade; background: #fdf8f9; color: var(--tscb-main);
	font-size: 13px; padding: 6px 12px; border-radius: 999px;
	cursor: pointer; transition: background .12s ease;
	touch-action: manipulation;
}
.tscb-chip:hover { background: #fbe6ea; }

/* ── Pie: atajos + selector de tema ── */
#tscb-footer {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	padding: 8px 18px;
	font-size: 11.5px; color: #a0a0a0;
	border-top: 1px solid #f0f0f0;
	background: #fafafa;
}
#tscb-theme {
	border: 1px solid #e6e6e6; background: #fff; color: #777;
	font-size: 11.5px; padding: 4px 10px; border-radius: 999px;
	cursor: pointer; white-space: nowrap;
	transition: background .12s ease;
	touch-action: manipulation;
}
#tscb-theme:hover { background: #f2f2f2; }

/* ── Móvil ── */
@media (max-width: 640px) {
	#tscb-overlay { padding: 3vh 10px 10px; }
	#tscb-box { border-radius: 14px; }
	#tscb-input { font-size: 16px; }
	#tscb-results { max-height: 62vh; }
	#tscb-count, .tscb-keys { display: none; }
	#tscb-footer { justify-content: flex-end; }
	#tscb-fab-hide {
		opacity: .9; pointer-events: auto;
		backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
	}
}

/* ── TEMA OSCURO por clase (auto o eleccion del usuario, 24h) ── */
#tscb-overlay.tscb-dark #tscb-box { background: #1d1d22; box-shadow: 0 24px 64px rgba(0,0,0,.6); }
#tscb-overlay.tscb-dark #tscb-inputwrap { border-bottom-color: #2c2c33; }
#tscb-overlay.tscb-dark #tscb-input { color: #f0f0f0; }
#tscb-overlay.tscb-dark #tscb-input::placeholder { color: #7c7c85; }
#tscb-overlay.tscb-dark #tscb-close { background: #2c2c33; color: #cfcfd6; }
#tscb-overlay.tscb-dark #tscb-close:hover { background: #383841; }
#tscb-overlay.tscb-dark .tscb-item { border-bottom-color: #26262c; }
#tscb-overlay.tscb-dark .tscb-item:hover, #tscb-overlay.tscb-dark .tscb-item.tscb-active { background: #2a2026; }
#tscb-overlay.tscb-dark .tscb-title { color: #ececf1; }
#tscb-overlay.tscb-dark .tscb-title mark { color: #ff5f7a; }
#tscb-overlay.tscb-dark .tscb-cat { color: #ff8ba0; background: #3a222a; }
#tscb-overlay.tscb-dark .tscb-group { color: #6f6f78; background: #202024; border-bottom-color: #26262c; }
#tscb-overlay.tscb-dark .tscb-empty, #tscb-overlay.tscb-dark .tscb-hint { color: #8d8d96; }
#tscb-overlay.tscb-dark .tscb-suggest { color: #ff5f7a; }
#tscb-overlay.tscb-dark #tscb-more { background: #26222a; color: #ff8ba0; }
#tscb-overlay.tscb-dark #tscb-more:hover { background: #2f2830; }
#tscb-overlay.tscb-dark .tscb-chip { background: #26222a; border-color: #3a3038; color: #ff8ba0; }
#tscb-overlay.tscb-dark .tscb-chip:hover { background: #2f2830; }
#tscb-overlay.tscb-dark .tscb-label { color: #6f6f78; }
#tscb-overlay.tscb-dark .tscb-clear { color: #6f6f78; }
#tscb-overlay.tscb-dark #tscb-footer { background: #19191d; border-top-color: #26262c; color: #6f6f78; }
#tscb-overlay.tscb-dark #tscb-theme { background: #26262c; border-color: #33333b; color: #b9b9c2; }

@media (prefers-reduced-motion: reduce) {
	#tscb-fab, #tscb-overlay, #tscb-box { transition: none; }
}


/* ── Burbuja de invitacion ── */
#tscb-teaser[hidden] { display: none !important; }
#tscb-teaser {
	position: fixed;
	z-index: 99989;
	max-width: min(320px, calc(100vw - 120px));
	display: flex; align-items: center; gap: 10px;
	background: #fff; color: #2a2a2a;
	font-size: 13.5px; line-height: 1.4;
	padding: 11px 12px 11px 14px;
	border-radius: 14px;
	box-shadow: 0 8px 28px rgba(0,0,0,.22), 0 2px 6px rgba(0,0,0,.12);
	border: 1px solid rgba(0,0,0,.06);
	cursor: pointer;
	opacity: 0; transform: translateY(8px) scale(.97);
	transition: opacity .25s ease, transform .25s ease;
}
#tscb-teaser.tscb-teaser-in { opacity: 1; transform: translateY(0) scale(1); }
#tscb-teaser::after {
	content: '';
	position: absolute;
	width: 10px; height: 10px;
	background: inherit;
	border-left: 1px solid rgba(0,0,0,.06);
	border-bottom: 1px solid rgba(0,0,0,.06);
	transform: rotate(45deg);
	bottom: 16px; left: -6px;
}
#tscb-teaser-close {
	border: none; background: #f0f0f0; color: #666;
	width: 20px; height: 20px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	padding: 0; cursor: pointer; flex: none;
	touch-action: manipulation;
}
#tscb-teaser-close span { font-size: 13px; line-height: 1; display: block; transform: translateY(-.5px); }
#tscb-teaser-close:hover { background: #e2e2e2; }
@media (prefers-color-scheme: dark) {
	#tscb-teaser { background: #26262c; color: #ececf1; border-color: rgba(255,255,255,.08); }
	#tscb-teaser-close { background: #35353d; color: #cfcfd6; }
}
@media (max-width: 640px) {
	#tscb-teaser { font-size: 13px; max-width: calc(100vw - 100px); }
}

/* ── Badge de fecha de feria ── */
.tscb-date {
	flex: none; font-size: 10.5px; font-weight: 700;
	color: #0f4c81; background: #e8f1fa;
	padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
#tscb-overlay.tscb-dark .tscb-date { color: #8fc1ee; background: #1e2c3a; }

/* ── Onboarding primera visita ── */
#tscb-tour {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	margin: 10px 14px 0;
	padding: 11px 14px;
	background: linear-gradient(135deg, rgba(242,183,5,.14), rgba(242,183,5,.05));
	border: 1px solid rgba(242,183,5,.4);
	border-radius: 12px;
	font-size: 13.5px; line-height: 1.4; color: #4a3c10;
}
#tscb-tour button {
	flex: none; border: none; cursor: pointer;
	background: var(--tscb-main); color: #fff;
	font-size: 12.5px; font-weight: 700;
	padding: 7px 13px; border-radius: 999px;
	touch-action: manipulation;
}
#tscb-tour button:hover { opacity: .9; }
#tscb-overlay.tscb-dark #tscb-tour { color: #e8d9a8; background: rgba(242,183,5,.08); border-color: rgba(242,183,5,.25); }

/* ── Articulos relacionados (server-rendered, SEO) ── */
.tscb-rel { margin: 34px 0 8px; padding: 20px 22px; background: #faf7f2; border: 1px solid #eee4d8; border-radius: 14px; }
.tscb-rel-t { font-weight: 800; font-size: 16px; margin: 0 0 10px; color: #1c1c1c; }
.tscb-rel ul { margin: 0; padding-left: 20px; }
.tscb-rel li { margin: 7px 0; line-height: 1.45; }
.tscb-rel a { color: var(--tscb-main); text-decoration: none; font-weight: 600; }
.tscb-rel a:hover { text-decoration: underline; }

/* ── Miniaturas / iniciales en resultados ── */
.tscb-item { justify-content: flex-start; }
.tscb-item .tscb-title { flex: 1; }
.tscb-item .tscb-cat { margin-left: auto; }
.tscb-thumb {
	flex: none;
	width: 42px; height: 42px;
	border-radius: 10px;
	overflow: hidden;
	display: flex; align-items: center; justify-content: center;
	background: #f3f3f3;
}
.tscb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tscb-thumb-txt { font-size: 17px; font-weight: 800; }
#tscb-overlay.tscb-dark .tscb-thumb { background: #2a2a31; }
#tscb-overlay.tscb-dark .tscb-thumb-txt { filter: brightness(.85) saturate(1.1); }
@media (max-width: 640px) {
	.tscb-thumb { width: 38px; height: 38px; border-radius: 9px; }
}
