/* detalle.css — Ficha de producto (detalle.php), 2.9. Antes, ≈ 830 líneas de CSS dentro de la página.
   Colores con contraste AA: tinta #1e1a18, gris #5f5853, naranja de texto #9a4f04 sobre blanco o crema. */

.df-body {
  --df-ink: #1e1a18; --df-gris: #5f5853; --df-linea: #ebe5dc; --df-nar: #f7921e; --df-nar-t: #9a4f04;
  --df-crema: #fff8ee; --df-neutro: #fbf8f3; --df-neutro-borde: #d9cdbd; --df-foco: #1F8A85; --df-fondo: #f6f5f3;
  background: var(--df-fondo);
}
.df [hidden], #lightbox[hidden] { display: none !important; }

/* ---------- Cabecera del sitio: buscador y lema (antes, en línea) ---------- */
.df-body .logo .rent { color: var(--df-nar); }
.df-body .logo-sub { font-size: 1.2rem; color: #b25c1e; letter-spacing: 2px; font-weight: 500; margin-top: 2px; margin-bottom: 12px; text-align: center; text-transform: lowercase; font-family: 'Arial', sans-serif; }
.df .catalogo-busqueda { width: 100%; display: flex; justify-content: center; margin-bottom: 0; position: relative; z-index: 999; }
.df .busqueda-box { position: relative; display: flex; align-items: center; width: 100%; max-width: 800px; margin: 8px auto 18px; padding: 0 18px 0 46px; border: 2px solid var(--df-nar); border-radius: 35px; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.06); box-sizing: border-box; transition: box-shadow .2s; }
.df .busqueda-box:hover, .df .busqueda-box:has(input:focus) { box-shadow: 0 8px 20px rgba(255,102,0,.2); }
.df .busqueda-box input { padding: 15px 0; font-size: 17px; flex: 1; width: 100%; font-weight: 500; border: none; outline: none; background: transparent; color: #333; }
.df .busqueda-box input::placeholder { color: #8a8580; font-style: italic; }
.df .busqueda-icono { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); display: flex; pointer-events: none; }
.df .resultados-vista-previa { position: absolute; z-index: 1000; top: 100%; left: 0; width: 100%; background: #fff; border: 1px solid #ccc; box-shadow: 0 10px 20px rgba(0,0,0,.1); border-radius: 10px; display: none; max-height: 300px; overflow-y: auto; margin-top: 6px; }
.df .autocomplete-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid #eee; }
.df .autocomplete-item:last-child { border-bottom: none; }
.df .autocomplete-item:hover { background: #f7f7f7; }
.df .autocomplete-item img { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }
.resultados-vista-previa .autocomplete-item.ver-mas-resultados span { color: #fff !important; font-size: 1.125rem !important; font-weight: 700; }

/* ---------- Página ---------- */
.df.detalle-main { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px 40px; align-items: stretch; box-sizing: border-box; color: var(--df-ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.df > * { box-sizing: border-box; }
.df a:focus-visible, .df button:focus-visible, .df .thumb:focus-visible, .df summary:focus-visible, #lightbox button:focus-visible, #lightbox a:focus-visible { outline: 3px solid var(--df-foco); outline-offset: 2px; }

.df-migas { font-size: 13px; color: var(--df-gris); line-height: 1.5; }
.df-migas a { color: var(--df-gris); text-decoration: none; }
.df-migas a:hover { text-decoration: underline; }
.df-migas b { color: var(--df-nar-t); font-weight: 700; }
.df-sep { margin: 0 7px; color: #a39b94; }

.df-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin: 10px 0 16px; }
.df-volver { font-size: 14px; font-weight: 600; color: var(--df-nar-t); text-decoration: none; padding: 4px 0; }
.df-volver:hover { text-decoration: underline; }
.df-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.df-nav-a { display: inline-flex; align-items: center; min-height: 34px; padding: 4px 13px; border: 1px solid var(--df-linea); border-radius: 999px; background: #fff; color: var(--df-ink); font-size: 13px; font-weight: 600; text-decoration: none; box-sizing: border-box; }
a.df-nav-a:hover { border-color: var(--df-nar); }
.df-nav-res { color: var(--df-nar-t); }
.df-nav-off { color: #8f8882; background: transparent; cursor: default; }
.df-nav-pos { font-size: 13px; color: var(--df-gris); padding: 0 2px; }
.df-nav-abajo { display: none; }

/* La tarjeta blanca con la galería y la información */
.df .detalle-container.df-grid {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 36px; align-items: start;
  width: 100%; max-width: none; min-height: 0; margin: 0; padding: 26px 28px 30px;
  background: #fff; border-radius: 18px; box-shadow: 0 10px 30px rgba(30,26,24,.07);
}

/* ---------- Galería ---------- */
.df-galeria { display: flex; flex-direction: column; min-width: 0; }
.df-galeria > #imgGrandeBox { order: 0; }
.df-galeria > .slider-dots { order: 1; }
.df-galeria > .gp-mas-movil { order: 2; }
.df-galeria > #thumbs { order: 3; }
.df #imgGrandeBox { position: relative; aspect-ratio: 1 / 1; max-height: min(620px, 72vh); width: 100%; border-radius: 16px; overflow: hidden; background: #f3f1ee; touch-action: pan-y; }
.df #imgGrandeBox #mainProductoImg {
  display: block; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; border-radius: 0; box-shadow: none; background: transparent;
  cursor: zoom-in; transition: transform .25s ease; -webkit-user-drag: none; user-select: none;
}
.df #mainProductoImg.df-entra-1 { animation: df-entra-1 .28s ease-out; }
.df #mainProductoImg.df-entra-2 { animation: df-entra-2 .28s ease-out; }
@keyframes df-entra-1 { from { transform: translateX(40px); opacity: .35; } to { transform: none; opacity: 1; } }
@keyframes df-entra-2 { from { transform: translateX(-40px); opacity: .35; } to { transform: none; opacity: 1; } }
.df-ampliar {
  position: absolute; top: 12px; right: 12px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 13px;
  border: 0; border-radius: 999px; background: #fff; color: var(--df-ink); font: 600 13px/1 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  box-shadow: 0 2px 8px rgba(0,0,0,.15); cursor: pointer;
}
.df-ampliar:hover { background: var(--df-crema); }
#imgGrandeBox:has(.gp-papelera-grande) .df-ampliar { right: auto; left: 12px; } /* con sesión, la papelera va arriba a la derecha */
#imgGrandeBox:has(.gp-papelera-grande) .nuevo-grande { top: 56px; bottom: auto; } /* 2.16c: con sesión, debajo de «Ampliar» */
.df-contador { position: absolute; right: 12px; bottom: 12px; z-index: 2; padding: 5px 10px; border-radius: 999px; background: rgba(20,16,14,.72); color: #fff; font-size: 12px; font-weight: 600; }
/* 2.16c: NUEVO pequeña arriba a la izquierda, como en las tarjetas (antes, con sesión, top y bottom a la vez la estiraban) */
.df .detalle-img-grande .nuevo-grande { left: 12px; right: auto; top: 12px; bottom: auto; }

.df .slider-dots { display: none; justify-content: center; gap: 6px; margin: 12px 0 4px; }
.df .slider-dot { width: 7px; height: 7px; border-radius: 50%; background: #d6d0c8; cursor: pointer; transition: width .2s, background .2s; }
.df .slider-dot.active { width: 18px; border-radius: 4px; background: var(--df-nar); }

.df .detalle-thumbs#thumbs { display: flex; flex-direction: row; align-items: center; gap: 6px; margin: 12px 0 0; }
.df #thumbsInner { display: flex; gap: 10px; flex: 1; min-width: 0; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; padding: 3px; }
.df #thumbsInner::-webkit-scrollbar { display: none; }
.df #thumbsInner .thumb {
  position: relative; flex: none; width: 76px; height: 76px; margin: 0; overflow: hidden; border: 2px solid transparent; border-radius: 10px;
  background: #f1ede8; box-shadow: none; opacity: .82; cursor: pointer; transition: opacity .15s, border-color .15s; box-sizing: border-box; display: block;
}
.df #thumbsInner .thumb:hover { opacity: 1; border-color: #f2c38f; }
.df #thumbsInner .thumb.active { opacity: 1; border-color: var(--df-nar); }
.df #thumbsInner .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 0; }
.df .thumbs-arrow { flex: none; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--df-linea); border-radius: 50%; background: #fff; color: var(--df-ink); cursor: pointer; }
.df .thumbs-arrow:hover { border-color: var(--df-nar); color: var(--df-nar-t); }
.df #thumbs .gp-mas { flex: none; width: 76px; min-height: 76px; height: 76px; margin: 0; }

/* ---------- Información ---------- */
.df .df-info.detalle-info-card { display: block; min-width: 0; max-width: none; width: auto; padding: 0; margin: 0; background: none; border-radius: 0; box-shadow: none; }
.df .df-info.detalle-info-card::before { display: none; }
.df-cat { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--df-nar-t); text-decoration: none; }
a.df-cat:hover { text-decoration: underline; }
.df h1.df-titulo { margin: 6px 0 4px; font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; color: var(--df-ink); text-align: left; overflow-wrap: anywhere; }
.df h1.df-titulo::after { display: none; }
.df-ref { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: var(--df-gris); }
.df .volver-titulo-row.df-herramientas { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; width: auto; }
.df-herramientas .ficha-btn-editar, .df-herramientas .gp-acciones { margin-left: 0; }
.df-herramientas .ficha-btn-editar, .df-herramientas .gp-acciones-btn { box-sizing: border-box; min-height: 40px; font: 600 15px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.ficha-sin-nombre { flex: none; padding: 3px 11px; border-radius: 999px; background: #fff4e0; color: var(--df-nar-t); font: 700 .8rem/1.3 system-ui, sans-serif; white-space: nowrap; }

/* Recuadro MEDIDAS */
.df-medidas { display: flex; align-items: center; gap: 16px; margin: 20px 0 14px; padding: 18px 20px; border: 2px solid var(--df-nar); border-radius: 16px; background: var(--df-crema); color: var(--df-ink); }
.df-medidas-ico { flex: none; color: var(--df-nar-t); }
.df-medidas .df-ico-info { display: none; }
.df-medidas-txt { min-width: 0; }
.df-k { display: block; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--df-nar-t); }
.df-medidas .df-v { margin-top: 2px; font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.01em; color: var(--df-ink); overflow-wrap: anywhere; }
.df-x { margin: 0 4px; color: var(--df-nar-t); font-weight: 700; }
.df-medidas-nota { margin: 5px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--df-gris); }
.df-medidas-larga .df-v { font-size: 20px; line-height: 1.3; font-weight: 700; letter-spacing: 0; }
.df-medidas-larga .df-x { margin: 0 2px; }
.df-medidas-consultar { border-color: var(--df-neutro-borde); background: var(--df-neutro); }
.df-medidas-consultar .df-ico-caja { display: none; }
.df-medidas-consultar .df-ico-info { display: block; }
.df-medidas-consultar .df-v { font-size: 22px; font-weight: 700; }

/* Unidades / precio y campos */
.df-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.df-chip { padding: 10px 14px; border: 1px solid var(--df-linea); border-radius: 12px; background: #fff; }
.df-chip .df-k, .df-campo .df-k { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--df-gris); }
.df-cv { margin-top: 2px; font-size: 18px; font-weight: 700; color: var(--df-ink); }
.df-campo { margin: 0 0 16px; }
.df-campo .field-value { margin-top: 3px; font-size: 15px; line-height: 1.55; color: #3a3532; overflow-wrap: anywhere; }

/* Botones */
.df-acciones { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; }
.df-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 22px; box-sizing: border-box;
  border-radius: 999px; font: 700 15px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; text-decoration: none; cursor: pointer;
}
.df-btn-2 { border: 2px solid var(--df-ink); background: #fff; color: var(--df-ink); }
.df-btn-2:hover { background: var(--df-ink); color: #fff; }
.df-btn-1 { border: 0; background: var(--df-nar); color: var(--df-ink); box-shadow: 0 4px 0 #c96f0a; }

/* ---------- Visor a pantalla completa ---------- */
#lightbox { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: rgba(20,18,17,.95); opacity: 0; transition: opacity .2s; }
#lightbox.open { opacity: 1; }
#lightbox .lightbox-overlay { position: absolute; inset: 0; cursor: zoom-out; }
#lightbox .lightbox-content { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
#lightbox .lightbox-content > * { pointer-events: auto; }
#lightbox-img { display: block; max-width: 92vw; max-height: 80vh; object-fit: contain; border-radius: 8px; background: #f7f8fa; }
#lightbox .lightbox-close, #lightbox .lightbox-arrow, #lightbox .lightbox-download {
  display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.14); cursor: pointer; text-decoration: none;
}
#lightbox .lightbox-close { position: fixed; top: 14px; right: 14px; }
#lightbox .lightbox-arrow { position: fixed; top: 50%; transform: translateY(-50%); }
#lightbox .lightbox-prev { left: 16px; }
#lightbox .lightbox-next { right: 16px; }
#lightbox .lightbox-close:hover, #lightbox .lightbox-arrow:hover, #lightbox .lightbox-download:hover { background: var(--df-nar); }
#lightbox .lightbox-download { margin-top: 14px; background: var(--df-nar); }
#lightbox .lightbox-download:hover { background: #e85900; }
#lightbox .lightbox-paginacion { min-height: 20px; margin-top: 10px; color: #fff; font-size: 14px; font-weight: 600; }
html.df-visor-abierto, html.df-visor-abierto body { overflow: hidden; }

/* ---------- Pie ---------- */
.df-body footer.df-pie { box-sizing: border-box; margin-top: 48px; font-size: 1rem; }

/* ---------- Tableta: una columna ---------- */
@media (max-width: 900px) {
  .df .detalle-container.df-grid { grid-template-columns: minmax(0, 1fr); gap: 22px; padding: 20px; }
  .df-galeria { max-width: 620px; width: 100%; margin: 0 auto; }
}

/* ---------- Móvil ---------- */
@media (max-width: 640px) {
  .df-body { background: #fff; padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .df-body .catalogo-header { margin-top: 12px; margin-bottom: 4px; }
  .df-body .logo-sub { font-size: 1rem; margin-bottom: 6px; }
  .df.detalle-main { padding: 0 16px 8px; }
  .df .busqueda-box { margin: 4px auto 10px; padding: 0 14px 0 42px; height: 44px; border-width: 2px; }
  .df .busqueda-box input { padding: 0; height: 40px; font-size: 16px; }
  .df .busqueda-icono { left: 14px; }
  .df .busqueda-icono svg { width: 19px; height: 19px; }

  .df-migas { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .df-sep { margin: 0 5px; }
  .df-top { display: none; }

  .df .detalle-container.df-grid { padding: 0; gap: 0; background: none; box-shadow: none; border-radius: 0; }
  .df-galeria { max-width: none; }
  .df #imgGrandeBox { width: calc(100% + 32px); max-height: none; margin: 10px -16px 0; border-radius: 0; }
  .df-ampliar { top: 10px; right: 10px; width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; background: rgba(255,255,255,.92); }
  .df-ampliar span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #imgGrandeBox:has(.gp-papelera-grande) .df-ampliar { left: 10px; }
  .df #imgGrandeBox .gp-papelera-grande { width: 44px; height: 44px; }
  .df .detalle-img-grande .nuevo-grande { left: 10px; top: 10px; }
  #imgGrandeBox:has(.gp-papelera-grande) .nuevo-grande { top: 62px; } /* 2.16c: debajo de «Ampliar» (44 px en móvil) */
  .df .slider-dots { display: flex; }
  .df .detalle-thumbs#thumbs { display: none; }
  .df .gp-mas-movil { margin: 8px auto 4px; min-height: 44px; }

  .df-info { margin-top: 10px; }
  .df h1.df-titulo { font-size: 22px; margin-top: 4px; }
  .df-medidas { gap: 12px; margin: 14px 0 12px; padding: 14px 16px; }
  .df-medidas-ico { width: 36px; height: 36px; }
  .df-medidas .df-v { font-size: 28px; }
  .df-medidas-larga .df-v { font-size: 18px; }
  .df-medidas-consultar .df-v { font-size: 20px; }
  .df .volver-titulo-row.df-herramientas { gap: 8px; }
  .df-herramientas .ficha-btn-editar, .df-herramientas .gp-acciones-btn { min-height: 44px; }
  .df-herramientas .gp-acciones { margin: 0; }
  .df .df-herramientas:has(.gp-acciones[open]) { z-index: 950; } /* el menú abierto, por encima de la barra fija */

  /* Barra fija inferior: «Descargar imagen» y el hueco de «+ Añadir a proyecto» (2.10) */
  .df-acciones {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; margin: 0; flex-wrap: nowrap; gap: 8px;
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: #fff; border-top: 1px solid var(--df-linea);
    box-shadow: 0 -6px 18px rgba(30,26,24,.06);
  }
  .df-acciones .df-btn { flex: 1; padding: 11px 10px; font-size: 15px; }

  .df-nav-abajo { display: flex; align-items: center; flex-wrap: wrap; gap: 0 6px; margin: 18px 0 0; padding-top: 6px; border-top: 1px solid var(--df-linea); }
  .df-nav-abajo .df-nav-a { flex: none; min-height: 44px; padding: 4px 6px; border: 0; background: none; color: var(--df-nar-t); font-size: 14px; }
  .df-nav-abajo .df-nav-off { color: #8f8882; }
  .df-nav-abajo .df-nav-pos { flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .df-nav-abajo .df-nav-res { order: 3; flex-basis: 100%; justify-content: center; }

  .df-body footer.df-pie { margin-top: 32px; padding: 1.1em 16px; font-size: 15px; }
  #lightbox .lightbox-arrow { width: 44px; height: 44px; }
  #lightbox .lightbox-prev { left: 6px; }
  #lightbox .lightbox-next { right: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .df #mainProductoImg, .df .slider-dot, #lightbox { transition: none; animation: none; }
}
