/* ============================================================
   Inmobiliaria Bambú · identidad visual
   Verde #0A2621 · Dorado #D9B46A · Marfil #F7F5EF
   ============================================================ */

:root {
  --verde:  #0B2522;
  --bosque: #15453A;
  --oro:    #E8C071;
  --cana:   #856326;
  --papel:  #F7F5EF;
  --hoja:   #E8EBE3;
  --niebla: #E2E0D6;
  --humo:   #6A7268;
}

html { scroll-behavior: smooth; }

body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-weight: 400;
}

/* Los títulos usan Jost ligera, como el logotipo */
.font-display { font-weight: 300; letter-spacing: -0.005em; }

/* Foco visible y coherente en toda la web */
:focus-visible {
  outline: 2px solid var(--cana);
  outline-offset: 2px;
}

input, select, textarea, button { font-family: inherit; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* ------------------------------------------------------------
   Regla dorada: línea, texto centrado, línea.
   Es el remate del logotipo («— Desde 2002 —») y se usa como
   separador de secciones en toda la web.
   ------------------------------------------------------------ */
.regla-oro {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-family: Jost, system-ui, sans-serif;
  font-weight: 300;
  font-size: .78rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--cana);
}
.regla-oro::before,
.regla-oro::after {
  content: "";
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: .45;
}
.regla-oro > span { flex: 0 0 auto; white-space: nowrap; }

/* Sobre fondo verde la regla usa el dorado claro */
.bg-verde .regla-oro, footer .regla-oro { color: var(--oro); }

/* Variante alineada a la izquierda (una sola línea, a la derecha) */
.regla-oro--izq::before { display: none; }

/* ------------------------------------------------------------
   Cañas de bambú: marca de agua de las bandas verdes.
   Es el fondo de la tarjeta corporativa, aquí muy atenuado
   para que nunca compita con el texto.
   ------------------------------------------------------------ */
.franja-bambu { position: relative; overflow: hidden; }
.franja-bambu::before {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 300px;
  background: url("/img/bambu.svg") left center / auto 115% no-repeat;
  color: var(--oro);
  opacity: .07;
  pointer-events: none;
}
.franja-bambu > * { position: relative; }

@media (max-width: 767px) {
  .franja-bambu::before { width: 150px; opacity: .05; }
}

/* ------------------------------------------------------------
   Navegación
   ------------------------------------------------------------ */
.enlace-nav { position: relative; padding-bottom: 3px; transition: color .2s ease; }
.enlace-nav::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 1px;
  background: var(--oro);
  transition: width .28s ease;
}
.enlace-nav:hover { color: var(--oro); }
.enlace-nav:hover::after { width: 100%; }

/* ------------------------------------------------------------
   Fichas de inmueble
   ------------------------------------------------------------ */
.tarjeta-inmueble .marco { transition: border-color .3s ease; }
.tarjeta-inmueble:hover .marco { border-color: var(--cana); }

/* Descripción del inmueble */
.prose-bambu p { margin-bottom: 1rem; }
.prose-bambu p:last-child { margin-bottom: 0; }

/* Barra de miniaturas */
.miniatura { transition: border-color .2s ease; }
.miniatura:hover { border-color: var(--cana); }

/* Tablas del panel */
table thead th { background: #fff; }

/* ------------------------------------------------------------
   Páginas legales
   ------------------------------------------------------------ */
.texto-legal { font-size: 15.5px; line-height: 1.75; }
.texto-legal h2 {
  font-family: Jost, sans-serif;
  font-weight: 400;
  font-size: 1.3rem;
  margin: 2.5rem 0 .9rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--niebla);
}
.texto-legal h2:first-child { margin-top: 0; }
.texto-legal p { margin-bottom: 1rem; }
.texto-legal ul { margin: 0 0 1.2rem 1.1rem; padding: 0; list-style: none; }
.texto-legal li { position: relative; padding-left: .9rem; margin-bottom: .45rem; }
.texto-legal li::before {
  content: ""; position: absolute; left: 0; top: .68em;
  width: 5px; height: 1px; background: var(--cana);
}
.texto-legal a { color: var(--cana); text-decoration: underline; text-underline-offset: 3px; }
.texto-legal a:hover { color: var(--verde); }
.texto-legal code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .88em; background: var(--hoja); padding: 1px 5px;
}

.ficha-legal { border-top: 1px solid var(--niebla); margin: 0 0 1.5rem; }
.ficha-legal > div {
  display: flex; flex-wrap: wrap; gap: .3rem 1.5rem;
  padding: .7rem 0; border-bottom: 1px solid var(--niebla);
}
.ficha-legal dt {
  font-family: Jost, sans-serif; font-size: .7rem; text-transform: uppercase;
  letter-spacing: .15em; color: var(--humo); flex: 0 0 190px;
}
.ficha-legal dd { margin: 0; flex: 1 1 240px; }

.tabla-legal { width: 100%; border-collapse: collapse; margin: 0 0 1.5rem; font-size: 14.5px; }
.tabla-legal th, .tabla-legal td {
  text-align: left; vertical-align: top;
  padding: .7rem .8rem; border-bottom: 1px solid var(--niebla);
}
.tabla-legal th {
  font-family: Jost, sans-serif; font-weight: 400; font-size: .7rem;
  text-transform: uppercase; letter-spacing: .12em; color: var(--humo);
  border-bottom-color: var(--verde);
}
.tabla-legal td:first-child { padding-left: 0; }
.tabla-legal th:first-child { padding-left: 0; }

/* ------------------------------------------------------------
   MENÚ DEL ERP
   Grupos con desplegable en escritorio, acordeón en móvil.
   ------------------------------------------------------------ */
/* Los desplegables los abre y cierra el JavaScript, no :hover.
   En pantalla táctil el hover no existe, así que confiar en él
   dejaba el menú inservible en tablet y móvil. */
.grupo-erp > button .flecha { transition: transform .2s ease; display: inline-block; }
.grupo-erp.abierto > button .flecha { transform: rotate(180deg); }
.grupo-erp.abierto > button { color: var(--verde); }

@media (max-width: 767px) {
  .grupo-erp > button { border-bottom: 1px solid var(--niebla); border-left: 0; }
  .grupo-erp .submenu-erp { border-left: 2px solid var(--cana); border-right: 0; border-top: 0; }
  .menu-erp .grupo-erp { width: 100%; }
}

/* ------------------------------------------------------------
   TABLAS RESPONSIVE
   En móvil cada fila se convierte en una ficha con etiquetas,
   así desaparece el scroll horizontal.
   Uso:  <table class="tabla-ficha">  y  <td data-l="Precio">
   ------------------------------------------------------------ */
.tabla-ficha { width: 100%; border-collapse: collapse; }

@media (max-width: 767px) {
  .tabla-ficha thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tabla-ficha tbody { display: block; }
  .tabla-ficha tr {
    display: block;
    border: 1px solid var(--niebla);
    background: #fff;
    margin-bottom: .7rem;
    padding: .25rem 0;
  }
  .tabla-ficha td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1.2rem;
    width: auto !important;
    text-align: right;
    padding: .5rem .9rem !important;
    border: 0 !important;
    white-space: normal !important;
  }
  .tabla-ficha td::before {
    content: attr(data-l);
    flex: 0 0 auto;
    font-family: Jost, sans-serif;
    font-weight: 400;
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .13em;
    color: var(--humo);
    text-align: left;
  }
  .tabla-ficha td:not([data-l])::before { content: ""; }
  .tabla-ficha td:not([data-l]) { justify-content: flex-end; }
  .tabla-ficha td.td-titulo {
    display: block;
    text-align: left;
    border-bottom: 1px solid var(--niebla) !important;
    padding-bottom: .7rem !important;
    margin-bottom: .25rem;
  }
  .tabla-ficha td.td-titulo::before { display: none; }
  .tabla-ficha td .truncate,
  .tabla-ficha td .max-w-\[240px\],
  .tabla-ficha td .max-w-\[250px\],
  .tabla-ficha td .max-w-\[220px\],
  .tabla-ficha td .max-w-\[180px\],
  .tabla-ficha td .max-w-\[170px\] { max-width: none; overflow: visible; white-space: normal; text-overflow: clip; }
  .tabla-ficha tfoot { display: block; }
  .tabla-ficha tfoot tr { border-color: var(--verde); border-width: 2px; }

  /* El contenedor deja de necesitar scroll */
  .tabla-envoltorio { overflow: visible !important; border: 0 !important; background: transparent !important; }
}

/* Ninguna tabla del panel fuerza ancho mínimo en móvil */
@media (max-width: 767px) {
  table[class*="min-w-"] { min-width: 0 !important; }
}

/* ------------------------------------------------------------
   Ajustes generales de responsive
   ------------------------------------------------------------ */
@media (max-width: 767px) {
  /* Ningún bloque provoca desbordamiento lateral */
  html, body { overflow-x: hidden; }

  /* Los grupos de botones se apilan */
  .acciones-apilables { flex-direction: column; align-items: stretch; }
  .acciones-apilables > * { width: 100%; text-align: center; }

  /* Formularios en rejilla pasan a una columna */
  .form-rejilla { grid-template-columns: 1fr !important; }
}

/* ------------------------------------------------------------
   Documentos generados: se muestran como en el papel
   ------------------------------------------------------------ */
.documento-vista { font-family: "Times New Roman", Georgia, serif; font-size: 15px; line-height: 1.7; color: #1a1a1a; }
.documento-vista h1 { font-size: 20px; text-align: center; text-transform: uppercase;
                      letter-spacing: .05em; font-weight: 700; margin: 0 0 8px; }
.documento-vista h2 { font-size: 16px; text-transform: uppercase; letter-spacing: .04em;
                      margin: 26px 0 10px; padding-bottom: 5px; border-bottom: 1px solid #ccc; }
.documento-vista p { margin: 0 0 13px; text-align: justify; }
.documento-vista p.lugar { text-align: right; font-style: italic; margin-bottom: 26px; }
.documento-vista table.firmas { width: 100%; margin-top: 44px; border-collapse: collapse; }
.documento-vista table.firmas td { width: 50%; vertical-align: top; text-align: center;
                                   font-size: 14px; padding: 0 14px; line-height: 1.6; }
.documento-vista .falta { background: #fff3c4; padding: 0 3px; }
@media (max-width: 767px) {
  .documento-vista table.firmas td { display: block; width: 100%; margin-bottom: 30px; }
}

/* ------------------------------------------------------------
   SELECTOR CON BUSCADOR
   ------------------------------------------------------------ */
.selector { position: relative; }
.selector-lista { scrollbar-width: thin; }
.selector-lista .opcion { cursor: pointer; transition: background-color .12s ease; }
.selector-lista .opcion:focus-visible { outline: 2px solid var(--cana); outline-offset: -2px; }
/* Al enfocar el campo se resalta como el resto de inputs */
.selector [data-sel-texto]:focus { border-color: var(--cana); outline: none; }
/* En móvil la lista ocupa todo el ancho disponible */
@media (max-width: 767px) {
  .selector-lista { max-height: 60vh; }
}

/* Impresión de una ficha */
@media print {
  header, footer, nav, form, .miniatura { display: none !important; }
  body { background: #fff; }
}

/* Respetar la preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
