/* ==============================================================================
   product.css — Ficha de producto: galería, info, tabs, tablas y lightbox
   ============================================================================== */

/* ---------- Layout ---------- */
.product-layout {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 3rem;
  padding-top: 1.6rem; align-items: start;
}

/* ---------- Galería ---------- */
.gallery__main {
  position: relative; aspect-ratio: 4/3; background: var(--bg-alt);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.gallery__img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .4s ease;
}
.gallery__img.is-active { opacity: 1; }
.gallery__zoom {
  position: absolute; right: .9rem; bottom: .9rem; width: 42px; height: 42px;
  border-radius: 50%; border: 0; background: rgba(17,24,39,.65); color: #fff;
  font-size: 1.15rem; transition: var(--transition);
}
.gallery__zoom:hover { background: var(--accent); color: #111; }
.gallery__thumbs { display: flex; gap: .7rem; margin-top: .8rem; flex-wrap: wrap; }
.gallery__thumb {
  width: 76px; height: 60px; border-radius: 8px; overflow: hidden;
  border: 2px solid transparent; padding: 0; background: none; transition: var(--transition);
}
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumb.is-active { border-color: var(--accent); }
.gallery__thumb:hover { border-color: var(--gray-light); }

/* ---------- Bloque de info ---------- */
.pinfo__brand { font-size: .85rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-dark); }
.pinfo__name { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: .35rem 0 .6rem; }
.pinfo__short { color: var(--gray); margin-bottom: 1.3rem; }

.pinfo__meta { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem 1.5rem; margin-bottom: 1.4rem; font-size: .95rem; }
.pinfo__meta strong { color: var(--dark); }
.pinfo__stock { font-weight: 700; font-size: .85rem; }
.pinfo__stock.in  { color: #065f46; }
.pinfo__stock.low { color: #92400e; }
.pinfo__stock.out { color: #991b1b; }

.pinfo__price { font-size: 1.9rem; font-weight: 800; color: var(--dark); margin-bottom: 1.4rem; }

.pinfo__buy { display: flex; flex-wrap: wrap; gap: .9rem; align-items: center; margin-bottom: 1.6rem; }
.pinfo__qty { display: flex; align-items: center; gap: .6rem; font-weight: 600; font-size: .92rem; }
.pinfo__qty input {
  width: 74px; padding: .6rem .7rem; border: 1px solid var(--gray-light);
  border-radius: 8px; font-family: inherit; font-size: 1rem; text-align: center;
}
.pinfo__qty input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.pinfo__share { display: flex; gap: 1.1rem; align-items: center; font-size: .9rem; color: var(--gray); border-top: 1px solid var(--bg-alt); padding-top: 1.1rem; }
.pinfo__share a { font-weight: 700; color: var(--accent-dark); }
.pinfo__share a:hover { color: var(--dark); }

/* ---------- Tabs ---------- */
.tabs { margin-top: 3rem; }
.tabs__nav { display: flex; gap: .3rem; border-bottom: 2px solid var(--bg-alt); flex-wrap: wrap; }
.tabs__btn {
  background: none; border: 0; padding: .85rem 1.3rem; font-weight: 700; font-size: .95rem;
  color: var(--gray); border-bottom: 3px solid transparent; margin-bottom: -2px; transition: var(--transition);
}
.tabs__btn:hover { color: var(--dark); }
.tabs__btn.is-active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.tabs__panel { display: none; padding: 1.8rem 0 2.5rem; line-height: 1.75; }
.tabs__panel.is-active { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Tabla de especificaciones */
.spec-table { width: 100%; max-width: 640px; border-collapse: collapse; }
.spec-table th, .spec-table td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--bg-alt); font-size: .95rem; }
.spec-table th { width: 42%; color: var(--gray); font-weight: 600; background: var(--bg-alt); }
.spec-table tr:nth-child(even) td { background: #fafafa; }

/* Aplicaciones */
.apps-list { display: flex; flex-wrap: wrap; gap: .8rem; }
.apps-list a {
  display: inline-block; border: 1px solid var(--gray-light); border-radius: 999px;
  padding: .5rem 1.3rem; font-weight: 600; font-size: .92rem; transition: var(--transition);
}
.apps-list a:hover { background: var(--accent); border-color: var(--accent); color: #111; }

/* Tabla de repuestos compatibles */
.parts-table { width: 100%; border-collapse: collapse; }
.parts-table th, .parts-table td { padding: .85rem 1rem; text-align: left; border-bottom: 1px solid var(--bg-alt); font-size: .93rem; vertical-align: middle; }
.parts-table thead th { background: var(--dark); color: #fff; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.parts-table tbody tr:hover { background: var(--bg-alt); }
.parts-table__oem { font-family: 'Courier New', monospace; font-weight: 700; color: var(--accent-dark); }
.parts-table small { display: block; color: var(--gray-light); font-size: .8rem; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 300; background: rgba(8,10,14,.92);
  display: grid; place-items: center; visibility: hidden; opacity: 0; transition: .25s ease;
}
.lightbox.open { visibility: visible; opacity: 1; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 8px; box-shadow: var(--shadow-lg); }
.lightbox__close {
  position: absolute; top: 1.2rem; right: 1.6rem; background: none; border: 0;
  color: #fff; font-size: 2.4rem; line-height: 1;
}

/* ---------- Not found ---------- */
.not-found { padding-bottom: 4rem; text-align: center; }
.not-found p { margin: 1rem 0 1.6rem; color: var(--gray); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .product-layout { grid-template-columns: 1fr; gap: 2rem; }
  .pinfo__meta { grid-template-columns: 1fr; }
  .parts-table { display: block; overflow-x: auto; }
}

/* ---------- Diagrama interactivo de partes (público) ---------- */
.diagram-view { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1.6rem; align-items: start; }
.diagram-view__canvas { position: relative; border: 1px solid var(--bg-alt); border-radius: var(--radius); overflow: hidden; background: #fafafa; }
.diagram-view__canvas img { width: 100%; display: block; }
.diagram-view .diagram-dot { position: absolute; transform: translate(-50%, -50%); width: 32px; height: 32px;
  border-radius: 50%; background: var(--accent); color: #111; font-weight: 800; font-size: .85rem;
  display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35);
  cursor: pointer; transition: var(--transition); }
.diagram-view .diagram-dot:hover { transform: translate(-50%, -50%) scale(1.2); }
.diagram-dot--pulse { animation: dotPulse .9s ease; }
@keyframes dotPulse { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.5); box-shadow: 0 0 0 10px rgba(245,158,11,.25); } }
.diagram-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #111; font-weight: 800; font-size: .8rem; }
.diagram-row { cursor: pointer; transition: background .3s; }
.diagram-row--highlight { background: #fef3c7 !important; }
@media (max-width: 900px) { .diagram-view { grid-template-columns: 1fr; } }
