/* Fliesenplaner — estilo alinhado à paleta hparts multimarcas (azul #145AE2 / dourado #FFC50D) */

#fpWrap, #fpWrap * { box-sizing: border-box; }

#fpWrap {
  --fp-brand: #145AE2;
  --fp-brand-dark: #0F45B3;
  --fp-gold: #FFC50D;
  --fp-border: #d8dbe0;
  --fp-ink: #1f2430;
  --fp-muted: #6b7280;
  --fp-ok: #1a8a4a;

  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  font-family: "Poppins", "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--fp-ink);
  max-width: 1100px;
  margin: 0 auto;
}
@media (max-width: 880px) {
  #fpWrap { grid-template-columns: 1fr; }
}

/* ---------- Pré-visualização ---------- */
.fp-preview { position: relative; }

/* O "palco": fundo neutro que enquadra o pavimento e faz o espaço à volta
   parecer intencional, em vez de a grelha ficar encostada a um canto. */
.fp-stage {
  background: #e8eaed;
  background-image:
    linear-gradient(135deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,0) 55%);
  border: 1px solid #dcdfe3;
  border-radius: 12px;
  padding: 46px 26px 26px 52px;   /* espaço para as cotas em cima e à esquerda */
  display: flex;
  align-items: center;
  justify-content: center;        /* grelha sempre centrada */
  min-height: 320px;
  overflow: hidden;
}
.fp-grid-outer { position: relative; display: inline-block; }
#fpTileGrid {
  display: grid;
  border: 1px solid #9aa0a8;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  /* Impede o telemóvel de fazer scroll/zoom enquanto se pinta com o dedo,
     e impede a seleção de texto ao arrastar com o rato. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.fp-tile-cell {
  border: 1px solid rgba(0,0,0,.12);
  background-size: cover;
  background-position: center;
  transition: filter .15s ease, transform .1s ease;
  cursor: pointer;
}
/* Só realça ao passar o rato em dispositivos com rato — no telemóvel o
   "hover" fica preso no último mosaico tocado e confunde. */
@media (hover: hover) {
  .fp-tile-cell:hover {
    filter: brightness(1.15);
    z-index: 1;
    position: relative;
  }
}
/* Pré-visualização do retângulo enquanto se arrasta */
.fp-tile-cell.fp-preview-sel {
  outline: 2px solid var(--fp-gold);
  outline-offset: -2px;
  filter: brightness(1.25);
  z-index: 2;
  position: relative;
}
.fp-paint-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--fp-muted);
  line-height: 1.5;
}
.fp-mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 4px;
  font-size: 13px;
}
.fp-mode-row input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }
.fp-mode-row label { margin: 0; text-transform: none; font-size: 13px; color: var(--fp-ink); cursor: pointer; letter-spacing: 0; }
/* Cotas posicionadas em relação à própria grelha (.fp-grid-outer), para
   acompanharem sempre o pavimento onde quer que ele fique centrado. */
.fp-dim-top, .fp-dim-left {
  position: absolute;
  color: #3a4150;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}
.fp-dim-top {
  top: -26px; left: 0; right: 0;
  display: flex; align-items: center; gap: 6px;
}
.fp-dim-top .fp-line { flex: 1; height: 0; border-top: 1px solid #7d8592; }
/* Nota: o writing-mode NÃO pode ficar no contentor flex — em vertical-rl os
   eixos do flexbox rodam e a coluna passa a crescer na horizontal, o que
   espremia a cota toda num canto. Fica só no texto. */
.fp-dim-left {
  left: -28px; top: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.fp-dim-left .fp-line { flex: 1; width: 0; border-left: 1px solid #7d8592; }
#fpDepthLabel {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
}
.fp-arrow { font-size: 11px; line-height: 1; color: #7d8592; }

.fp-fit-msg { margin-top: 14px; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fp-ok); }
.fp-fit-msg.warn { color: #b45309; }
.fp-fit-msg::before { content: "✓"; font-weight: 700; }
.fp-fit-msg.warn::before { content: "!"; }

/* ---------- Painel lateral ---------- */
.fp-panel h2 {
  font-size: 15px; letter-spacing: .5px; text-transform: uppercase;
  border-bottom: 1px solid var(--fp-border); padding-bottom: 10px; margin-bottom: 18px;
}
#fpWrap label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .4px;
  color: var(--fp-muted); margin-bottom: 6px; text-transform: uppercase;
}
#fpWrap select, #fpWrap input[type=number] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--fp-border);
  border-radius: 8px; font-size: 14px; margin-bottom: 14px;
}
#fpWrap select:focus, #fpWrap input[type=number]:focus {
  outline: none; border-color: var(--fp-brand);
  box-shadow: 0 0 0 3px rgba(20,90,226,.15);
}
.fp-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fp-stat { font-size: 13px; color: var(--fp-muted); margin: -6px 0 16px; }
.fp-stat b { color: var(--fp-ink); }

#fpWrap button {
  cursor: pointer; border: none; border-radius: 8px; font-weight: 700;
  font-size: 13px; letter-spacing: .3px; font-family: inherit;
}
.fp-btn-primary {
  width: 100%; background: var(--fp-brand); color: #fff; padding: 13px;
  margin-bottom: 10px; text-transform: uppercase;
}
.fp-btn-primary:hover { background: var(--fp-brand-dark); }
.fp-btn-primary:disabled { background: #a9b4c9; cursor: not-allowed; }
.fp-btn-secondary {
  width: 100%; background: #fff; border: 1px solid var(--fp-border);
  color: var(--fp-ink); padding: 13px; margin-bottom: 18px; text-transform: uppercase;
}

.fp-swatches {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 8px;
}
.fp-swatch {
  aspect-ratio: 1; border-radius: 6px; border: 2px solid transparent; cursor: pointer;
  background-size: cover; background-position: center; position: relative;
}
.fp-swatch.selected { border-color: var(--fp-gold); box-shadow: 0 0 0 2px rgba(255,197,13,.35); }
.fp-swatch.fp-eraser {
  border: 2px dashed #999;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}
.fp-swatch.fp-eraser.selected { border-color: var(--fp-gold); border-style: solid; }
/* Mosaico vazio na grelha: quadriculado leve, para se ver que não tem peça */
.fp-tile-cell.fp-empty {
  background-image:
    linear-gradient(45deg, #e9e9e9 25%, transparent 25%, transparent 75%, #e9e9e9 75%),
    linear-gradient(45deg, #e9e9e9 25%, transparent 25%, transparent 75%, #e9e9e9 75%) !important;
  background-size: 10px 10px !important;
  background-position: 0 0, 5px 5px !important;
  background-color: #fafafa !important;
}
.fp-btn-row { display: flex; gap: 8px; margin-bottom: 18px; }
.fp-btn-row .fp-btn-secondary { margin-bottom: 0; }
.fp-btn-print {
  width: 100%;
  background: #fff;
  border: 1px solid var(--fp-border);
  color: var(--fp-muted);
  padding: 10px;
  margin-top: 8px;
  font-size: 12px;
}
.fp-btn-print:hover { color: var(--fp-ink); border-color: var(--fp-ink); }
.fp-swatch.out-of-stock { opacity: .35; cursor: not-allowed; }
.fp-swatch.out-of-stock::after {
  content: "Esgotado"; position: absolute; inset: auto 0 2px 0; text-align: center;
  font-size: 8px; font-weight: 700; color: #fff; background: rgba(0,0,0,.6);
  padding: 1px 0; border-radius: 0 0 4px 4px;
}

.fp-add-cart-total { font-size: 13px; color: var(--fp-muted); margin-top: 4px; }
.fp-note { font-size: 12px; color: var(--fp-muted); margin-top: 10px; min-height: 16px; }
.fp-note.error { color: #b91c1c; }
.fp-note.success { color: var(--fp-ok); }

.fp-breakdown {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  font-size: 13px;
  border: 1px solid var(--fp-border);
  border-radius: 8px;
  overflow: hidden;
}
.fp-breakdown li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--fp-border);
}
.fp-breakdown li:last-child { border-bottom: none; }
.fp-breakdown .fp-swatch-dot {
  width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0;
  background-size: cover; background-position: center;
}
.fp-breakdown .fp-b-name { flex: 1; }
.fp-breakdown .fp-b-empty { color: var(--fp-muted); padding: 10px; font-style: italic; }
.fp-grand-total { font-size: 15px; font-weight: 700; color: var(--fp-ink); text-align: right; }
