/* ── Snovit Buscador Frontend — solo estilos estructurales, tipografía heredada del tema ── */

/* Filtros */
.snovit-filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
@media (max-width: 768px) { .snovit-filters { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .snovit-filters { grid-template-columns: 1fr; } }

.snovit-filter-group label { display: block; margin-bottom: 6px; }
.snovit-filter-group select {
  width: 100%; padding: 10px 14px;
  border: 1px solid #d1d5db; border-radius: 8px;
  background: #fff; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.snovit-filter-group select:disabled { opacity: .4; cursor: not-allowed; background-color: #f9fafb; }
.snovit-filter-group select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* Tipos de techo */
.snovit-roofs-title { margin-bottom: 14px; }
.snovit-roof-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 28px; }
@media (max-width: 768px) { .snovit-roof-grid { grid-template-columns: repeat(3, 1fr); } }

.snovit-roof-card {
  border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 8px;
  text-align: center; cursor: pointer; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.snovit-roof-card:hover:not(.snovit-disabled) { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.snovit-roof-card.snovit-disabled { opacity: .2; pointer-events: none; }
.snovit-roof-card.snovit-selected { border: 2px solid #2563eb; background: #eff6ff; }
.snovit-roof-card img { width: 90px !important; height: 60px !important; max-width: 90px !important; max-height: 60px !important; object-fit: contain !important; display: block; margin: 0 auto 8px; }
.snovit-roof-name { margin-bottom: 2px; }
.snovit-roof-desc { opacity: .7; }

/* Grupos de resultados */
.snovit-results-header { margin-bottom: 16px; opacity: .7; }
.snovit-grupo { border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; padding: 20px; margin-bottom: 16px; }
.snovit-grupo-title { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #f3f4f6; }

/* Layout Modular: fila selectors + fila bottom */
.snovit-modular-selectors { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 640px) { .snovit-modular-selectors { grid-template-columns: 1fr; } }

.snovit-sel-block { background: #e8edf2; border-radius: 8px; padding: 12px; border: 1px solid #d1d9e0; }
.snovit-sel-label { margin-bottom: 10px; opacity: .7; }

.snovit-modular-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-top: 16px; border-top: 1px solid #f3f4f6; }
@media (max-width: 640px) { .snovit-modular-bottom { grid-template-columns: 1fr; } }

/* Layout duo y single */
.snovit-grupo-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 640px) { .snovit-grupo-inner { grid-template-columns: 1fr; } }

/* Cards de selector (pies y barras) */
.snovit-img-grid-sm { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }

.snovit-img-card {
  border: 1.5px solid #e5e7eb; border-radius: 8px; padding: 12px 10px;
  text-align: center; cursor: pointer; background: #fff;
  transition: border-color .15s, box-shadow .15s; position: relative;
}
.snovit-img-card:hover { border-color: #93c5fd; box-shadow: 0 0 0 2px rgba(37,99,235,.08); }
.snovit-img-card.snovit-selected { border: 2px solid #2563eb; background: #eff6ff; }

.snovit-card-img-wrap { position: relative; width: 100%; height: 70px !important; display: flex !important; align-items: center !important; justify-content: center !important; margin-bottom: 8px; overflow: hidden; }
.snovit-card-img-wrap img { max-width: 100% !important; max-height: 70px !important; width: auto !important; height: auto !important; object-fit: contain !important; border-radius: 4px; }
.snovit-card-noimg { width: 100%; height: 70px; background: #f3f4f6; border-radius: 4px; display: flex; align-items: center; justify-content: center; padding: 4px; word-break: break-all; opacity: .5; }

.snovit-card-check {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px; background: #2563eb; color: #fff;
  border-radius: 50%; font-size: 10px; display: none;
  align-items: center; justify-content: center;
}
.snovit-img-card.snovit-selected .snovit-card-check { display: flex; }
.snovit-card-name { line-height: 1.3; }

/* Selectores dropdown (duo) */
.snovit-sel-row { margin-bottom: 10px; }
.snovit-sel-row label { display: block; margin-bottom: 4px; }
.snovit-sel-row select {
  width: 100%; padding: 8px 12px;
  border: 1px solid #d1d5db; border-radius: 8px;
  background: #fff; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}

/* Productos */
.snovit-prod-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border: 1px solid #e5e7eb;
  border-radius: 8px; background: #f9fafb; margin-bottom: 8px;
}
.snovit-prod-item input[type=checkbox] { width: 17px; height: 17px; flex-shrink: 0; cursor: pointer; accent-color: #2563eb; }
.snovit-prod-img { width: 72px !important; height: 56px !important; max-width: 72px !important; max-height: 56px !important; object-fit: contain !important; background: #fff; border-radius: 6px; padding: 3px; flex-shrink: 0; border: 1px solid #f3f4f6; }
.snovit-prod-info { flex: 1; min-width: 0; }
.snovit-prod-name { font-weight: 500; }
.snovit-prod-link { color: inherit; text-decoration: none; }
.snovit-prod-link:hover { text-decoration: underline; color: #2563eb; }
.snovit-prod-ref { opacity: .6; }
.snovit-prod-stock-ok  { color: #16a34a; }
.snovit-prod-stock-out { color: #dc2626; }
.snovit-prod-price { font-weight: 600; white-space: nowrap; }
.snovit-prod-price--discount { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.snovit-prod-price--discount .snovit-price-original { font-size: .82em; color: #9ca3af; text-decoration: line-through; font-weight: 400; }
.snovit-prod-price--discount .snovit-price-badge { display: inline-block; background: #1d4ed8; color: #fff; border-radius: 4px; padding: 1px 6px; font-size: .72em; font-weight: 700; letter-spacing: .02em; }
.snovit-vat-note { display: block; font-size: .72em; color: #6b7280; font-weight: 400; }
.snovit-prod-price--discount .snovit-price-final { color: #1d4ed8; font-size: 1.15em; font-weight: 700; }
.snovit-prod-notfound { opacity: .5; font-style: italic; }

/* Badge sin acero */
.snovit-badge-warn { padding: 2px 7px; border-radius: 10px; background: #fef3c7; color: #92400e; }

/* Total y carrito */
.snovit-total-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid #f3f4f6; }
.snovit-total-amt { font-size: 1.3em; font-weight: 700; }
.snovit-total-amt--discount { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.snovit-total-amt--discount .snovit-price-original { font-size: .75em; color: #9ca3af; text-decoration: line-through; font-weight: 400; }
.snovit-total-amt--discount .snovit-price-badge { background: #1d4ed8; color: #fff; border-radius: 4px; padding: 2px 7px; font-size: .75em; font-weight: 700; }
.snovit-total-final { color: #1d4ed8; font-size: 1.3em; font-weight: 700; }
.snovit-total-savings { width: 100%; text-align: right; font-size: .8em; color: #16a34a; font-weight: 600; }
.snovit-nota { opacity: .5; margin-top: 4px; }

.snovit-btn-cart {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 12px; padding: 11px 18px;
  background: #2563eb; color: #fff; border: none;
  border-radius: 8px; font-weight: 500; cursor: pointer; transition: background .15s;
}
.snovit-btn-cart:hover { background: #1d4ed8; }
.snovit-btn-cart:disabled { background: #93c5fd; cursor: not-allowed; }

/* Escena */
.snovit-scene {
  border: 1px solid #e5e7eb; border-radius: 10px;
  overflow: hidden; background: #f9fafb;
  min-height: 180px; display: flex; align-items: center; justify-content: center;
}
.snovit-scene img { width: 100% !important; height: auto !important; max-width: 100% !important; object-fit: cover !important; display: block !important; }
.snovit-scene-placeholder { text-align: center; padding: 24px; opacity: .3; }

/* Loading */
.snovit-loading { text-align: center; padding: 40px; opacity: .5; }
.snovit-spinner {
  display: inline-block; width: 24px; height: 24px;
  border: 2px solid #e5e7eb; border-top-color: #2563eb;
  border-radius: 50%; animation: sn-spin .6s linear infinite; margin-bottom: 8px;
}
@keyframes sn-spin { to { transform: rotate(360deg); } }

/* ── Zoom cursor en imagen de producto ── */
.snovit-zoomable { cursor: zoom-in; transition: opacity .15s; }
.snovit-zoomable:hover { opacity: .85; }

/* ── Lightbox ── */
#snovit-lightbox {
  display: none;
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(0,0,0,.82);
  align-items: center; justify-content: center;
}
#snovit-lightbox.snovit-lightbox-open { display: flex; }
#snovit-lightbox-inner {
  position: relative;
  max-width: 90vw; max-height: 90vh;
  display: flex; align-items: center; justify-content: center;
}
#snovit-lightbox-img {
  max-width: 90vw; max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
#snovit-lightbox-close {
  position: absolute; top: -14px; right: -14px;
  width: 32px; height: 32px;
  border-radius: 50%; border: none;
  background: #fff; color: #111;
  font-size: 16px; line-height: 1;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center;
}
#snovit-lightbox-close:hover { background: #f3f4f6; }

/* ── Producto opcional (llaves) ── */
.snovit-optional-divider { display: flex; align-items: center; gap: 10px; padding: 8px 0 2px; color: var(--color-text-secondary, #9ca3af); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.snovit-optional-divider::before, .snovit-optional-divider::after { content: ''; flex: 1; height: 1px; background: #f3f4f6; }
.snovit-prod-optional { border: 1px dashed #f59e0b !important; background: #fffbeb !important; }
.snovit-prod-optional:has(input:not(:checked)) { opacity: .7; }
.snovit-optional-badge { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; font-size: .7em; font-weight: 700; color: #92400e; background: #fde68a; border: 0.5px solid #f59e0b; border-radius: 4px; padding: 1px 6px; vertical-align: middle; }
