/* ══════════════════════════════════════════════════════════════
   app-firmas.css — Módulo de firma electrónica (app.arbitrar.pe)
   Paleta: gris oscuro #08102a + dorado #FEC002
   ══════════════════════════════════════════════════════════════ */

/* ── Chips de estado ─────────────────────────────────────────── */
.firma-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.chip-pendiente  { background: rgba(120,130,160,0.15); color: #a0aacc; border: 1px solid rgba(120,130,160,0.3); }
.chip-visto      { background: rgba(90,160,255,0.12);  color: #7ab3ff; border: 1px solid rgba(90,160,255,0.3); }
.chip-firmado    { background: rgba(52,201,138,0.12);  color: #34c98a; border: 1px solid rgba(52,201,138,0.3); }
.chip-rechazado  { background: rgba(224,82,82,0.12);   color: #e05252; border: 1px solid rgba(224,82,82,0.3); }
.chip-en-proceso { background: rgba(254,192,2,0.12);   color: #FEC002; border: 1px solid rgba(254,192,2,0.3); }
.chip-completado { background: rgba(52,201,138,0.12);  color: #34c98a; border: 1px solid rgba(52,201,138,0.3); }
.chip-cancelado  { background: rgba(100,100,120,0.12); color: #808090; border: 1px solid rgba(100,100,120,0.3); }

/* ── Spinner ─────────────────────────────────────────────────── */
.firma-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(254,192,2,0.2);
  border-top-color: #FEC002;
  border-radius: 50%;
  animation: firma-spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes firma-spin { to { transform: rotate(360deg); } }

/* ── Tab container ───────────────────────────────────────────── */
.firmas-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 40px 0;
  color: #7a8aaa;
  font-size: 0.85rem;
  justify-content: center;
}

.firmas-empty {
  text-align: center;
  padding: 40px 16px;
  color: #7a8aaa;
  font-size: 0.88rem;
}

.firmas-empty-small {
  padding: 12px 16px;
  color: #7a8aaa;
  font-size: 0.82rem;
}

/* ── Toolbar ─────────────────────────────────────────────────── */
.firmas-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 0 0 14px;
}

.btn-firmas-nuevo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FEC002;
  color: #08102a;
  font-size: 0.82rem;
  font-weight: 700;
  border: none;
  border-radius: 7px;
  padding: 8px 16px;
  cursor: pointer;
  transition: opacity .15s;
}

.btn-firmas-nuevo:hover { opacity: 0.85; }

/* ── Lista de procesos ───────────────────────────────────────── */
.firmas-lista {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.firma-proceso-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(254,192,2,0.15);
  border-radius: 10px;
  overflow: hidden;
}

.firma-proceso-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  gap: 12px;
  flex-wrap: wrap;
}

.firma-proceso-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.firma-proceso-nombre {
  font-size: 0.88rem;
  font-weight: 600;
  color: #e8eaf0;
}

.firma-proceso-fecha {
  font-size: 0.73rem;
  color: #7a8aaa;
}

.firma-proceso-estado {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Tabla de firmantes ──────────────────────────────────────── */
.firmantes-table-wrap {
  overflow-x: auto;
}

.firmantes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.firmantes-table thead tr {
  background: rgba(255,255,255,0.03);
}

.firmantes-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7a8aaa;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.firmantes-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: #c8d0e0;
  vertical-align: middle;
}

.firmante-row:last-child td { border-bottom: none; }

.td-firmante-nombre {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
}

.firmante-inicial {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(254,192,2,0.15);
  color: #FEC002;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.firmante-rol-badge {
  font-size: 0.65rem;
  background: rgba(90,160,255,0.1);
  color: #7ab3ff;
  border: 1px solid rgba(90,160,255,0.25);
  border-radius: 4px;
  padding: 1px 5px;
}

.td-firmante-email { color: #7a8aaa; min-width: 160px; }
.td-firmante-fecha { color: #7a8aaa; white-space: nowrap; min-width: 130px; }
.td-firmante-acciones { white-space: nowrap; }

/* ── Botones de acción en tabla ──────────────────────────────── */
.btn-firma-accion {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  padding: 4px 9px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid;
  transition: opacity .15s;
  margin-right: 4px;
}

.btn-firma-accion:hover { opacity: 0.75; }
.btn-firma-accion:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-copiar-link {
  background: rgba(254,192,2,0.1);
  border-color: rgba(254,192,2,0.3);
  color: #FEC002;
}

.btn-reenviar {
  background: rgba(120,130,200,0.1);
  border-color: rgba(120,130,200,0.3);
  color: #a0aadd;
}

.btn-firmar-embedded {
  background: rgba(52,201,138,0.1);
  border-color: rgba(52,201,138,0.3);
  color: #34c98a;
}

.btn-firma-cancelar {
  font-size: 0.72rem;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid rgba(224,82,82,0.35);
  color: #e05252;
  border-radius: 5px;
  cursor: pointer;
  transition: background .15s;
}

.btn-firma-cancelar:hover { background: rgba(224,82,82,0.1); }

/* ══════════════════════════════════════════════════════════════
   MODALES
   ══════════════════════════════════════════════════════════════ */

.firma-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: firma-fade-in 0.15s ease;
}

@keyframes firma-fade-in { from { opacity: 0; } to { opacity: 1; } }

.firma-modal {
  background: #111e3a;
  border: 1px solid rgba(254,192,2,0.2);
  border-radius: 12px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

.firma-modal-lg  { max-width: 680px; }
.firma-modal-xl  { max-width: 860px; }

.firma-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.firma-modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e8eaf0;
}

.firma-modal-close {
  background: none;
  border: none;
  color: #7a8aaa;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color .15s;
}

.firma-modal-close:hover { color: #FEC002; }

.firma-modal-body {
  padding: 20px;
  flex: 1;
}

/* ── Pasos del modal ─────────────────────────────────────────── */
.modal-step-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #FEC002;
  margin-bottom: 14px;
  font-weight: 600;
}

.modal-section-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #c8d0e0;
  margin-bottom: 12px;
}

.modal-hint {
  font-size: 0.8rem;
  color: #7a8aaa;
  margin-bottom: 14px;
}

/* ── Lista de actas ──────────────────────────────────────────── */
.actas-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  max-height: 260px;
  overflow-y: auto;
}

.acta-opcion {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

.acta-opcion:hover { border-color: rgba(254,192,2,0.35); background: rgba(254,192,2,0.04); }
.acta-opcion input[type="radio"] { accent-color: #FEC002; width: 15px; height: 15px; flex-shrink: 0; }

.acta-opcion-info { display: flex; flex-direction: column; gap: 2px; }
.acta-opcion-nombre { font-size: 0.88rem; font-weight: 600; color: #e8eaf0; }
.acta-opcion-fecha  { font-size: 0.75rem; color: #7a8aaa; }

/* ── Tabla de edición de firmantes ───────────────────────────── */
.firmantes-edit-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
}

.firmantes-edit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.firmantes-edit-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7a8aaa;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.firmantes-edit-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  vertical-align: middle;
}

.firmantes-edit-table tr:last-child td { border-bottom: none; }

.inp-firmante-nombre,
.inp-firmante-email {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e8eaf0;
  border-radius: 5px;
  padding: 5px 9px;
  font-size: 0.82rem;
  width: 100%;
  outline: none;
  transition: border-color .12s;
}

.inp-firmante-nombre:focus,
.inp-firmante-email:focus { border-color: rgba(254,192,2,0.5); }

/* ── Footer del modal ────────────────────────────────────────── */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 8px;
}

.btn-modal-pri {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FEC002;
  color: #08102a;
  font-size: 0.83rem;
  font-weight: 700;
  border: none;
  border-radius: 7px;
  padding: 9px 20px;
  cursor: pointer;
  transition: opacity .15s;
}

.btn-modal-pri:hover  { opacity: 0.85; }
.btn-modal-pri:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-modal-sec {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: #a0aacc;
  font-size: 0.83rem;
  border-radius: 7px;
  padding: 9px 16px;
  cursor: pointer;
  transition: border-color .12s, color .12s;
}

.btn-modal-sec:hover { border-color: rgba(254,192,2,0.4); color: #FEC002; }

/* ── Mensaje de error ────────────────────────────────────────── */
.modal-error-msg {
  background: rgba(224,82,82,0.1);
  border: 1px solid rgba(224,82,82,0.3);
  color: #e05252;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.modal-error-msg.hidden { display: none; }

/* ── DocuSeal builder (Paso 2) ───────────────────────────────── */
.builder-wrap {
  width: 100%;
  min-height: 560px;
  border: 1px solid rgba(254,192,2,0.18);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  margin-bottom: 12px;
}

docuseal-builder {
  display: block;
  width: 100%;
  min-height: 560px;
}

.builder-saved-msg {
  font-size: 0.82rem;
  color: #34c98a;
  background: rgba(52,201,138,0.08);
  border: 1px solid rgba(52,201,138,0.25);
  border-radius: 6px;
  padding: 7px 14px;
  margin-bottom: 8px;
}

.builder-saved-msg.hidden { display: none; }
