/*
 * Catalogos compartidos, etapa 3, F5g + F5h: ficha nueva de propiedad (solo agentes con catalogo).
 * Plantilla: templates-idx/template-1/ficha-catalogo.php. JS: js/ficha-catalogo.js. Maqueta v4 aprobada por David.
 * Todo va dentro de .fc-wrap (prefijo fc-) para no chocar con los estilos de la web del agente (bootstrap, tema).
 * Colores del agente: variables --fc-btn, --fc-btn-fg, --fc-accent, --fc-r (las pone la plantilla).
 */
.fc-wrap {
    --fc-bg: #f6f7f9; --fc-card: #fff; --fc-fg: #1b1f24; --fc-muted: #646b75; --fc-faint: #8b929c; --fc-line: #d9dde3;
    --fc-line2: #bcc3cc; --fc-accent: #1f5fd1; --fc-accent-bg: #e7eefc; --fc-ok: #17663a; --fc-warn: #8a5a00;
    --fc-warn-bg: #fff4dc; --fc-hover: #eef1f5; --fc-btn: #16191d; --fc-btn-fg: #fff; --fc-wa: #1f8f4e; --fc-r: 8px;
    background: var(--fc-bg); color: var(--fc-fg); font-size: 14px; line-height: 1.5; text-align: left; padding-bottom: 8px;
}
.fc-wrap *, .fc-wrap *::before, .fc-wrap *::after { box-sizing: border-box; }
.fc-wrap [hidden] { display: none !important; }
.fc-in { max-width: 1180px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.fc-wrap button, .fc-wrap input, .fc-wrap textarea, .fc-wrap select { font: inherit; color: inherit; }
.fc-wrap a:focus-visible, .fc-wrap button:focus-visible, .fc-wrap input:focus-visible, .fc-wrap textarea:focus-visible {
    outline: 2px solid var(--fc-accent); outline-offset: 2px;
}
.fc-ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fc-wrap h1, .fc-wrap h2, .fc-wrap h3 { font-family: inherit; color: var(--fc-fg); letter-spacing: normal; text-transform: none; }

/* Anterior / Siguiente (solo si se viene de una busqueda) */
.fc-nav { display: flex; align-items: center; gap: 12px; padding-top: 12px; min-height: 24px; }
.fc-wrap .fc-back { color: var(--fc-accent); text-decoration: none; white-space: nowrap; }
.fc-wrap .fc-back:hover { text-decoration: underline; }
.fc-pos { flex: 1; text-align: center; color: var(--fc-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.fc-pn { display: flex; gap: 4px; }
.fc-wrap .fc-pn button { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 8px; border: none; border-radius: 6px;
    background: none; color: var(--fc-accent); font-weight: 500; cursor: pointer; }
.fc-wrap .fc-pn button:hover { background: var(--fc-accent-bg); }
.fc-wrap .fc-pn button[disabled] { visibility: hidden; }

/* Titulo */
.fc-title { padding-top: 18px; padding-bottom: 14px; display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.fc-crumbs { color: var(--fc-muted); font-size: 13px; margin-bottom: 6px; }
.fc-crumbs a { color: inherit; text-decoration: none; }
.fc-crumbs a:hover { text-decoration: underline; }
.fc-wrap .fc-title h1 { font-size: 26px; font-weight: 600; line-height: 1.2; margin: 0; text-wrap: balance; }
.fc-sub { color: var(--fc-muted); margin-top: 4px; }
.fc-tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--fc-accent-bg);
    color: var(--fc-accent); margin-right: 8px; vertical-align: 3px; }
.fc-tools { display: flex; gap: 8px; flex: none; position: relative; }
.fc-wrap .fc-tools > button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--fc-line2); background: var(--fc-card);
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.fc-share { position: absolute; right: 0; top: 46px; z-index: 30; background: var(--fc-card); border: 1px solid var(--fc-line); border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .12); padding: 6px; min-width: 210px; display: grid; }
.fc-wrap .fc-share a, .fc-wrap .fc-share button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; border: none;
    background: none; color: var(--fc-fg); text-decoration: none; cursor: pointer; text-align: left; width: 100%; }
.fc-wrap .fc-share a:hover, .fc-wrap .fc-share button:hover { background: var(--fc-hover); }

/* Galeria: una grande + mosaico segun el numero de fotos */
.fc-gal { display: grid; gap: 6px; border-radius: 12px; overflow: hidden; position: relative; height: 420px; background: var(--fc-hover); }
.fc-gal.g1 { grid-template-columns: 1fr; }
.fc-gal.g2 { grid-template-columns: 1fr 1fr; }
.fc-gal.g3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.fc-gal.g3 .fc-ph:first-child { grid-row: 1 / span 2; }
.fc-gal.g4 { grid-template-columns: 2fr 1fr; grid-template-rows: repeat(3, 1fr); }
.fc-gal.g4 .fc-ph:first-child { grid-row: 1 / span 3; }
.fc-gal.g5 { grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; }
.fc-gal.g5 .fc-ph:first-child { grid-row: 1 / span 2; }
.fc-wrap .fc-ph { display: block; border: none; padding: 0; margin: 0; cursor: zoom-in; min-width: 0; min-height: 0; overflow: hidden;
    background: var(--fc-hover); position: relative; }
.fc-ph img { width: 100%; height: 100%; object-fit: cover; display: block; max-width: none; }
.fc-sinfoto { display: flex; align-items: center; justify-content: center; color: var(--fc-muted); height: 100%; }
.fc-galbtns { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.fc-wrap .fc-galbtns button, .fc-wrap .fc-carrbtns button { height: 36px; padding: 0 12px; border: none; border-radius: 8px; background: rgba(255, 255, 255, .95);
    color: #16191d; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.fc-carrwrap { display: none; }

/* Cuerpo: columna principal + caja de contacto */
.fc-cols { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; padding-top: 22px; padding-bottom: 32px; align-items: start; }
.fc-panel { background: var(--fc-card); border: 1px solid var(--fc-line); border-radius: 10px; padding: 20px; }
.fc-panel + .fc-panel { margin-top: 16px; }
.fc-wrap .fc-panel h2, .fc-wrap .fc-like h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
.fc-wrap .fc-panel h3 { font-size: 12px; font-weight: 600; color: var(--fc-muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 8px; }
.fc-desc { overflow-wrap: anywhere; }
.fc-desc p { margin: 0 0 10px; }
.fc-desc.fc-cut { max-height: 9.2em; overflow: hidden; position: relative; }
.fc-desc.fc-cut::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3em; background: linear-gradient(transparent, var(--fc-card)); }
.fc-wrap .fc-lk { background: none; border: none; padding: 0; color: var(--fc-accent); cursor: pointer; font-weight: 500; text-decoration: none; }
.fc-wrap .fc-lk:hover { text-decoration: underline; }

/* Caracteristicas (F5h) */
.fc-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 1100px) { .fc-figs { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.fc-fig { border: 1px solid var(--fc-line); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.fc-fig b { display: block; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-fig span { color: var(--fc-muted); font-size: 12px; }
.fc-dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 28px; margin: 16px 0 0; }
.fc-dl div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--fc-line); }
.fc-dl dt { color: var(--fc-muted); font-weight: 400; }
.fc-dl dd { margin: 0; text-align: right; font-weight: 500; }
.fc-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px 24px; margin-top: 18px; }
.fc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--fc-hover); font-size: 13px; }
.fc-chip svg { width: 14px; height: 14px; stroke: var(--fc-ok); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Certificado energetico (F5h) */
.fc-en { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fc-en li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fc-lt { display: inline-flex; align-items: center; height: 20px; padding: 0 12px 0 7px; font-size: 12px; font-weight: 600; color: #fff;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%); }
.fc-lt.A { background: #138a3e; } .fc-lt.B { background: #3fae3a; } .fc-lt.C { background: #79a92b; } .fc-lt.D { background: #bcaa0c; }
.fc-lt.E { background: #f2b01f; } .fc-lt.F { background: #e8701f; } .fc-lt.G { background: #d8262b; }
.fc-nv { color: var(--fc-muted); }
.fc-esc { margin-top: 12px; border: 1px solid var(--fc-line); border-radius: 8px; padding: 12px; max-width: 460px; }
.fc-esc table { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: 11px; }
.fc-esc th { font-weight: 500; color: var(--fc-muted); text-align: center; line-height: 1.25; vertical-align: bottom; }
.fc-esc th:first-child { text-align: left; text-transform: uppercase; letter-spacing: .02em; }
.fc-esc td { height: 24px; padding: 0; }
.fc-esc td.v { width: 23%; text-align: center; border-left: 1px solid var(--fc-line); }
.fc-esc .fc-eb { white-space: nowrap; display: inline-flex; align-items: center; height: 22px; padding: 0 14px 0 8px; font-weight: 600; font-size: 13px;
    clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 50%, calc(100% - 11px) 100%, 0 100%); }
.fc-esc .fc-eb small { font-weight: 400; font-size: 10px; margin-left: 6px; opacity: .9; }
.fc-esc .fc-mk { display: inline-flex; align-items: center; height: 22px; padding: 0 8px 0 14px; background: #1b1f24; color: #fff; font-weight: 600;
    font-size: 12px; clip-path: polygon(10px 0, 100% 0, 100% 100%, 10px 100%, 0 50%); }
.fc-badge { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 6px; background: var(--fc-warn-bg);
    color: var(--fc-warn); font-weight: 500; font-size: 13px; }

/* Video, tour, mapa (F5h) */
.fc-media { aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #1b1f24; position: relative; max-width: 100%; }
.fc-media iframe, .fc-media video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.fc-wrap .fc-play { position: absolute; inset: 0; width: 100%; border: none; padding: 0; cursor: pointer; background: #1b1f24 center / cover no-repeat;
    display: flex; align-items: center; justify-content: center; }
.fc-play span { width: 68px; height: 68px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #16191d; display: flex;
    align-items: center; justify-content: center; font-size: 26px; box-shadow: 0 4px 16px rgba(0, 0, 0, .3); }
.fc-media-acts { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; flex-wrap: wrap; color: var(--fc-muted); font-size: 13px; }
.fc-media + .fc-media { margin-top: 12px; }
.fc-map { height: 360px; border-radius: 8px; overflow: hidden; z-index: 0; }

/* Caja de precio y contacto */
.fc-side { position: sticky; top: 16px; }
.fc-price { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.fc-pm2 { color: var(--fc-muted); font-size: 13px; margin-top: 2px; }
.fc-facts { margin-top: 10px; }
.fc-loc { color: var(--fc-muted); font-size: 13px; }
.fc-agent { display: flex; gap: 12px; align-items: center; margin: 16px 0 12px; padding-top: 16px; border-top: 1px solid var(--fc-line); }
.fc-av { width: 52px; height: 52px; border-radius: 50%; background: #3d4e66 center / cover no-repeat; color: #fff; display: flex; align-items: center;
    justify-content: center; font-weight: 600; flex: none; overflow: hidden; }
.fc-agent b { display: block; }
.fc-agent span { color: var(--fc-muted); font-size: 13px; display: block; }
.fc-agent a { color: var(--fc-accent); text-decoration: none; font-size: 13px; }
.fc-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fc-acts.fc-uno { grid-template-columns: 1fr; }
.fc-wrap .fc-btn { height: 42px; border-radius: var(--fc-r); border: 1px solid var(--fc-line2); background: var(--fc-card); display: inline-flex;
    align-items: center; justify-content: center; gap: 6px; font-weight: 500; cursor: pointer; text-decoration: none; color: var(--fc-fg); padding: 0 12px; }
.fc-wrap .fc-btn:hover { background: var(--fc-hover); }
.fc-wrap .fc-btn.fc-wa { border-color: var(--fc-wa); color: var(--fc-wa); }
.fc-wrap .fc-btn.fc-dark { background: var(--fc-btn); color: var(--fc-btn-fg); border-color: var(--fc-btn); width: 100%; }
.fc-wrap .fc-btn.fc-dark:hover { opacity: .92; }
.fc-form { margin-top: 14px; display: grid; gap: 8px; }
.fc-wrap .fc-form input[type=text], .fc-wrap .fc-form input[type=email], .fc-wrap .fc-form input[type=tel], .fc-wrap .fc-form textarea {
    width: 100%; height: auto; border: 1px solid var(--fc-line2); border-radius: var(--fc-r); background: var(--fc-card); padding: 9px 10px;
    font-size: 16px; box-shadow: none; }
.fc-wrap .fc-form textarea { min-height: 96px; resize: vertical; }
.fc-wrap .fc-form .iti { width: 100%; }
.fc-wrap .fc-form label.fc-chk { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--fc-muted); font-weight: 400; margin: 0; }
.fc-wrap .fc-form label.fc-chk input { position: static; opacity: 1; left: auto; width: auto; margin: 2px 0 0; flex: none; }
.fc-wrap .fc-form label.fc-chk a { color: var(--fc-accent); }
.fc-wrap .fc-form label.error, .fc-err { color: #b42318; font-size: 12px; font-weight: 400; margin: 0; }
.fc-me { font-size: 13px; color: var(--fc-muted); }

/* Tambien te puede gustar (F5h): tarjetas como las del buscador */
.fc-like { padding-bottom: 32px; }
.fc-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.fc-card { background: var(--fc-card); border: 1px solid var(--fc-line); border-radius: 10px; overflow: hidden; min-width: 0; }
.fc-wrap .fc-card a { color: inherit; text-decoration: none; display: block; }
.fc-card .fc-im { aspect-ratio: 4 / 3; background: var(--fc-hover); overflow: hidden; }
.fc-card .fc-im img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fc-card .fc-cb { padding: 10px 12px; }
.fc-card b { font-size: 16px; }
.fc-card .fc-m { color: var(--fc-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Precio bajo las fotos: solo movil y tableta (en escritorio esta en la columna de la derecha) */
.fc-mprice { display: none; }

/* Barra fija del movil */
.fc-mbar { display: none; }

/* Visor de fotos: cuadricula con todas + vista de una */
.fc-lb { position: fixed; inset: 0; z-index: 100000; background: var(--fc-bg); display: flex; flex-direction: column; }
.fc-lb .fc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--fc-line);
    background: var(--fc-card); }
.fc-wrap .fc-lb .fc-top button { height: 36px; padding: 0 12px; border: 1px solid var(--fc-line2); border-radius: 8px; background: var(--fc-card); cursor: pointer; }
.fc-lb .fc-scroll { flex: 1; overflow: auto; padding: 16px; }
.fc-grid { max-width: 1000px; margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fc-grid .fc-ph { aspect-ratio: 3 / 2; border-radius: 6px; }
.fc-grid .fc-ph.fc-ancha { grid-column: 1 / -1; aspect-ratio: 16 / 8; }
.fc-one { position: fixed; inset: 0; z-index: 100001; background: rgba(10, 12, 15, .96); color: #fff; display: flex; flex-direction: column; padding: 10px 12px; }
.fc-one .fc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fc-wrap .fc-one .fc-top button { background: none; border: 1px solid rgba(255, 255, 255, .4); color: #fff; border-radius: 8px; height: 36px; padding: 0 12px; cursor: pointer; }
.fc-stage { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 0; }
.fc-stage img { max-width: min(1100px, 100%); max-height: 100%; object-fit: contain; border-radius: 4px; }
.fc-wrap .fc-arr { background: rgba(255, 255, 255, .15); border: none; color: #fff; width: 44px; height: 44px; border-radius: 50%; font-size: 22px; cursor: pointer; flex: none; }
.fc-thumbs { display: flex; gap: 6px; overflow-x: auto; padding-top: 10px; }
.fc-wrap .fc-thumbs button { flex: 0 0 64px; height: 44px; border-radius: 4px; border: 2px solid transparent; padding: 0; overflow: hidden; cursor: pointer; opacity: .6; background: #333; }
.fc-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fc-wrap .fc-thumbs button.fc-on { border-color: #fff; opacity: 1; }
body.fc-visor { overflow: hidden; }

@media (max-width: 980px) {
    .fc-cols { grid-template-columns: minmax(0, 1fr); }
    .fc-side { position: static; }
    .fc-mprice { display: block; padding-top: 16px; }
    .fc-mprice .fc-facts { margin-top: 4px; color: var(--fc-muted); }
    .fc-cols { padding-top: 16px; }
    .fc-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .fc-pn .fc-t, .fc-back .fc-t { display: none; }
    .fc-wrap .fc-pn button { width: 40px; height: 36px; justify-content: center; padding: 0; }
    .fc-pn .fc-ico { width: 20px; height: 20px; }
    .fc-wrap .fc-title h1 { font-size: 21px; }
    .fc-fig { padding: 8px 10px; }
    .fc-fig b { font-size: 15px; }
    .fc-gal { display: none; }
    .fc-carrwrap { display: block; position: relative; margin-left: -16px; margin-right: -16px; }
    .fc-carr { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
    .fc-carr::-webkit-scrollbar { display: none; }
    .fc-carr .fc-ph { flex: 0 0 100%; aspect-ratio: 4 / 3; scroll-snap-align: start; }
    .fc-cnt { position: absolute; right: 10px; bottom: 10px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 999px; }
    .fc-carrbtns { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 6px; }
    .fc-wrap .fc-carrbtns button { height: 30px; padding: 0 10px; border-radius: 999px; font-size: 12px; }
    .fc-grid { grid-template-columns: minmax(0, 1fr); }
    .fc-grid .fc-ph.fc-ancha { aspect-ratio: 3 / 2; }
    .fc-arr { display: none !important; }
    .fc-side .fc-acts { display: none; }
    .fc-mbar { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 9990;
        background: var(--fc-card); border-top: 1px solid var(--fc-line);
        padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
    .fc-mbar.fc-dos { grid-template-columns: 1fr 1.3fr; }
    .fc-mbar.fc-solo { grid-template-columns: 1fr; }
    .fc-wrap .fc-mbar .fc-btn { height: 44px; padding: 0 6px; }
    body.fc-con-mbar { padding-bottom: 70px; }
    .fc-cards { grid-template-columns: minmax(0, 1fr); }
    .fc-map { height: 280px; }
}
@media (prefers-reduced-motion: reduce) { .fc-wrap * { scroll-behavior: auto !important; } }
/* Viniendo de una busqueda: solo "Volver a la busqueda" (+ Anterior / Siguiente), sin la barra reducida (clase puesta por un script en ficha-catalogo.php) */
.fc-de-busqueda .topsearch { display: none !important; }
/* Prefijo del telefono (intl-tel-input): la regla de los campos de arriba (padding 10px) pisaba el hueco de la bandera */
.fc-wrap .fc-form .iti--allow-dropdown input[type="tel"] { padding-left: 52px; }
