/* Models Browser — V12.18-ui (buttons unified hover fix) — 2025-09-28 */
/* Patch V12.28.3-ui — 2025-10-18: viewer corner fix + descrição full-width + specs cantos limpos */
/* Patch V12.28.4-ui — 2025-10-18: menu models — hover com fundo azul suave + ativo com ligeiro sombreado */
/* Patch V12.28.5-ui — 2025-10-18: contraste — manter texto escuro em hover/ativo */

/* ====== Layout base ====== */
.tnd-models { display: grid; gap: 24px; color:#111827; }
.tnd-panel { display: grid; gap: 8px; }
.tnd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 992px){ .tnd-grid { grid-template-columns: 1fr; } }

/* Columns */
.tnd-col-6 { display: grid; gap: 0; }

/* ====== Headings & ritmo vertical ====== */
.tnd-h2 { font-size: 1.25rem; font-weight: 700; margin: 0 0 8px; color:#1f2937; }
.tnd-h3 { font-size: 1.1rem;  font-weight: 600; margin: 24px 0 8px; color:#1f2937; }

/* Sections: espaço consistente antes do próximo heading */
[data-role="viewer"],
[data-role="description"],
[data-role="specs"],
[data-role="options"],
[data-role="parts"] { margin-bottom: 18px; }

/* ====== Grid spans (largura consistente) ====== */
.tnd-grid > [data-role="viewer"],
.tnd-grid > [data-role="description"]{
  grid-column: 1 / -1;
}

/* ====== Forçar descrição full-width (ignorar max-width do tema) ====== */
.tnd-models [data-role="description"],
.tnd-models .tnd-description{
  width: 100% !important;
  max-width: none !important;
  justify-self: stretch;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
.tnd-models .tnd-description p,
.tnd-models [data-role="description"] p{
  max-width: none !important;
}

/* Placeholders / loading */
.tnd-placeholder { color:#6b7280; }
.tnd-loading { opacity:.9; }

/* ====== Ranges & Models (chips) ====== */
.tnd-ranges, .tnd-models-list { display:flex; flex-wrap:wrap; gap:8px; }

.tnd-btn{
  display:inline-flex; align-items:center; gap:6px;
  padding:8px 12px; border:1px solid #e5e7eb; background:#fff; color:#111827;
  border-radius:999px; cursor:pointer; text-decoration:none; line-height:1.1;
}
/* hover: linha azul #3399ff + fundo azul suave + garantir texto escuro */
.tnd-btn:hover{
  border-color:#3399ff;
  background:#eaf4ff;
  color:#111827;
}
/* ativo: borda escura + fundo discreto + sombra leve + garantir texto escuro */
.tnd-btn.tnd-active{
  border-color:#111827;
  background:#f7fbff;
  color:#111827;
  box-shadow:0 1px 2px rgba(0,0,0,.06), 0 2px 6px rgba(0,0,0,.07);
}

.tnd-chip{
  display:inline-flex; align-items:baseline; gap:6px;
  padding:10px 14px; border:1px solid #e5e7eb; background:#fff; color:#111827;
  border-radius:12px; cursor:pointer; text-decoration:none;
}
/* hover: linha azul #3399ff + fundo azul suave + garantir texto escuro */
.tnd-chip:hover{
  border-color:#3399ff;
  background:#eaf4ff;
  color:#111827;
}
/* ativo: borda escura + fundo discreto + sombra leve + garantir texto escuro */
.tnd-chip.tnd-active{
  border-color:#111827;
  background:#f7fbff;
  color:#111827;
  box-shadow:0 1px 2px rgba(0,0,0,.06), 0 2px 6px rgba(0,0,0,.07);
}

.tnd-chip-title{ font-weight:600; }
.tnd-chip-sub{ font-size:12px; opacity:.75; }

/* ====== Viewer & Specs ====== */
.tnd-viewer, .tnd-specs {
  border:1px solid #e5e7eb; border-radius:12px; background:#f9fafb;
}

/* Viewer corner fix: raio só no pai, recorte e sem raio no iframe/wrapper */
.tnd-viewer{
  margin-bottom: 24px !important;
  padding: 0 !important;
  overflow: hidden;                 /* recorta o iframe nos cantos */
}
.tnd-viewer .sketchfab-embed-wrapper{
  border-radius: inherit;
  overflow: hidden;
}
.tnd-viewer iframe{
  display:block;
  width:100%;
  height:420px;
  border:0;
  margin:0 !important;
  padding:0 !important;
  border-radius: 0;                 /* evita “duplo raio” e serrilhado */
  background: transparent;          /* deixa ver o bg do pai */
}
.tnd-viewer .sketchfab-embed-wrapper > p { display:none !important; }

/* Cantos limpos no bloco de Specs */
.tnd-specs{ overflow: hidden; }
.tnd-specs table{ width:100%; border-collapse: collapse; }
.tnd-specs th, .tnd-specs td { padding:8px 10px; border-bottom:1px solid #e5e7eb; text-align:left; vertical-align:top; }
.tnd-specs th { width:45%; font-weight:600; color:#111827; }

/* Embed normalizado (caso use .tnd-embed noutros lugares) */
.tnd-embed{ background:#fff; border-radius:8px; }
.tnd-embed iframe, .tnd-embed model-viewer{ width:100%; height:420px; border:none; border-radius:8px; }

/* Botões padrão (primários unificados) */
.tnd-btn-primary,
.tnd-btn-primary:visited {
  background:#1f2937;
  color:#fff;
  border-color:#1f2937;
  transition: background-color .2s, color .2s;
}
.tnd-btn-primary:hover,
.tnd-btn-primary:focus {
  background:#3399ff;
  border-color:#3399ff;
  color:#fff;
  text-decoration:none;
}

.tnd-specs-actions{
  margin-top:16px; margin-bottom:24px;
  display:flex; gap:12px; flex-wrap:wrap; align-items:center;
}

/* ====== Description ====== */
.tnd-description{
  border:1px solid #e5e7eb; border-radius:12px; padding:16px; background:#fff;
  width:100%;
}
.tnd-description .tnd-placeholder{
  color:#6b7280;
  font-size:1rem;
  line-height:1.5;
  margin:0;
}

/* ====== Cards (Options & Parts) ====== */
.tnd-card{
  border:1px solid #e5e7eb; border-radius:12px; overflow:hidden; background:#fff; margin-bottom:14px;
}
.tnd-card-head{
  padding:10px 14px; font-weight:600; background:#f3f4f6; border-bottom:1px solid #e5e7eb;
}
.tnd-card-body{ display:grid; }
.tnd-card-row{
  display:grid; grid-template-columns: 64px 1fr auto; gap:12px; align-items:center;
  padding:12px 14px; border-bottom:1px solid #f1f5f9;
}
.tnd-card-row:last-child{ border-bottom:none; }

.tnd-card-img{
  width:64px; height:48px;
  aspect-ratio: 4 / 3;
  border-radius:8px; overflow:hidden; background:#f8fafc; border:1px solid #eef2f7;
}
.tnd-card-img img{
  width:100%; height:100%; display:block; object-fit:cover;
}

.tnd-card-main .tnd-card-title{ font-weight:600; color:#111827; }
.tnd-card-main .tnd-card-title:hover{ text-decoration:underline; }
.tnd-card-main .tnd-card-sub{ font-size:12px; color:#6b7280; }

.tnd-card-price{ white-space:nowrap; font-weight:600; color:#111827; }

@media (max-width: 640px){
  .tnd-card-row{ grid-template-columns: 48px 1fr auto; }
  .tnd-card-img{ width:48px; height:40px; }
}

/* ====== Modal (Specs Download) ====== */
.tnd-modal[hidden]{ display:none; }
.tnd-modal{ position:fixed; inset:0; z-index:1000; }
.tnd-modal-backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.45); }
.tnd-modal-dialog{
  position:relative; z-index:1; max-width:560px; margin:10vh auto; background:#fff;
  border-radius:12px; padding:24px; box-shadow:0 20px 60px rgba(0,0,0,.25);
}
.tnd-modal-close{
  position:absolute; top:10px; right:10px; border:0; background:#eef2f5; width:32px; height:32px;
  border-radius:8px; font-size:18px; line-height:32px; cursor:pointer;
}
#tnd-specs-form .tnd-form-row{ margin-bottom:12px; }
#tnd-specs-form input[type="text"],
#tnd-specs-form input[type="email"],
#tnd-specs-form input[type="tel"],
#tnd-specs-form textarea{
  width:100%; padding:10px 12px; border:1px solid #d5d8dc; border-radius:8px;
}
#tnd-specs-form .tnd-modal-footer{ margin-top:12px; display:flex; gap:12px; align-items:center; }
.tnd-form-feedback{ margin-top:8px; font-size:.95em; }

/* ====== Gallery (fim da página) ====== */
.tnd-gallery-panel{ margin-top:32px; }
.tnd-gallery{
  position:relative; border-radius:12px; overflow:hidden; background:#f7f7f7;
}
.tnd-gallery-track{
  display:flex; gap:8px;
  overflow-x:auto; scroll-snap-type:x mandatory; scroll-behavior:smooth;
}
.tnd-gallery-item{
  flex:0 0 100%;
  scroll-snap-align:center;
  position:relative;
  aspect-ratio:16/9;
  background:#eee;
}
@media (max-width: 768px){
  .tnd-gallery-item{ aspect-ratio:4/3; }
}
.tnd-gallery-item img{
  display:block; width:100%; height:100%; object-fit:cover;
}

/* Navegação (setas) */
.tnd-gallery-nav{
  position:absolute; inset:0;
  display:flex; justify-content:space-between; align-items:center;
  pointer-events:none; z-index:2; padding:0 8px;
}
.tnd-gallery-nav button{
  pointer-events:auto; cursor:pointer; border:0;
  width:40px; height:40px; padding:0;
  border-radius:999px;
  display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,.5); color:#fff;
}
@media (hover:hover){
  .tnd-gallery-nav button:hover{ background:rgba(0,0,0,.65); }
}
.tnd-gallery-nav button:focus-visible{
  outline:2px solid #3399ff; outline-offset:2px;
}

/* Dots */
.tnd-gallery-dots{ display:flex; justify-content:center; gap:6px; margin-top:8px; }
.tnd-gallery-dots button{
  width:8px; height:8px; border-radius:999px; border:0; background:#cbd5e1; opacity:.8; cursor:pointer;
}
.tnd-gallery-dots button[aria-current="true"]{ opacity:1; background:#334155; }

/* Esconder setas/dots quando só houver 1 imagem */
.tnd-gallery:has(.tnd-gallery-track > .tnd-gallery-item:only-child) .tnd-gallery-nav{ display:none; }
.tnd-gallery:has(.tnd-gallery-track > .tnd-gallery-item:only-child) + .tnd-gallery-dots{ display:none; }
.tnd-gallery.is-single .tnd-gallery-nav{ display:none; }
.tnd-gallery.is-single + .tnd-gallery-dots{ display:none; }

/* ====== Utility chips ====== */
.tnd-pill{
  display:inline-block;
  padding:2px 8px;
  border-radius:999px;
  background:#111827;
  color:#fff;
  font-size:12px;
  line-height:1.2;
  white-space:nowrap;
}
.tnd-qty{ opacity:.9; font-weight:600; }
