/* ================================================
   TECMAX – producto.css
   ================================================ */

/* ===== MIGAS DE PAN ===== */
.breadcrumb-bar {
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  padding: 10px 0;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #888;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--azul-btn); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span:last-child { color: #333; font-weight: 500; }

/* ===== LAYOUT PRINCIPAL ===== */
.producto-main {
  background: #fff;
  padding: 36px 0 48px;
}
.producto-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

/* ===== GALERÍA ===== */
.producto-gallery { position: sticky; top: 100px; }

.gallery-main {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  height: 380px;
  overflow: hidden;
  margin-bottom: 12px;
}
.gallery-main img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform .3s ease;
}
.gallery-main img:hover { transform: scale(1.05); }

.gallery-thumbs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.gallery-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  border: 2px solid #e5e7eb;
  padding: 6px;
  background: #fff;
  cursor: pointer;
  object-fit: contain;
  transition: border-color .2s, transform .2s;
}
.gallery-thumb:hover { border-color: var(--azul-btn); transform: scale(1.05); }
.gallery-thumb.active { border-color: var(--azul-btn); box-shadow: 0 0 0 3px rgba(4,92,180,.15); }

/* ===== INFO ===== */
.producto-info { display: flex; flex-direction: column; gap: 16px; }

.producto-cats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cat-badge {
  background: #eef2ff;
  color: var(--azul-btn);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 50px;
  border: 1px solid #c7d4f7;
}

.producto-title {
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 700;
  color: #111;
  line-height: 1.35;
}

.producto-price {
  font-size: 36px;
  font-weight: 900;
  color: var(--azul-medio);
  line-height: 1;
}

.producto-desc {
  background: #f9fafb;
  border-left: 4px solid var(--azul-btn);
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.8;
  color: #444;
  white-space: pre-line;
}

/* ===== BOTONES WA ===== */
.wa-chats {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.wa-chat-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-radius: 12px;
  text-decoration: none;
  transition: transform .18s, box-shadow .18s;
  border: 1.5px solid transparent;
}
.wa-chat-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.14); }

.wa-chat-btn--soporte {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}
.wa-chat-btn--ventas {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e40af;
}

.wa-chat-btn svg { flex-shrink: 0; }
.wa-chat-btn--soporte svg { color: #16a34a; }
.wa-chat-btn--ventas svg { color: #2563eb; }

.wa-chat-text { display: flex; flex-direction: column; }
.wa-chat-text strong { font-size: 14px; font-weight: 700; }
.wa-chat-text span { font-size: 12px; opacity: .75; }

/* ===== BOTÓN AÑADIR AL CARRITO ===== */
.btn-add-cart-detail {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  background: var(--azul-btn);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border-radius: 10px;
  letter-spacing: .4px;
  transition: background .2s, transform .2s;
  border: none;
  cursor: pointer;
}
.btn-add-cart-detail:hover { background: var(--azul-oscuro); transform: translateY(-2px); }
.btn-add-cart-detail:active { transform: translateY(0); }

/* ===== TABS ===== */
.producto-tabs {
  margin-top: 48px;
  border-top: 2px solid #e5e7eb;
  padding-top: 0;
}
.tabs-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 28px;
}
.tab-btn {
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  color: #888;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color .2s, border-color .2s;
}
.tab-btn:hover { color: var(--azul-btn); }
.tab-btn.active { color: var(--azul-btn); border-bottom-color: var(--azul-btn); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.tab-content {
  font-size: 15px;
  line-height: 1.85;
  color: #444;
  white-space: pre-line;
  max-width: 720px;
}
.tab-content p { margin-bottom: 8px; }
.tab-content strong { color: #333; }

/* ===== PRODUCTOS RELACIONADOS ===== */
.related-section {
  background: var(--azul-btn);
  padding: 48px 0 56px;
}
.related-title {
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 28px;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* ===== RESPONSIVE ===== */

/* Tablet */
@media (max-width: 900px) {
  .producto-layout { grid-template-columns: 1fr; gap: 28px; }
  .producto-gallery { position: static; }
  .gallery-main { height: 300px; }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Móvil landscape / tablet pequeña */
@media (max-width: 768px) {
  .producto-main { padding: 24px 0 36px; }
  .gallery-main { height: 260px; padding: 16px; }
  .gallery-thumb { width: 60px; height: 60px; padding: 4px; }

  .producto-title { font-size: clamp(16px, 4.5vw, 22px); }
  .producto-price { font-size: 30px; }

  /* Tabs — scroll horizontal en móvil */
  .tabs-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .tabs-nav::-webkit-scrollbar { display: none; }
  .tab-btn { padding: 12px 18px; font-size: 14px; white-space: nowrap; flex-shrink: 0; }

  .related-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .related-title { font-size: 22px; }
  .related-section { padding: 36px 0 44px; }
}

/* Móvil portrait pequeño */
@media (max-width: 480px) {
  .producto-main { padding: 16px 0 28px; }

  /* Galería compacta */
  .gallery-main { height: 220px; padding: 12px; border-radius: 12px; }
  .gallery-main img:hover { transform: none; } /* sin zoom en táctil */
  .gallery-thumbs { gap: 7px; }
  .gallery-thumb { width: 52px; height: 52px; padding: 4px; border-radius: 8px; }

  /* Info */
  .producto-title { font-size: clamp(15px, 4.8vw, 20px); }
  .producto-price { font-size: 26px; }
  .producto-desc { padding: 12px 14px; font-size: 13px; }
  .cat-badge { font-size: 11px; padding: 3px 10px; }

  /* Botones WA — columna y compactos */
  .wa-chat-btn { padding: 10px 14px; gap: 10px; border-radius: 10px; }
  .wa-chat-text strong { font-size: 13px; }
  .wa-chat-text span { font-size: 11px; }

  /* Botón añadir carrito */
  .btn-add-cart-detail { padding: 14px; font-size: 15px; border-radius: 9px; }

  /* Tabs */
  .tabs-nav { margin-bottom: 0; }
  .tab-btn { padding: 10px 14px; font-size: 13px; }
  .tab-content { font-size: 14px; }
  .producto-tabs { margin-top: 32px; }

  /* Productos relacionados */
  .related-section { padding: 28px 0 36px; }
  .related-title { font-size: 20px; margin-bottom: 18px; }
  .related-grid { grid-template-columns: 1fr 1fr; gap: 8px; }

  /* Cards relacionados compactos */
  .related-grid .product-card__img { height: 110px; }
  .related-grid .product-card__body { padding: 10px; }
  .related-grid .product-card h3 a { font-size: 12px; }
  .related-grid .product-price { font-size: 13px; }
  .related-grid .btn-add-cart { font-size: 11px; padding: 7px 6px; gap: 3px; }
  .related-grid .btn-add-cart svg { display: none; }
}

/* ================================================
   PRODUCT EDITOR – Estilos de edición inline
   ================================================ */

/* ── Galería: wrapper de cada miniatura ── */
.gallery-thumb-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

/* ── Botón ✕ eliminar foto ── */
.gallery-thumb-del {
  display: none;
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  border: 2px solid #fff;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  z-index: 10;
  line-height: 1;
  transition: background .18s, transform .15s;
  box-shadow: 0 2px 5px rgba(0,0,0,.25);
}
.gallery-thumb-wrap:hover .gallery-thumb-del { display: flex; }
.gallery-thumb-del:hover { background: #b91c1c; transform: scale(1.15); }

/* ── Botón + añadir foto ── */
.gallery-thumb-add-wrap { position: relative; }
.gallery-thumb-add {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  border: 2px dashed #a0b4cc;
  background: #f0f6ff;
  color: var(--azul-btn);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .18s, border-color .18s;
}
.gallery-thumb-add:hover { background: #dbeafe; border-color: var(--azul-btn); }

/* ── Botón + mientras lee el archivo ── */
.gallery-thumb-add-wrap.pe-uploading .gallery-thumb-add {
  pointer-events: none;
  opacity: .5;
}

/* ── Indicador hover "editable" en modo admin ── */
.mode-admin #productoTitle,
.mode-admin #productoPrice,
.mode-admin #productoDesc,
.mode-admin #tabDescContent,
.mode-admin #addInfoGarantia,
.mode-admin #addInfoEnvio,
.mode-admin #addInfoSoporte {
  cursor: pointer;
  border-radius: 6px;
  transition: outline .15s;
  outline: 2px dashed transparent;
}
.mode-admin #productoTitle:hover,
.mode-admin #productoPrice:hover,
.mode-admin #productoDesc:hover,
.mode-admin #tabDescContent:hover,
.mode-admin #addInfoGarantia:hover,
.mode-admin #addInfoEnvio:hover,
.mode-admin #addInfoSoporte:hover {
  outline: 2px dashed rgba(4,92,180,.4);
  background: rgba(4,92,180,.03);
}

/* ── Estado "editando" ── */
.pe-editing {
  outline: 2px solid var(--azul-btn) !important;
  background: #f0f6ff !important;
  border-radius: 6px;
  padding: 4px 6px;
  min-height: 28px;
}

/* ── Input precio inline ── */
.pe-price-input {
  border: none;
  outline: none;
  background: transparent;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  font-family: inherit;
  width: 140px;
}

/* ── Toast ── */
@keyframes peToastIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.pe-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 9999;
  animation: peToastIn .22s ease;
  transition: opacity .35s;
  pointer-events: none;
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 480px) {
  .gallery-thumb-add { width: 52px; height: 52px; }
  .pe-add-photo-pop  { width: 200px; font-size: 0.75rem; }
}
