/* PROPOSTA C — SMART CATALOG MOBILE FIRST (Adendo 01) */
:root {
  --bar-color: #003F69;
  --blue-deep: #003F69;
  --blue-head: #005481;
  --blue-action: #006B9F;
  --blue-soft: #99CFE6;
  --blue-tint: #E8F4FA;
  --bg-page: #F4F7FA;
  --surface: #FFFFFF;
  --text-main: #102336;
  --text-muted: #4E6478;
  --border: #D5E3EC;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0, 63, 105, 0.06);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.45;
  overflow-x: clip;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

/* Barra de demonstração (cor dinâmica + seletor C1/C2 exclusivo do protótipo) */
.demo-color-bar {
  background: #0B1927;
  color: #E8F4FA;
  font-size: 0.78rem;
  padding: 8px 12px;
}
.demo-color-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.demo-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.swatch-btn {
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.08);
  color: #fff;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}
.swatch-btn.active { background: #fff; color: #0B1927; }
.swatch-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.back-portal-link { color: var(--blue-soft); text-decoration: none; font-weight: 600; }

/* Cabeçalho dinâmico */
.site-header {
  background: var(--bar-color);
  color: #fff;
  padding: 12px 14px;
}
.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.header-top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  min-height: 44px;
}
.brand-link img {
  height: 34px;
  width: auto;
  background: #fff;
  padding: 3px 6px;
  border-radius: 4px;
}
.brand-title { font-weight: 700; font-size: 1rem; }
.brand-sub { font-size: 0.74rem; opacity: 0.88; }
.header-nav { display: flex; gap: 6px; }
.header-nav a {
  color: #fff;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 4px;
  background: rgba(255,255,255,0.16);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.main-container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 12px 44px;
  overflow-x: hidden;
}
.panel-box, .search-box, .mode-switch-box { width: 100%; max-width: 100%; min-width: 0; }
.page-head { margin-bottom: 14px; max-width: 100%; }
.page-title, .breadcrumb { overflow-wrap: anywhere; }
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.breadcrumb a { color: var(--blue-action); text-decoration: none; font-weight: 600; }
.page-title { margin: 0 0 4px; font-size: 1.25rem; font-weight: 700; color: var(--blue-deep); }
.page-subtitle { margin: 0; font-size: 0.88rem; color: var(--text-muted); }

/* Pesquisa compacta Mobile First */
.search-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.search-form { display: flex; flex-direction: column; gap: 8px; }
.search-row { display: flex; flex-wrap: wrap; gap: 8px; }
.search-row .form-control { width: auto; flex: 1 1 100px; min-width: 0; }
.form-control {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-main);
  background: #fff;
}
.btn-search {
  min-height: 44px;
  padding: 0 16px;
  background: var(--blue-action);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* Seletor de Demonstração C1 vs C2 */
.mode-switch-box {
  background: var(--blue-tint);
  border: 1px solid var(--blue-soft);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mode-switch-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--blue-deep);
}
.mode-switch-btns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}
.mode-btn {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--blue-action);
  background: #fff;
  color: var(--blue-deep);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.mode-btn.active {
  background: var(--blue-deep);
  color: #fff;
  border-color: var(--blue-deep);
}

/* Toolbar */
.toolbar-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.btn-tool {
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--blue-deep);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.btn-tool.active {
  background: var(--blue-action);
  color: #fff;
  border-color: var(--blue-action);
}

/* Grids Mobile First (align-items: start evita esticar cards vizinhos no C1!) */
.catalog-grid, .category-grid, .product-grid, .detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.catalog-grid > *, .category-grid > *, .product-grid > *, .detail-grid > *, .mode-switch-btns > * {
  min-width: 0;
}

/* Catálogos & Categorias */
.catalog-card, .category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  min-height: 92px;
}
.catalog-thumb, .category-thumb {
  width: 74px;
  height: 74px;
  border-radius: 8px;
  background: #F4F7FA;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  flex-shrink: 0;
}
.catalog-thumb img, .category-thumb img { max-height: 100%; object-fit: contain; }
.catalog-info h3, .category-info h3 { margin: 0 0 3px; font-size: 1rem; color: var(--blue-deep); }
.catalog-info p, .category-info span { margin: 0; font-size: 0.82rem; color: var(--text-muted); }
.catalog-pill {
  display: inline-block;
  margin-top: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  color: #fff;
}

/* Cards Compactos da Proposta C */
.smart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.smart-card-link {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 8px;
}
.smart-card-link:hover .smart-title { color: var(--blue-action); }
.smart-photo-frame {
  height: 185px;
  background: #F7FAFC;
  border: 1px solid #E2ECF3;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}
.smart-photo-frame img { max-height: 100%; max-width: 100%; object-fit: contain; }
.smart-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.smart-code {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--blue-head);
  background: var(--blue-tint);
  padding: 3px 8px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.smart-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

/* Botão Dados Técnicos (fora do <a> do produto para evitar conflito de clique) */
.smart-card-actions {
  padding: 0 12px 12px;
}
.btn-tech-toggle {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  background: var(--blue-tint);
  color: var(--blue-deep);
  border: 1px solid var(--blue-soft);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s, color 0.15s;
}
.btn-tech-toggle:hover,
.btn-tech-toggle[aria-expanded="true"] {
  background: var(--blue-head);
  color: #FFFFFF;
  border-color: var(--blue-head);
}
.btn-tech-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-tech-arrow {
  transition: transform 0.2s;
  font-size: 0.9rem;
}
.btn-tech-toggle[aria-expanded="true"] .btn-tech-arrow {
  transform: rotate(180deg);
}

/* Painel expansível C1 */
.card-collapse-panel {
  border-top: 1px solid var(--border);
  background: #fff;
}
.card-collapse-panel[hidden] { display: none; }

/* Tabela técnica dentro do C1, C2 e Produto */
.tech-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tech-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}
.tech-table th, .tech-table td {
  padding: 5px 6px;
  border: 1px solid var(--border);
}
.tech-table th {
  background: var(--blue-deep);
  color: #fff;
  font-weight: 600;
  text-align: left;
  white-space: normal;
  word-break: break-word;
}
.tech-table td {
  background: #fff;
  color: var(--text-main);
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}
.tech-table tr:nth-child(even) th { background: var(--blue-head); }
.tech-table tr:nth-child(even) td { background: var(--blue-tint); }

/* Modal C2 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 25, 39, 0.6);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.modal-backdrop[hidden] { display: none; }
.modal-dialog {
  background: #fff;
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  border-radius: 12px 12px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.2);
}
.modal-header {
  background: var(--blue-deep);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modal-header h3 { margin: 0; font-size: 0.96rem; line-height: 1.35; }
.modal-header span { font-size: 0.78rem; color: var(--blue-soft); font-weight: 600; }
.modal-close {
  background: rgba(255,255,255,0.16);
  color: #fff;
  border: none;
  border-radius: 6px;
  min-width: 40px;
  min-height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
}
.modal-body {
  padding: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Detalhamento do Produto (Tela 04) */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.panel-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.panel-box h2, .panel-box h3 {
  margin: 0 0 12px;
  font-size: 1.02rem;
  color: var(--blue-deep);
}
.gallery-main {
  height: 250px;
  background: #F7FAFC;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.gallery-main img { max-height: 100%; object-fit: contain; }

/* Tratamento das tabelas HTML importadas */
.imported-tables-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.imported-tables-wrap table {
  width: 100% !important;
  border-collapse: collapse !important;
  border: 0 !important;
  font-size: 0.78rem !important;
  font-variant-numeric: tabular-nums;
}
.imported-tables-wrap td {
  width: auto !important;
  padding: 7px 9px !important;
  border: 1px solid var(--border) !important;
  white-space: nowrap;
  text-align: right;
  color: var(--text-main);
}
.imported-tables-wrap td br { display: none; }
.imported-tables-wrap tr[bgcolor="#6699ff"] td {
  background-color: var(--blue-deep) !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
}
.imported-tables-wrap tr[bgcolor="#66b3ff"] td {
  background-color: var(--blue-tint) !important;
}
.imported-tables-wrap tr:not([bgcolor="#6699ff"]):not([bgcolor="#66b3ff"]) td {
  background-color: #FFFFFF !important;
}
.imported-tables-wrap td:first-child {
  text-align: left !important;
  font-weight: 600;
  position: sticky;
  left: 0;
  z-index: 1;
}
.imported-tables-wrap table:nth-of-type(2) { display: none; }

.site-footer {
  background: var(--bar-color);
  color: #fff;
  padding: 18px 14px;
  margin-top: 28px;
  text-align: center;
  font-size: 0.82rem;
}

@media (min-width: 600px) {
  .catalog-grid { grid-template-columns: repeat(2, 1fr); }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal-dialog { border-radius: 10px; }
}
@media (min-width: 768px) {
  .main-container { padding: 20px 20px 48px; }
  .header-inner { flex-direction: row; align-items: center; justify-content: space-between; }
  .search-form { flex-direction: row; }
  .mode-switch-box { flex-direction: row; align-items: center; justify-content: space-between; }
  .mode-switch-btns { width: auto; }
  .detail-grid { grid-template-columns: 380px 1fr; align-items: start; }
}
@media (min-width: 1024px) {
  .catalog-grid { grid-template-columns: repeat(3, 1fr); }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1366px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); }
}
