/* ==========================================================================
   SCHEMA CASSONETTO — Componente Dinamico Misure, Finiture, Legenda e Lightbox
   Mandato ARANCIONE-85.BU (07/10/2026)
   ========================================================================== */

.schema-cassonetto-card {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-sizing: border-box;
}

/* Header Schema con Pillola Finitura */
.schema-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.schema-header-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0;
  letter-spacing: -0.3px;
}

.finitura-pillola-header {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #24324a;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  transition: all 0.2s ease;
}

/* Contenitore SVG Inline */
.schema-svg-wrap {
  width: 100%;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.schema-svg-wrap svg {
  width: 100%;
  max-width: 540px;
  height: auto;
  display: block;
}

/* Sezioni Interne */
.cass-section-title {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 0.5rem;
}

/* Finiture Disponibili (4 Campioni) */
.finiture-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
}

.finitura-btn {
  background: #ffffff;
  border: 1px solid #dbe2ea;
  border-radius: 12px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.finitura-btn:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.finitura-btn.active,
.finitura-btn[aria-pressed="true"] {
  border: 2px solid #24324a;
  background: #f1f5f9;
  box-shadow: 0 2px 6px rgba(36, 50, 74, 0.15);
}

.finitura-btn img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  display: block;
}

.finitura-btn span {
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  text-align: center;
  line-height: 1.2;
}

.finitura-btn.active span,
.finitura-btn[aria-pressed="true"] span {
  color: #0f172a;
  font-weight: 800;
}

/* Legenda Misure L·H·P·A·B */
.schema-legenda-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legenda-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.82rem; /* 13.12px >= 12.8px */
  line-height: 1.38;
  color: #334155;
}

.legenda-badge {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.legenda-badge-L { background-color: #1d5fd1; }
.legenda-badge-H { background-color: #c2410c; }
.legenda-badge-P { background-color: #7c3aed; }
.legenda-badge-A { background-color: #047857; }
.legenda-badge-B { background-color: #0e7490; }

.legenda-text strong {
  color: #0f172a;
}

/* Griglia Foto con Lightbox */
.foto-gallery-wrap {
  width: 100%;
}

.foto-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
}

.cass-foto-btn {
  background: #ffffff;
  border: 1px solid #dbe2ea;
  border-radius: 12px;
  padding: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  aspect-ratio: 1 / 1;
  width: 100%;
  box-sizing: border-box;
}

.cass-foto-btn:hover,
.cass-foto-btn:focus-visible {
  border-color: #0284c7;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.cass-foto-btn img {
  width: 84px;
  height: 84px;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

/* Lightbox Modal */
.cass-lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.92);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cass-lightbox-overlay.open {
  display: flex;
  opacity: 1;
}

.cass-lightbox-dialog {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  outline: none;
}

.cass-lightbox-img-wrap {
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cass-lightbox-img-wrap img {
  max-width: 90vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.cass-lightbox-caption {
  margin-top: 12px;
  color: #f1f5f9;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

.cass-lightbox-close {
  position: absolute;
  top: -44px;
  right: 0;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.cass-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.cass-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  color: #ffffff;
  font-size: 26px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}

.cass-lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.4);
}

.cass-lightbox-prev {
  left: -54px;
}

.cass-lightbox-next {
  right: -54px;
}

/* Modulo Etichette Coordinate con lo Schema */
.label-quota-L { color: #1d5fd1 !important; font-weight: 700 !important; }
.label-quota-H { color: #c2410c !important; font-weight: 700 !important; }
.label-quota-P { color: #7c3aed !important; font-weight: 700 !important; }
.label-quota-A { color: #047857 !important; font-weight: 700 !important; }
.label-quota-B { color: #0e7490 !important; font-weight: 700 !important; }

/* Responsive Mobile (390px) */
@media (max-width: 640px) {
  .schema-cassonetto-card {
    gap: 1rem;
  }

  .finitura-btn img {
    width: 56px;
    height: 56px;
  }

  .finitura-btn span {
    font-size: 10px;
  }

  .cass-foto-btn img {
    width: 64px;
    height: 64px;
  }

  .legenda-item {
    font-size: 0.78rem; /* 12.48px >= 12px */
  }

  .cass-lightbox-prev {
    left: 8px;
  }

  .cass-lightbox-next {
    right: 8px;
  }

  .cass-lightbox-close {
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.5);
  }
}
