/* src/ActaReader.Web/wwwroot/css/acta.css
   Paleta guinda/blanco — homologada con Terrenos Bienestar. */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  margin: 0; background: #F5F5F7; color: #1D1D1F;
  -webkit-font-smoothing: antialiased;
}

.app-header {
  /* Mismo gradient guinda del .btn-canadevi de TB para coherencia visual. */
  background: linear-gradient(180deg, #9D0034 0%, #7A0026 100%); color: #fff;
  padding: 0.85rem 1.5rem; display: flex; align-items: center;
  box-shadow: 0 2px 8px rgba(122, 0, 38, .18);
}
.app-header h1 {
  margin: 0; font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em;
}

/* ── Upload ── */
.upload-wrap { max-width: 600px; margin: 4rem auto; text-align: center; }
.upload-zone {
  border: 2px dashed #bbb; border-radius: 10px;
  padding: 3rem 2rem; background: #fff; cursor: pointer; transition: border-color .2s, background .2s;
}
.upload-zone.drag-over { border-color: #7A0026; background: #FCE6EC; }
.upload-zone p { margin: 0.5rem 0; color: #666; }
#file-input { display: none; }
.btn-primary {
  margin-top: 1rem; padding: 0.65rem 1.8rem;
  /* Mismo gradient + sombra interna que .btn-canadevi de TB. */
  background: linear-gradient(180deg, #9D0034 0%, #7A0026 100%);
  color: #fff; font-weight: 600;
  border: 1px solid rgba(0, 0, 0, .06); border-radius: 8px;
  box-shadow: 0 1px 2px rgba(122, 0, 38, .25), inset 0 1px 0 rgba(255, 255, 255, .4);
  font-size: 0.95rem; font-family: inherit; cursor: pointer;
  transition: background .15s ease;
}
.btn-primary:hover { background: linear-gradient(180deg, #7A0026 0%, #5E001D 100%); }

/* ── Spinner ── */
.spinner-wrap { display: none; text-align: center; padding: 4rem 0; }
.spinner {
  width: 50px; height: 50px; margin: 0 auto 1rem;
  border: 5px solid #ddd; border-top-color: #7A0026;
  border-radius: 50%; animation: spin .85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-msg { color: #555; }

/* ── Split View ── */
.results-wrap { display: none; height: calc(100vh - 52px); }
.split { display: flex; height: 100%; }

.fields-panel {
  width: 40%; overflow-y: auto; background: #fff;
  border-right: 1px solid #d8dde3; padding: 0.85rem 1rem;
}
.fields-panel h2 { margin: 0 0 0.6rem; font-size: 0.95rem; color: #7A0026; }

.tbl { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.tbl th {
  background: #eef2f6; padding: 0.45rem 0.4rem;
  text-align: left; border-bottom: 2px solid #cdd3da; color: #333; white-space: nowrap;
}
.tbl td { padding: 0.4rem 0.4rem; border-bottom: 1px solid #eee; vertical-align: top; }
.tbl tr { cursor: pointer; }
.tbl tr:hover td { background: #FCE6EC; }
.tbl tr.active td { background: #cde0f5; }
.tbl tr.nf td { color: #b03030; }

.page-btn {
  background: #7A0026; color: #fff;
  border: none; border-radius: 4px;
  padding: 2px 8px; font-size: 0.78rem;
  cursor: pointer; font-weight: 600;
  transition: background .15s;
}
.page-btn:hover { background: #5E001D; }

.badge {
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  font-size: 0.72rem; font-weight: 700; white-space: nowrap;
}
.r  { background: #d4edda; color: #155724; }
.ia { background: #cce5ff; color: #004085; }
.no { background: #f8d7da; color: #721c24; }

.pdf-panel { flex: 1; overflow: hidden; }
#pdf-viewer { width: 100%; height: 100%; border: none; display: block; }

/* ── Error ── */
.error-wrap { display: none; max-width: 580px; margin: 3rem auto; }
.alert-err {
  background: #f8d7da; border: 1px solid #f1aeb5;
  padding: 1rem 1.2rem; border-radius: 6px; color: #721c24;
}
.alert-warn {
  background: #fff3cd; border: 1px solid #ffc107;
  padding: 0.5rem 0.8rem; border-radius: 5px; margin-bottom: 0.7rem;
  font-size: 0.82rem; color: #664d03;
}

.back-link { display: block; margin-top: 1rem; text-align: center; font-size: 0.85rem; color: #7A0026; }

@media (max-width: 768px) {
  .split { flex-direction: column; }
  .fields-panel { width: 100%; height: 45vh; border-right: none; border-bottom: 1px solid #d8dde3; }
  .pdf-panel { height: 55vh; }
}

/* Tabla anidada de socios fundadores dentro de la celda Valor */
.socios-tbl       { width:100%; border-collapse:collapse; font-size:.9em; margin:0; }
.socios-tbl th,
.socios-tbl td    { padding:.25rem .5rem; border-bottom:1px solid #eee; text-align:left; }
.socios-tbl th    { font-weight:600; color:#555; background:#fafafa; }
.socios-tbl tr:last-child td { border-bottom:none; }
.socios-tbl td:last-child,
.socios-tbl th:last-child { width:6rem; text-align:right; white-space:nowrap; }

/* ── Barra de acciones para guardar en TB (modo embebido) ── */
.save-bar{
  display:flex;align-items:center;gap:12px;padding:10px 0 14px;
  border-top:1px solid #eee;margin-top:10px;
}
.save-bar .btn-primary{margin-top:0;padding:.55rem 1.2rem;font-size:.9rem}
.save-bar .btn-primary:disabled{opacity:.5;cursor:not-allowed}
.save-status{font-size:.82rem;color:#555}
.saved-info{
  margin:8px 0 0;padding:8px 12px;border-radius:6px;
  background:#FCE6EC;border:1px solid rgba(122,0,38,.25);
  color:#5E001D;font-size:.82rem;
}

/* ── Referencia al documento fuente — link de descarga del PDF original. ── */
.doc-ref{
  display:flex;align-items:center;gap:8px;
  margin:10px 0 0;padding:9px 12px;
  background:#fff;border:1px solid #d8dde3;border-radius:6px;
  font-size:.84rem;color:#333;
}
.doc-ref .doc-ref-icon{font-size:1rem;flex-shrink:0;line-height:1}
.doc-ref-name{
  flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  font-weight:500;color:#1D1D1F;
}
.doc-ref-link{
  display:inline-flex;align-items:center;gap:4px;
  padding:4px 10px;border-radius:5px;
  background:#FCE6EC;color:#7A0026;font-weight:600;font-size:.78rem;
  text-decoration:none;border:1px solid rgba(122,0,38,.25);
  transition:background .12s ease;
}
.doc-ref-link:hover{background:#f5b3c1;color:#5E001D}
.doc-ref-link span{font-size:.95rem;line-height:1}

/* ── Badge US (User-captured) ─────────────────────────────────────────── */
.badge.us {
  background: #FFEAD1;        /* naranja claro */
  color: #B45309;             /* naranja oscuro */
}

/* ── Botón ✏ en la celda Valor ────────────────────────────────────────── */
.val-cell {
  position: relative;
}
.val-cell .val-text { display: inline-block; }
.edit-btn {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 6px; padding: 2px 6px;
  background: transparent; color: #7A0026; border: 1px solid transparent;
  border-radius: 4px; cursor: pointer; font-size: .82rem; line-height: 1;
  opacity: 0; transition: opacity .12s, background .12s, border-color .12s;
}
.tbl tr:hover .edit-btn,
.tbl tr.active .edit-btn,
.tbl tr.nf .edit-btn { opacity: 1; }
.edit-btn:hover {
  background: #FCE6EC; border-color: rgba(122, 0, 38, .25);
}

/* ── Popover flotante de edición ──────────────────────────────────────── */
.edit-pop {
  position: absolute; z-index: 1000;
  min-width: 280px; max-width: 360px;
  background: #fff; border: 1px solid #d8dde3; border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
  padding: 12px 14px;
  font-family: inherit; font-size: .85rem;
  animation: popIn .14s ease-out;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.edit-pop-arrow {
  position: absolute; left: -8px; top: 18px;
  width: 0; height: 0;
  border-top: 8px solid transparent; border-bottom: 8px solid transparent;
  border-right: 8px solid #fff;
  filter: drop-shadow(-1px 0 0 #d8dde3);
}
.edit-pop-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; gap: 8px;
}
.edit-pop-head strong {
  font-size: .9rem; color: #1D1D1F; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.edit-pop-close {
  background: transparent; border: none; cursor: pointer;
  font-size: 1.1rem; line-height: 1; color: #888;
  padding: 2px 6px; border-radius: 4px;
}
.edit-pop-close:hover { background: #f0f0f0; color: #333; }
.edit-pop-label {
  display: block; font-size: .72rem; color: #555;
  text-transform: uppercase; letter-spacing: .03em; font-weight: 700;
  margin: 6px 0 4px;
}
.edit-pop-input {
  width: 100%; padding: 7px 10px;
  border: 1px solid #d2d2d7; border-radius: 6px;
  background: #fafafa; font-family: inherit; font-size: .88rem;
  color: #1D1D1F; transition: border-color .12s, box-shadow .12s;
}
.edit-pop-input:focus {
  outline: none; border-color: #7A0026;
  box-shadow: 0 0 0 3px rgba(122, 0, 38, .12);
  background: #fff;
}
.edit-pop-value { resize: vertical; min-height: 60px; }
.edit-pop-page  { max-width: 100px; }
.edit-pop-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px;
}
.edit-pop-cancel, .edit-pop-save {
  padding: 6px 14px; border-radius: 6px;
  font-size: .84rem; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.edit-pop-cancel {
  background: #f5f5f7; color: #424245; border: 1px solid #d2d2d7;
}
.edit-pop-cancel:hover { background: #e8e8ed; }
.edit-pop-save {
  background: linear-gradient(180deg, #9D0034 0%, #7A0026 100%);
  color: #fff; border: 1px solid rgba(0, 0, 0, .06);
  box-shadow: 0 1px 2px rgba(122, 0, 38, .25), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.edit-pop-save:hover { background: linear-gradient(180deg, #7A0026 0%, #5E001D 100%); }
