/* Estilos de ficha predial para previsualización / impresión
   Referencia: Ficha_Digital_Compartir/frontend/src/components/Cara1Form.css */

.fd-preview-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 24, 0.55);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
}

.fd-preview-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: #fff;
  border-radius: 10px 10px 0 0;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--line, #d5ddd8);
  border-bottom: none;
}

.fd-preview-scroll {
  flex: 1;
  overflow: auto;
  background: #c8c8c8;
  border: 1px solid var(--line, #d5ddd8);
  border-radius: 0 0 10px 10px;
}

.ficha-predial-wrapper {
  background: #c8c8c8;
  font-family: Arial, Helvetica, sans-serif;
  display: flex;
  justify-content: center;
  padding: 20px;
  margin: 0;
  overflow-x: auto;
}

.ficha-predial-wrapper * { box-sizing: border-box; }

.ficha-predial-wrapper .sheet {
  background: #fff;
  width: 1400px;
  min-width: 1400px;
  border: 2px solid #000;
  padding: 6px;
  font-size: 11px;
  color: #000;
}

.ficha-predial-wrapper .sheet table {
  border-collapse: collapse;
  width: 100%;
  font-size: 11px; /* anula table { font-size: 0.92rem } de styles.css */
}

.ficha-predial-wrapper .sheet td,
.ficha-predial-wrapper .sheet th {
  border: 1px solid #000;
  padding: 2px 4px;
  vertical-align: middle;
  font-weight: normal;
  font-size: inherit;
  color: #000;
  background: transparent;
}

.ficha-predial-wrapper .sheet .no-border { border: none !important; }
.ficha-predial-wrapper .sheet .center { text-align: center; }
.ficha-predial-wrapper .sheet .bold { font-weight: bold; }
.ficha-predial-wrapper .sheet .tiny { font-size: 8.5px !important; }
.ficha-predial-wrapper .sheet td.reloteo-cell {
  vertical-align: top;
  font-size: 7px !important;
  line-height: 1.2;
  padding: 2px 3px;
  width: 72px;
  max-width: 78px;
}
.ficha-predial-wrapper .sheet .small { font-size: 9.5px; }
.ficha-predial-wrapper .sheet .title-main { font-size: 15px; font-weight: bold; letter-spacing: 1px; }
.ficha-predial-wrapper .sheet .title-sub { font-size: 11px; }
.ficha-predial-wrapper .sheet .section-title {
  text-align: center;
  font-weight: bold;
  font-size: 12px;
  background: #fff;
  padding: 2px 0;
}

.ficha-predial-wrapper .sheet .fillable {
  border: none;
  outline: none;
  width: 100%;
  font-family: inherit;
  font-size: 11px;
  background: transparent;
  padding: 1px 2px;
  color: #000;
}

.ficha-predial-wrapper .sheet .chk {
  width: 13px;
  height: 13px;
  border: 1px solid #000;
  display: inline-block;
  vertical-align: middle;
  background: #fff;
}
.ficha-predial-wrapper .sheet .chk.checked::after {
  content: "✕";
  display: block;
  text-align: center;
  line-height: 11px;
  font-size: 11px;
  color: #000;
  font-weight: bold;
}

.ficha-predial-wrapper .sheet .letter-cell { width: 14px; text-align: center; font-weight: bold; }
.ficha-predial-wrapper .sheet td.dest-letter {
  width: 12px;
  font-size: 8px !important;
  line-height: 1.1;
  padding: 1px 2px;
}
.ficha-predial-wrapper .sheet td.dest-label {
  font-size: 7.5px !important;
  line-height: 1.15;
  padding: 1px 3px;
  white-space: normal;
  word-break: break-word;
  max-width: 95px;
}
.ficha-predial-wrapper .sheet .npn-cell { text-align: center; padding: 0; }
.ficha-predial-wrapper .sheet .npn-cell .npn-val {
  width: 100%;
  min-height: 18px;
  text-align: center;
  font-size: 10px;
  line-height: 18px;
}
.ficha-predial-wrapper .sheet .empty-row td { height: 22px; }
.ficha-predial-wrapper .sheet .foot-note { font-size: 9px; margin-top: 4px; }
.ficha-predial-wrapper .sheet .logo-block {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
}
.ficha-predial-wrapper .sheet .logo-mark {
  width: 70px;
  height: 60px;
  background: repeating-linear-gradient(45deg, #222 0 6px, #fff 6px 12px);
  clip-path: polygon(0 0, 100% 0, 30% 100%, 0% 100%);
}
.ficha-predial-wrapper .sheet .catastro-label {
  font-weight: bold;
  font-style: italic;
  font-size: 13px;
  border-top: 1px solid #000;
  display: inline-block;
  margin-top: 4px;
}

.ficha-predial-wrapper .sheet .val-line {
  min-height: 16px;
  border-bottom: 1px solid #888;
  padding: 1px 3px;
}

@media print {
  @page {
    /* Oficio horizontal: 33 cm × 21.6 cm */
    size: 33cm 21.6cm;
    margin: 5mm;
  }
  #fd-preview-root {
    position: static !important;
    background: #fff !important;
    padding: 0 !important;
    display: block !important;
    height: auto !important;
  }
  #fd-preview-root .fd-preview-bar { display: none !important; }
  #fd-preview-root .fd-preview-scroll {
    overflow: visible !important;
    border: none !important;
    background: #fff !important;
    border-radius: 0 !important;
  }
  .ficha-predial-wrapper {
    background: #fff !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  .ficha-predial-wrapper .sheet {
    border: 1px solid #000;
    width: 100%;
    min-width: 0;
  }
  .sheet-cara2,
  .sheet-cara3,
  .sheet-cara4 {
    width: 100%;
    min-width: 0;
  }
}

/* ——— Cara 2: calificación de edificaciones ——— */
.sheet-cara2 {
  width: 1500px;
  min-width: 1500px;
  font-size: 9.5px;
}

.cara2-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr 0.95fr;
  gap: 4px;
  margin-top: 4px;
}

.cara2-col { min-width: 0; }

.calif-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 4px;
}

.calif-table td,
.calif-table th {
  border: 1px solid #000;
  padding: 1px 3px;
  vertical-align: middle;
}

.calif-table .abc-col { width: 18px; }
.calif-table .pts { width: 28px; font-weight: bold; }
.calif-table .row-label { font-size: 8px; line-height: 1.15; }

.calif-table .v-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  font-weight: bold;
  font-size: 8.5px;
  letter-spacing: 1px;
  width: 16px;
  padding: 2px 1px;
  background: #f7f7f7;
}

.calif-table .subtotal-row td { background: #f3f3f3; }

.obs-box {
  border: 1px solid #000;
  margin-top: 4px;
}

.obs-area {
  min-height: 56px;
  width: 100%;
  display: block;
  font-size: 10px;
  padding: 4px;
}

/* ——— Cara 3: localización geográfica ——— */
.sheet-cara3 {
  width: 1500px;
  min-width: 1500px;
}

.cara3-body {
  display: grid;
  grid-template-columns: 42% 58%;
  gap: 0;
  margin-top: -1px;
  border: 1px solid #000;
  border-top: none;
  min-height: 720px;
}

.cara3-left {
  border-right: 1px solid #000;
  display: flex;
  flex-direction: column;
}

.colind-table {
  width: 100%;
  border-collapse: collapse;
  flex: 1;
}

.colind-table td,
.colind-table th {
  border: 1px solid #000;
  padding: 1px 3px;
}

.colind-table .dir-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-weight: bold;
  font-size: 10px;
  letter-spacing: 2px;
  width: 22px;
  background: #f7f7f7;
  text-align: center;
}

.obs-strip {
  display: flex;
  border-top: 1px solid #000;
  min-height: 70px;
}

.obs-strip .v-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-weight: bold;
  font-size: 9px;
  letter-spacing: 1px;
  padding: 4px 2px;
  border-right: 1px solid #000;
  background: #f7f7f7;
}

.obs-strip .obs-area {
  flex: 1;
  border: none;
  min-height: 70px;
  padding: 4px;
  font-size: 10px;
}

.cara3-right {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.croquis-title {
  border-bottom: 1px solid #000;
  padding: 3px 0;
}

.croquis-wrap {
  flex: 1;
  display: flex;
  min-height: 680px;
}

.obs-vertical {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-weight: bold;
  font-size: 9px;
  letter-spacing: 2px;
  width: 22px;
  border-right: 1px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7f7f7;
}

.croquis-grid {
  flex: 1;
  position: relative;
  background-color: #fff;
  background-image:
    linear-gradient(#cfcfcf 1px, transparent 1px),
    linear-gradient(90deg, #cfcfcf 1px, transparent 1px);
  background-size: 14px 14px;
  overflow: hidden;
}

.croquis-grid.has-image {
  background-image: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.croquis-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.compass {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 56px;
  height: 56px;
}

.compass .c-rose {
  position: absolute;
  inset: 12px;
  background:
    linear-gradient(45deg, transparent 46%, #000 46%, #000 54%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, #000 46%, #000 54%, transparent 54%),
    linear-gradient(#000, #000) center/2px 100% no-repeat,
    linear-gradient(#000, #000) center/100% 2px no-repeat;
}

.compass .c-n,
.compass .c-e,
.compass .c-s,
.compass .c-o {
  position: absolute;
  font-size: 10px;
  font-weight: bold;
}

.compass .c-n { top: 0; left: 50%; transform: translateX(-50%); }
.compass .c-s { bottom: 0; left: 50%; transform: translateX(-50%); }
.compass .c-e { right: 0; top: 50%; transform: translateY(-50%); }
.compass .c-o { left: 0; top: 50%; transform: translateY(-50%); }

.escala-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 8px;
}

.escala-item {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* ——— Cara 4: justificación + mutaciones ——— */
.sheet-cara4 {
  width: 1500px;
  min-width: 1500px;
}

.just-table,
.mut-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: -1px;
}

.just-table td,
.just-table th,
.mut-table td,
.mut-table th {
  border: 1px solid #000;
  padding: 1px 2px;
  vertical-align: middle;
  font-size: 8.5px;
}

.just-table .modo-head,
.just-table .modo-cell {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-weight: bold;
  font-size: 9px;
  letter-spacing: 1px;
  text-align: center;
  background: #f7f7f7;
  width: 22px;
}

.just-table .empty-row td,
.mut-table .empty-row td {
  height: 22px;
}

.mut-table th { background: #fafafa; }
